diff --git a/background.js b/background.js index 467751ee..b99c502e 100644 --- a/background.js +++ b/background.js @@ -7,12 +7,15 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) { remove(request,sender,response); } } - if(request.command == "checkConflicts"){ + else if(request.command == "checkConflicts"){ //Check conflicts } else if(request.command == "alreadyContains"){ alreadyContains(request.unique,response); } + else if(request.command == "getCourses"){ + getCourses(response); + } else{ const xhr = new XMLHttpRequest(); const method = request.method ? request.method.toUpperCase() : "GET"; @@ -34,6 +37,13 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) { }); }); + +function getCourses(sendResponse){ + chrome.storage.sync.get('savedCourses', function(data) { + sendResponse({done:data.savedCourses}); + }); +} + function add(request, sender, sendResponse) { var courses; var response; diff --git a/content.js b/content.js index ceabc20f..16ee6c20 100644 --- a/content.js +++ b/content.js @@ -23,9 +23,8 @@ $(document).ready( function() { loadDataBase(); //make heading and modal $("table thead th:last-child").after('Plus'); - var modhtml = '