Minor bugfixes

This commit is contained in:
10001shh
2018-10-04 00:21:28 -05:00
parent 60f515ee67
commit dc19a92a45
3 changed files with 31 additions and 30 deletions

View File

@@ -164,7 +164,7 @@ $(function () {
function makeMap(datetimearr) { function makeMap(datetimearr) {
var dtmap = new Map([]); var dtmap = new Map([]);
for (var i = 0; i < datetimearr.length; i++) { 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][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"); 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 //create the event object for every section
function setEventForSection(session, colorCounter, i) { function setEventForSection(session, colorCounter, i) {
console.log(moment().startOf('month').format("YYYY-MM-D")); // console.log(moment().startOf('month').format("YYYY-MM-D"));
console.log(moment().day(fullday)); // console.log(moment().day(fullday));
var fullday = days.get(session[0]); var fullday = days.get(session[0]);
var classInfo = savedCourses[i]; var classInfo = savedCourses[i];
var department = classInfo.coursename.substring(0, classInfo.coursename.search(/\d/) - 2); var department = classInfo.coursename.substring(0, classInfo.coursename.search(/\d/) - 2);
@@ -277,7 +277,7 @@ $(function () {
chrome.storage.sync.get("savedCourses", function (data) { chrome.storage.sync.get("savedCourses", function (data) {
savedCourses = data.savedCourses savedCourses = data.savedCourses
setAllEvents(data.savedCourses); setAllEvents(data.savedCourses);
console.log(classSchedules); // console.log(classSchedules);
$('#calendar').fullCalendar('removeEventSources'); $('#calendar').fullCalendar('removeEventSources');
$("#calendar").fullCalendar('addEventSource', classSchedules, true); $("#calendar").fullCalendar('addEventSource', classSchedules, true);
}); });

View File

@@ -89,7 +89,7 @@ $(function () {
chrome.runtime.onMessage.addListener( chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) { function (request, sender, sendResponse) {
if (request.command == "updateCourseList") { if (request.command == "updateCourseList") {
console.log("hello"); // console.log("hello");
update(); update();
} }
}); });
@@ -193,7 +193,7 @@ function getCourseInfo(row) {
if ($(this).is(row)) { if ($(this).is(row)) {
profurl = $(this).find('td[data-th="Unique"] a').prop('href'); profurl = $(this).find('td[data-th="Unique"] a').prop('href');
registerlink = $(this).find('td[data-th="Add"] 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(); uniquenum = $(this).find('td[data-th="Unique"]').text();
status = $(this).find('td[data-th="Status"]').text(); status = $(this).find('td[data-th="Status"]').text();
profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0]; profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0];
@@ -222,7 +222,7 @@ function getCourseInfo(row) {
profinit = ""; profinit = "";
} }
profurl = document.URL; profurl = document.URL;
console.log(profurl); // console.log(profurl);
} }
getDescription(); getDescription();
department = coursename.substring(0, coursename.search(/\d/) - 2); 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.*/ /*Get the course description from the profurl and highlight the important elements, as well as set the eCIS, and rmp links.*/
function getDescription() { function getDescription() {
console.log(window.location.href); // console.log(window.location.href);
console.log(profurl); // console.log(profurl);
chrome.runtime.sendMessage({ chrome.runtime.sendMessage({
method: "GET", method: "GET",
action: "xhttp", action: "xhttp",

View File

@@ -89,24 +89,26 @@ $(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;
let registerlink = courses[$(this).closest("li").attr("id")].registerlink;
if (status.includes("closed") || status.includes("cancelled")|| !status) { if (status.includes("closed") || status.includes("cancelled") || !status || !registerlink) {
$(this).find("#register").text("Can't Register").css("background-color","#FF5722"); $(this).find("#register").text("Can't Register").css("background-color", "#FF5722");
} } else {
else { if (status.includes("waitlisted")) {
if(status.includes("waitlisted")){
$(this).find("#register").text("Join Waitlist").css("background-color", "#FF9800"); $(this).find("#register").text("Join Waitlist").css("background-color", "#FF9800");
} } else {
else {
$(this).find("#register").text("Register").css("background-color", "#4CAF50"); $(this).find("#register").text("Register").css("background-color", "#4CAF50");
} }
$(this).find("#register").click(function (){ $(this).find("#register").click(function () {
let registerlink = courses[$(this).closest("li").attr("id")].registerlink; chrome.tabs.query({
chrome.tabs.query({currentWindow: true, active: true}, function (tab) { currentWindow: true,
chrome.tabs.update(tab.id, {url: registerlink}); active: true
}, function (tab) {
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;
@@ -135,11 +137,11 @@ $(document).ready(function () {
/* Show the times popout and more info options*/ /* Show the times popout and more info options*/
if ($(this).find("#moreInfo").is(":hidden")) { if ($(this).find("#moreInfo").is(":hidden")) {
$(this).find("#moreInfo").fadeIn(200); $(this).find("#moreInfo").fadeIn(200);
$(this).find('#arrow').css('transform','rotate(90deg)'); $(this).find('#arrow').css('transform', 'rotate(90deg)');
} else { } else {
$(this).find("#moreInfo").fadeOut(200); $(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 timearr = Array.from(dtmap.keys());
var dayarr = Array.from(dtmap.values()); var dayarr = Array.from(dtmap.values());
if(timearr.length == 0){ if (timearr.length == 0) {
output="<span style='font-size:medium;'>This class has no meeting times.</span>" output = "<span style='font-size:medium;'>This class has no meeting times.</span>"
} } else {
else {
for (var i = 0; i < dayarr.length; i++) { for (var i = 0; i < dayarr.length; i++) {
var place = findLoc(dayarr[i], timearr[i], datetimearr); var place = findLoc(dayarr[i], timearr[i], datetimearr);
var building = place.substring(0, place.search(/\d/) - 1); var building = place.substring(0, place.search(/\d/) - 1);
@@ -204,8 +205,8 @@ function makeLine(index) {
function findLoc(day, timearr, datetimearr) { function findLoc(day, timearr, datetimearr) {
for (let i = 0; i < datetimearr.length; i++) { for (let i = 0; i < datetimearr.length; i++) {
var dtl = datetimearr[i]; var dtl = datetimearr[i];
console.log(dtl[1]); // console.log(dtl[1]);
console.log(timearr); // console.log(timearr);
if (day.includes(dtl[0])) { if (day.includes(dtl[0])) {
if (JSON.stringify(timearr) == JSON.stringify(fixDtl1(dtl[1]))) { if (JSON.stringify(timearr) == JSON.stringify(fixDtl1(dtl[1]))) {
return dtl[2]; return dtl[2];