diff --git a/js/calendar.js b/js/calendar.js index 9fd28dbc..82386683 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -164,7 +164,7 @@ $(function () { function makeMap(datetimearr) { var dtmap = new Map([]); for (var i = 0; i < datetimearr.length; i++) { - console.log(datetimearr[i][1][0]); + //console.log(datetimearr[i][1][0]); datetimearr[i][1][0] = moment(datetimearr[i][1][0], ["HH:mm A"]).format("h:mm A"); datetimearr[i][1][1] = moment(datetimearr[i][1][1], ["HH:mm A"]).format("h:mm A"); } @@ -232,8 +232,8 @@ $(function () { //create the event object for every section function setEventForSection(session, colorCounter, i) { - console.log(moment().startOf('month').format("YYYY-MM-D")); - console.log(moment().day(fullday)); + // console.log(moment().startOf('month').format("YYYY-MM-D")); + // console.log(moment().day(fullday)); var fullday = days.get(session[0]); var classInfo = savedCourses[i]; var department = classInfo.coursename.substring(0, classInfo.coursename.search(/\d/) - 2); @@ -277,7 +277,7 @@ $(function () { chrome.storage.sync.get("savedCourses", function (data) { savedCourses = data.savedCourses setAllEvents(data.savedCourses); - console.log(classSchedules); + // console.log(classSchedules); $('#calendar').fullCalendar('removeEventSources'); $("#calendar").fullCalendar('addEventSource', classSchedules, true); }); diff --git a/js/content.js b/js/content.js index 0cb89699..2a9ddf85 100644 --- a/js/content.js +++ b/js/content.js @@ -89,7 +89,7 @@ $(function () { chrome.runtime.onMessage.addListener( function (request, sender, sendResponse) { if (request.command == "updateCourseList") { - console.log("hello"); + // console.log("hello"); update(); } }); @@ -193,7 +193,7 @@ function getCourseInfo(row) { if ($(this).is(row)) { profurl = $(this).find('td[data-th="Unique"] a').prop('href'); registerlink = $(this).find('td[data-th="Add"] a').prop('href'); - console.log(registerlink); + // console.log(registerlink); uniquenum = $(this).find('td[data-th="Unique"]').text(); status = $(this).find('td[data-th="Status"]').text(); profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0]; @@ -222,7 +222,7 @@ function getCourseInfo(row) { profinit = ""; } profurl = document.URL; - console.log(profurl); + // console.log(profurl); } getDescription(); department = coursename.substring(0, coursename.search(/\d/) - 2); @@ -491,8 +491,8 @@ function prettifyName() { /*Get the course description from the profurl and highlight the important elements, as well as set the eCIS, and rmp links.*/ function getDescription() { - console.log(window.location.href); - console.log(profurl); + // console.log(window.location.href); + // console.log(profurl); chrome.runtime.sendMessage({ method: "GET", action: "xhttp", diff --git a/js/popup.js b/js/popup.js index 89eb42d1..6a9ebb8e 100644 --- a/js/popup.js +++ b/js/popup.js @@ -89,24 +89,26 @@ $(document).ready(function () { window.open(courses[$(this).closest("li").attr("id")].link); }); let status = courses[$(this).closest("li").attr("id")].status; - - if (status.includes("closed") || status.includes("cancelled")|| !status) { - $(this).find("#register").text("Can't Register").css("background-color","#FF5722"); - } - else { - if(status.includes("waitlisted")){ + let registerlink = courses[$(this).closest("li").attr("id")].registerlink; + if (status.includes("closed") || status.includes("cancelled") || !status || !registerlink) { + $(this).find("#register").text("Can't Register").css("background-color", "#FF5722"); + } else { + if (status.includes("waitlisted")) { $(this).find("#register").text("Join Waitlist").css("background-color", "#FF9800"); - } - else { + } else { $(this).find("#register").text("Register").css("background-color", "#4CAF50"); } - $(this).find("#register").click(function (){ - let registerlink = courses[$(this).closest("li").attr("id")].registerlink; - chrome.tabs.query({currentWindow: true, active: true}, function (tab) { - chrome.tabs.update(tab.id, {url: registerlink}); + $(this).find("#register").click(function () { + chrome.tabs.query({ + currentWindow: true, + active: true + }, function (tab) { + chrome.tabs.update(tab.id, { + url: registerlink + }); }); }) - } + } /* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/ $(this).find("#listRemove").click(function () { var thisForm = this; @@ -135,11 +137,11 @@ $(document).ready(function () { /* Show the times popout and more info options*/ if ($(this).find("#moreInfo").is(":hidden")) { $(this).find("#moreInfo").fadeIn(200); - $(this).find('#arrow').css('transform','rotate(90deg)'); + $(this).find('#arrow').css('transform', 'rotate(90deg)'); } else { $(this).find("#moreInfo").fadeOut(200); - $(this).find('#arrow').css('transform',''); + $(this).find('#arrow').css('transform', ''); } }); @@ -183,10 +185,9 @@ function makeLine(index) { var timearr = Array.from(dtmap.keys()); var dayarr = Array.from(dtmap.values()); - if(timearr.length == 0){ - output="This class has no meeting times." - } - else { + if (timearr.length == 0) { + output = "This class has no meeting times." + } else { for (var i = 0; i < dayarr.length; i++) { var place = findLoc(dayarr[i], timearr[i], datetimearr); var building = place.substring(0, place.search(/\d/) - 1); @@ -204,8 +205,8 @@ function makeLine(index) { function findLoc(day, timearr, datetimearr) { for (let i = 0; i < datetimearr.length; i++) { var dtl = datetimearr[i]; - console.log(dtl[1]); - console.log(timearr); + // console.log(dtl[1]); + // console.log(timearr); if (day.includes(dtl[0])) { if (JSON.stringify(timearr) == JSON.stringify(fixDtl1(dtl[1]))) { return dtl[2];