From 1418323f9598ff7bc8cc53a208288e6195865a68 Mon Sep 17 00:00:00 2001 From: 10001shh Date: Thu, 10 Jan 2019 20:36:13 -0600 Subject: [PATCH] optimization and scrolling to load more courses --- css/styles.css | 15 ++++++++ js/background.js | 6 ++++ js/content.js | 93 +++++++++++++++++++++++++++++++++--------------- js/popup.js | 6 ++++ 4 files changed, 92 insertions(+), 28 deletions(-) diff --git a/css/styles.css b/css/styles.css index 4230369e..080dcc09 100644 --- a/css/styles.css +++ b/css/styles.css @@ -21,6 +21,21 @@ width: 50%; } +.loader { + border: 10px solid #f3f3f3; /* Light grey */ + border-top: 10px solid #bf5700; /* Blue */ + border-radius: 50%; + width: 50px; + height: 50px; + display: none; + animation: spin 2s linear infinite; + } + + @keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } + } + /* The Close Button */ .close { diff --git a/js/background.js b/js/background.js index 0f552aea..22ed00fb 100644 --- a/js/background.js +++ b/js/background.js @@ -157,6 +157,9 @@ function add(request, sender, sendResponse) { savedCourses: courses }); } + chrome.browserAction.setBadgeBackgroundColor({ + color: '#bf5700' + }); chrome.browserAction.setBadgeText({ text: "" + courses.length }); sendResponse({ done: "Added: (" + request.course.unique + ") " + request.course.coursename, @@ -177,6 +180,9 @@ function remove(request, sender, sendResponse) { chrome.storage.sync.set({ savedCourses: courses }); + chrome.browserAction.setBadgeBackgroundColor({ + color: '#bf5700' + }); chrome.browserAction.setBadgeText({ text: "" + courses.length }); sendResponse({ done: "Removed: (" + request.course.unique + ") " + request.course.coursename, diff --git a/js/content.js b/js/content.js index 2750a077..fdd50368 100644 --- a/js/content.js +++ b/js/content.js @@ -1,5 +1,7 @@ var grades; var rmpLink; +var next; +var bottom; var eCISLink; var textbookLink; var coursename; @@ -16,6 +18,7 @@ var description; var status; var semesterCode; var isIndividual = false; +var done = true; const days = new Map([ ["M", "Monday"], @@ -29,12 +32,16 @@ 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()); + next = $("#next_nav_link"); loadDataBase(); //make heading and modal if (!$("#kw_results_table").length) { $("table thead th:last-child").after('Plus'); + $("table").after(`
+
+
+ +
`); var modhtml = `