diff --git a/README.md b/README.md index f26d95ff..4620f3b1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # UT Registration Plus -## Try it for yourself: -[on the chrome web store](https://chrome.google.com/webstore/detail/hboadpjkoaieogjimneceaahlppnipaa/publish-accepted?authuser=0&hl=en-US) +[Try it for yourself on the Chrome Web Store](https://chrome.google.com/webstore/detail/hboadpjkoaieogjimneceaahlppnipaa/publish-accepted?authuser=0&hl=en-US) We've all been there. 20 tabs of Rate My Professor, Catalyst, and the UT Course Catalog open and you still don't know what classes to take. This extension tries to streamline most of the unnecessary steps and headaches of registering for classes at UT Austin. diff --git a/js/options.js b/js/options.js index cacf7ab8..95aa237a 100644 --- a/js/options.js +++ b/js/options.js @@ -1,11 +1,9 @@ chrome.storage.sync.get('courseConflictHighlight', function(data) { if(data.courseConflictHighlight){ - $("#toggleConflictHighlighting").text("Turn Off"); - $("#toggleConflictHighlighting").css("background","#F44336"); + off(); } else { - $("#toggleConflictHighlighting").text("Turn On"); - $("#toggleConflictHighlighting").css("background","#4CAF50"); + on(); } }); @@ -13,13 +11,11 @@ $("#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"); + on(); }); } else{ chrome.storage.sync.set({courseConflictHighlight: true}, function() { - $("#toggleConflictHighlighting").text("Turn Off"); - $("#toggleConflictHighlighting").css("background","#F44336"); + off(); }); } chrome.tabs.query({}, function(tabs) { @@ -27,4 +23,14 @@ $("#toggleConflictHighlighting").click(function(){ chrome.tabs.sendMessage(tabs[i].id, {command: "updateCourseList"}); } }); -}); \ No newline at end of file +}); + + +function on(){ + $("#toggleConflictHighlighting").text("Turn On"); + $("#toggleConflictHighlighting").css("background","#4CAF50"); +} +function off(){ + $("#toggleConflictHighlighting").text("Turn Off"); + $("#toggleConflictHighlighting").css("background","#F44336"); +} \ No newline at end of file