options and more

This commit is contained in:
Sriram Hariharan
2018-07-18 20:07:08 -05:00
parent 5e39221c2c
commit 73cbbd1cfb
6 changed files with 107 additions and 71 deletions

30
js/options.js Normal file
View File

@@ -0,0 +1,30 @@
chrome.storage.sync.get('courseConflictHighlight', function(data) {
if(data.courseConflictHighlight){
$("#toggleConflictHighlighting").text("Turn Off");
$("#toggleConflictHighlighting").css("background","#F44336");
}
else {
$("#toggleConflictHighlighting").text("Turn On");
$("#toggleConflictHighlighting").css("background","#4CAF50");
}
});
$("#toggleConflictHighlighting").click(function(){
var action = $("#toggleConflictHighlighting").text();
if(action == "Turn Off"){
chrome.storage.sync.set({courseConflictHighlight: false}, function() {
$("#toggleConflictHighlighting").text("Turn On");
$("#toggleConflictHighlighting").css("background","#4CAF50");
});
} else{
chrome.storage.sync.set({courseConflictHighlight: true}, function() {
$("#toggleConflictHighlighting").text("Turn Off");
$("#toggleConflictHighlighting").css("background","#F44336");
});
}
chrome.tabs.query({}, function(tabs) {
for(var i = 0; i<tabs.length; i++){
chrome.tabs.sendMessage(tabs[i].id, {command: "updateCourseList"});
}
});
});