This commit is contained in:
sghsri
2018-08-31 17:56:16 -05:00
parent 1104dc1189
commit 996e18ca6b
3 changed files with 22 additions and 17 deletions

View File

@@ -67,8 +67,12 @@ $(function () {
let status = savedCourses[currindex].status; let status = savedCourses[currindex].status;
if (status.includes("closed") || status.includes("cancelled")) { if (status.includes("closed") || status.includes("cancelled")) {
$("#register").text("Class Closed").css("background-color", "#FF5722"); $("#register").text("Class Closed").css("background-color", "#FF5722");
} else { }
$("#register").text("Register").css("background-color", "#4CAF50"); else if(status.includes("waitlisted")){
$("#register").text("Join Waitlist").css("background-color", "#FF9800");
}
else {
$("#register").text("register").css("background-color", "#4CAF50");
} }
} }
}); });

View File

@@ -30,12 +30,6 @@ const butdelay = 75;
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann //Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
$(function () { $(function () {
loadDataBase(); loadDataBase();
chrome.runtime.sendMessage({
command: "updateStatus",
}, function (response) {
console.log(response);
});
//make heading and modal //make heading and modal
$("table thead th:last-child").after('<th scope=col>Plus</th>'); $("table thead th:last-child").after('<th scope=col>Plus</th>');
var modhtml = '<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer><h2 class=title id="title">Computer Fluency (C S 302)</h2><h2 class=profname id="profname">with Bruce Porter</h2><div id="topbuttons" class=topbuttons><button class=matbut id="rateMyProf" style="background: #4CAF50;"> RMP </button><button class=matbut id="eCIS" style="background: #CDDC39;"> eCIS </button><button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button><button class=matbut id="Syllabi"> Past Syllabi </button><button class=matbut id="saveCourse" style="background: #F44336;"> Save Course +</button></div></div></div><div class=card><div class=cardcontainer style=""><ul class=description id="description" style="list-style-type:disc"></ul></div></div><div class=card ><div id="chartcontainer" class=cardcontainer><div id=chart></div></div></div>'; var modhtml = '<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer><h2 class=title id="title">Computer Fluency (C S 302)</h2><h2 class=profname id="profname">with Bruce Porter</h2><div id="topbuttons" class=topbuttons><button class=matbut id="rateMyProf" style="background: #4CAF50;"> RMP </button><button class=matbut id="eCIS" style="background: #CDDC39;"> eCIS </button><button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button><button class=matbut id="Syllabi"> Past Syllabi </button><button class=matbut id="saveCourse" style="background: #F44336;"> Save Course +</button></div></div></div><div class=card><div class=cardcontainer style=""><ul class=description id="description" style="list-style-type:disc"></ul></div></div><div class=card ><div id="chartcontainer" class=cardcontainer><div id=chart></div></div></div>';

View File

@@ -70,14 +70,14 @@ function updateConflicts() {
var between = response.between; var between = response.between;
var text = ""; var text = "";
for (var i = 0; i < between.length; i++) { for (var i = 0; i < between.length; i++) {
text += "Conflict between: " + getSimpleName(between[i][0].coursename, between[i][0].unique) + " and " + getSimpleName(between[i][1].coursename, between[i][1].unique); text += "CONFLICT: " + getSimpleName(between[i][0].coursename, between[i][0].unique) + " and " + getSimpleName(between[i][1].coursename, between[i][1].unique);
isConflicted.push(between[i][0].unique); isConflicted.push(between[i][0].unique);
isConflicted.push(between[i][1].unique); isConflicted.push(between[i][1].unique);
if (i != between.length - 1) { if (i != between.length - 1) {
text += "<br>"; text += "<br>";
} }
} }
$("#courseList").prepend("<p style='font-size:small;font-weight:bold; color:red; margin:5px;'>" + text + "</>"); $("#courseList").prepend("<p style='font-size:small; font-weight:bold; color:red; margin:5px 5px 5px 10px'>" + text + "</>");
} }
}); });
} }
@@ -89,17 +89,24 @@ $(document).ready(function () {
window.open(courses[$(this).closest("li").attr("id")].link); window.open(courses[$(this).closest("li").attr("id")].link);
}); });
let status = courses[$(this).closest("li").attr("id")].status; let status = courses[$(this).closest("li").attr("id")].status;
if (status.includes("closed") || status.includes("cancelled")) { if (status.includes("closed") || status.includes("cancelled")) {
$(this).find("#register").text("Class Closed").css("background-color","#FF5722"); $(this).find("#register").text("Class Closed").css("background-color","#FF5722");
} else{ }
$(this).find("#register").text("Register").css("background-color","#4CAF50").click(function () { else {
if(status.includes("waitlisted")){
$(this).find("#register").text("Join Waitlist").css("background-color", "#FF9800");
}
else {
$(this).find("#register").text("Register").css("background-color", "#4CAF50");
}
$(this).find("#register").click(function (){
let registerlink = courses[$(this).closest("li").attr("id")].registerlink; let registerlink = courses[$(this).closest("li").attr("id")].registerlink;
chrome.tabs.query({currentWindow: true, active: true}, function (tab) { chrome.tabs.query({currentWindow: true, active: true}, function (tab) {
chrome.tabs.update(tab.id, {url: registerlink}); chrome.tabs.update(tab.id, {url: registerlink});
}); });
}); })
} }
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/ /* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
$(this).find("#listRemove").click(function () { $(this).find("#listRemove").click(function () {
var thisForm = this; var thisForm = this;