diff --git a/calendar.html b/calendar.html
index c3acf920..799dd547 100644
--- a/calendar.html
+++ b/calendar.html
@@ -9,8 +9,15 @@
-
-
+
+
+
+
+
+
+
+
diff --git a/js/background.js b/js/background.js
index d03a9132..5cbdd454 100644
--- a/js/background.js
+++ b/js/background.js
@@ -1,10 +1,10 @@
/* Handle messages and their commands from content and popup scripts*/
chrome.runtime.onMessage.addListener(function (request, sender, response) {
- switch(request.command){
- case "courseStorage":
+ switch (request.command) {
+ case "courseStorage":
if (request.action == "add") {
- add(request, sender, response);
+ add(request, sender, response);
}
if (request.action == "remove") {
remove(request, sender, response);
@@ -43,9 +43,8 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
/* Initially set the course data in storage */
chrome.runtime.onInstalled.addListener(function (details) {
if (details.reason == "install") {
- chrome.storage.sync.get('savedCourses', function(data){
- if(!data.savedCourses){
- console.log(data.savedCourses);
+ chrome.storage.sync.get('savedCourses', function (data) {
+ if (!data.savedCourses) {
var arr = new Array();
chrome.storage.sync.set({
savedCourses: arr
@@ -57,9 +56,14 @@ chrome.runtime.onInstalled.addListener(function (details) {
}, function () {
console.log('initial highlighting: true');
});
+ chrome.storage.sync.set({
+ loadAll: true
+ }, function () {
+ console.log('initial loadAll: true');
+ });
}
});
- } else if(details.reason == "update"){
+ } else if (details.reason == "update") {
console.log("updated");
}
});
@@ -221,7 +225,7 @@ function updateStatus() {
dummy.innerHTML = result;
let newstatus = dummy.querySelector('[data-th="Status"]').textContent;
let registerlink = dummy.querySelector('td[data-th="Add"] a');
- if(registerlink){
+ if (registerlink) {
registerlink = registerlink.getAttribute('href');
}
c.registerlink = registerlink;
@@ -235,4 +239,4 @@ function updateStatus() {
});
// console.log("updated status' and registerlinks");
});
-}
+}
\ No newline at end of file
diff --git a/js/content.js b/js/content.js
index b7da9883..71e93a4b 100644
--- a/js/content.js
+++ b/js/content.js
@@ -29,8 +29,8 @@ const butdelay = 75;
//This extension may be super lit, but you know what's even more lit?
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
$(function () {
+
loadNextPages($("html").html());
- $('[title*="next listing"]').remove();
loadDataBase();
//make heading and modal
if (!$("#kw_results_table").length) {
@@ -139,37 +139,42 @@ $(function () {
});
function loadNextPages(inHTML) {
- var html = $('').html(inHTML).contents();
- let next = html.find("#next_nav_link");
- if (next.length) {
- let link = next.prop('href');
- console.log(link);
- chrome.runtime.sendMessage({
- method: "GET",
- action: "xhttp",
- url: link,
- data: ""
- }, function (response) {
- if (response) {
- var nextpage = $('').html(response).contents();
- var current = $('tbody');
- nextpage.find('tbody>tr').each(function () {
- if (!($(this).find('td').hasClass("course_header") && $(this).has('th').length == 0)) {
- $(this).append(` | `);
- // if ($(this).find('td[data-th="Status"]').text().includes('waitlisted')) {
- // $(this).find('td').each(function () {
- // $(this).css('background-color', '#E0E0E0');
- // });
- // }
+ chrome.storage.sync.get('loadAll', function (data) {
+ if (data.loadAll) {
+ $('[title*="next listing"]').remove();
+ var html = $('').html(inHTML).contents();
+ let next = html.find("#next_nav_link");
+ if (next.length) {
+ let link = next.prop('href');
+ console.log(link);
+ chrome.runtime.sendMessage({
+ method: "GET",
+ action: "xhttp",
+ url: link,
+ data: ""
+ }, function (response) {
+ if (response) {
+ var nextpage = $('').html(response).contents();
+ var current = $('tbody');
+ nextpage.find('tbody>tr').each(function () {
+ if (!($(this).find('td').hasClass("course_header") && $(this).has('th').length == 0)) {
+ $(this).append(` | `);
+ // if ($(this).find('td[data-th="Status"]').text().includes('waitlisted')) {
+ // $(this).find('td').each(function () {
+ // $(this).css('background-color', '#E0E0E0');
+ // });
+ // }
+ }
+ current.append($(this));
+ });
+ loadNextPages(response);
}
- current.append($(this));
- });
- loadNextPages(response);
+ })
+ } else {
+ update();
}
- })
- } else {
- update();
- }
+ }
+ });
}
function saveCourse() {
diff --git a/js/options.js b/js/options.js
index d376f673..65bfd7a3 100644
--- a/js/options.js
+++ b/js/options.js
@@ -1,38 +1,70 @@
var manifestData = chrome.runtime.getManifest();
$("#version").text(manifestData.version);
-chrome.storage.sync.get('courseConflictHighlight', function(data) {
- if(data.courseConflictHighlight){
- off();
+chrome.storage.sync.get('courseConflictHighlight', function (data) {
+ if (data.courseConflictHighlight) {
+ off('courseConflictHighlight');
+ } else {
+ on('courseConflictHighlight');
}
- else {
- on();
+});
+chrome.storage.sync.get('loadAll', function (data) {
+ if (data.loadAll) {
+ off('loadAll');
+ } else {
+ on('loadAll');
}
});
-$("#toggleConflictHighlighting").click(function(){
- var action = $("#toggleConflictHighlighting").text();
- if(action == "Turn Off"){
- chrome.storage.sync.set({courseConflictHighlight: false}, function() {
- on();
+$("#togglecourseConflictHighlight").click(function () {
+ var action = $("#togglecourseConflictHighlight").text();
+ if (action == "Turn Off") {
+ chrome.storage.sync.set({
+ courseConflictHighlight: false
+ }, function () {
+ on('courseConflictHighlight');
+ });
+ } else {
+ chrome.storage.sync.set({
+ courseConflictHighlight: true
+ }, function () {
+ off('courseConflictHighlight');
});
- } else{
- chrome.storage.sync.set({courseConflictHighlight: true}, function() {
- off();
- });
}
- chrome.tabs.query({}, function(tabs) {
- for(var i = 0; i
+
-
-