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) {
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);
});

View File

@@ -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",

View File

@@ -89,21 +89,23 @@ $(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
});
});
})
}
@@ -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="<span style='font-size:medium;'>This class has no meeting times.</span>"
}
else {
if (timearr.length == 0) {
output = "<span style='font-size:medium;'>This class has no meeting times.</span>"
} 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];