updating status
This commit is contained in:
@@ -11,7 +11,11 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
|||||||
isSingleConflict(request.dtarr, request.unique, response);
|
isSingleConflict(request.dtarr, request.unique, response);
|
||||||
} else if (request.command == "checkConflicts") {
|
} else if (request.command == "checkConflicts") {
|
||||||
checkConflicts(response);
|
checkConflicts(response);
|
||||||
} else if (request.command == "alreadyContains") {
|
}
|
||||||
|
else if(request.command == "updateStatus"){
|
||||||
|
updateStatus();
|
||||||
|
}
|
||||||
|
else if (request.command == "alreadyContains") {
|
||||||
alreadyContains(request.unique, response);
|
alreadyContains(request.unique, response);
|
||||||
} else {
|
} else {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
@@ -168,3 +172,21 @@ function alreadyContains(unique, sendResponse) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateStatus(){
|
||||||
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
|
console.log(data.savedCourses);
|
||||||
|
for(let i = 0; i<data.savedCourses.length; i++){
|
||||||
|
let c = data.savedCourses[i];
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("GET", c.link, false);
|
||||||
|
xhr.send();
|
||||||
|
var result = xhr.responseText;
|
||||||
|
var dummy = document.createElement( 'html' );
|
||||||
|
dummy.innerHTML = result;
|
||||||
|
element = dummy.querySelector('[data-th="Status"]').textContent;
|
||||||
|
console.log(element);
|
||||||
|
// console.log(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -23,13 +23,19 @@ const days = new Map([
|
|||||||
["W", "Wednesday"],
|
["W", "Wednesday"],
|
||||||
["TH", "Thursday"],
|
["TH", "Thursday"],
|
||||||
["F", "Friday"]
|
["F", "Friday"]
|
||||||
]);
|
]);
|
||||||
const fadetime = 150;
|
const fadetime = 150;
|
||||||
const butdelay = 75;
|
const butdelay = 75;
|
||||||
//This extension may be super lit, but you know what's even more lit?
|
//This extension may be super lit, but you know what's even more lit?
|
||||||
//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>';
|
||||||
|
|||||||
@@ -158,8 +158,8 @@ function makeLine(index) {
|
|||||||
//converted times back
|
//converted times back
|
||||||
var dtmap = new Map([]);
|
var dtmap = new Map([]);
|
||||||
for (var i = 0; i < datetimearr.length; i++) {
|
for (var i = 0; i < datetimearr.length; i++) {
|
||||||
datetimearr[i][1][0] = moment(datetimearr[i][1][0], ["HH:mm"]).format("h:mm A");
|
datetimearr[i][1][0] = moment(datetimearr[i][1][0], ["HH:mm"]).format("h:mm a");
|
||||||
datetimearr[i][1][1] = moment(datetimearr[i][1][1], ["HH:mm"]).format("h:mm A");
|
datetimearr[i][1][1] = moment(datetimearr[i][1][1], ["HH:mm"]).format("h:mm a");
|
||||||
}
|
}
|
||||||
for (var i = 0; i < datetimearr.length; i++) {
|
for (var i = 0; i < datetimearr.length; i++) {
|
||||||
if (dtmap.has(String(datetimearr[i][1]))) {
|
if (dtmap.has(String(datetimearr[i][1]))) {
|
||||||
@@ -182,7 +182,7 @@ function makeLine(index) {
|
|||||||
if (building == "") {
|
if (building == "") {
|
||||||
building = "Undecided Location";
|
building = "Undecided Location";
|
||||||
}
|
}
|
||||||
output += `<span style='font-size:large;display:inline-block;width: 20%;'>${dayarr[i]}:</span><span style='margin-left:10px;display:inline-block;width: 45%;'>${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}</span><span style='float:right;display:inline-block;text-align:right;width: 30%;margin-top:3px;'><a target='_blank' style='color:#3c87a3;text-decoration:none;'href='https://maps.utexas.edu/buildings/UTM/${building}'>${place}</a></span><br>`;
|
output += `<span style='font-size:large;display:inline-block;width: 20%;'>${dayarr[i]}:</span><span style='margin-left:10px;display:inline-block;width: 45%;'>${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}</span><span style='float:right;display:inline-block;text-align:right;width: 30%;margin-top:5px;'><a target='_blank' style='color:#3c87a3;text-decoration:none;'href='https://maps.utexas.edu/buildings/UTM/${building}'>${place}</a></span><br>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return output;
|
return output;
|
||||||
|
|||||||
Reference in New Issue
Block a user