diff --git a/background.js b/background.js
index cad05dd3..467751ee 100644
--- a/background.js
+++ b/background.js
@@ -7,8 +7,11 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
remove(request,sender,response);
}
}
+ if(request.command == "checkConflicts"){
+ //Check conflicts
+ }
else if(request.command == "alreadyContains"){
- alreadyContains(request.course,response);
+ alreadyContains(request.unique,response);
}
else{
const xhr = new XMLHttpRequest();
@@ -58,13 +61,13 @@ function remove(request, sender, sendResponse) {
});
}
-function alreadyContains(course,sendResponse){
+function alreadyContains(unique,sendResponse){
chrome.storage.sync.get('savedCourses', function(data) {
courses = data.savedCourses;
var contains = false;
var i = 0;
while(i < courses.length && !contains){
- if(courses[i].unique == course.unique){
+ if(courses[i].unique == unique){
contains = true;
}
i++;
diff --git a/content.js b/content.js
index 93a2a4ca..ceabc20f 100644
--- a/content.js
+++ b/content.js
@@ -21,26 +21,20 @@ const butdelay = 100;
$(document).ready( function() {
loadDataBase();
- //make heading
+ //make heading and modal
$("table thead th:last-child").after('
Plus | ');
var modhtml = '×Computer Fluency (C S 302)
with Bruce Porter
'
$("#container").prepend(modhtml);
- //console.log(grades);
- $('table').find('tr').each(function(){
- if($(this).find('td').hasClass("course_header")){
- } else if($(this).has('th').length == 0){
- var rating;
- var profname = $(this).find('td[data-th="Instructor"]').text() + "";
- //console.log(profname);
- if(profname == ""){
- //console.log("No Professor");
- rating = "No Prof :(";
- } else {
- let lastname = profname.split(',')[0];
- rating = "Hello";
- }
+ $('table').find('tr').each(function(){
+ if(!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0){
+ //if a course row, then add the extension button and do something if that course has been "saved"
$(this).append('
| ');
+ chrome.runtime.sendMessage({command: "alreadyContains",unique: $(this).find('td[data-th="Unique"]').text()}, function(response) {
+ if(response.alreadyContains){
+ //DO SOMETHING IF ALREADY CONTAINS
+ }
+ });
}
});
@@ -56,7 +50,6 @@ $(document).ready( function() {
$("#saveCourse").text(response.label);
alert(response.done);
});
- $("#saveCourse").text("Remove Course");
});
$("#Syllabi").click(function(){
@@ -189,8 +182,7 @@ function getDistribution(){
function openDialog(dep,cls,sem,professor,res){
$(".modal").fadeIn(fadetime);
- var c = new Course(coursename,uniquenum, profname, times, dates, locations, status, profurl);
- chrome.runtime.sendMessage({command: "alreadyContains",course: c}, function(response) {
+ chrome.runtime.sendMessage({command: "alreadyContains",unique: uniquenum}, function(response) {
console.log("Already Contains: "+response.alreadyContains);
if(response.alreadyContains){
$("#saveCourse").text("Remove Course -");
diff --git a/todo b/todo
index d5f0a2ce..57d71d45 100644
--- a/todo
+++ b/todo
@@ -1,12 +1,11 @@
TODO:
- undefined prof, show all possible profs from past?
DIFFERENT IF NO PROF
-- Saving courses
- popup.html
- Online classes/no location
- Schedule Conflicts
-- waitlist/closed/open colors
- fix close button
+- save image of modal?
- Degree plan?
- underline Courses maybe? click to go to using the planner link thing
- when almost everything is blank: M 379H as example
@@ -34,4 +33,5 @@ FIXED/DONE since 7/7/18:
- location w/ map
- eCIS? link or scrape (nah just scrape)
- maybe modal animations?
-
+- Saving courses
+- waitlist/closed/open colors