fixed description bug
This commit is contained in:
@@ -83,7 +83,9 @@ ul {
|
|||||||
i {
|
i {
|
||||||
padding: 4px 0px;
|
padding: 4px 0px;
|
||||||
}
|
}
|
||||||
|
#header {
|
||||||
|
border-radius: 7px;
|
||||||
|
}
|
||||||
.settings {
|
.settings {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
|
|||||||
@@ -36,7 +36,10 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
|||||||
const method = request.method ? request.method.toUpperCase() : "GET";
|
const method = request.method ? request.method.toUpperCase() : "GET";
|
||||||
xhr.open(method, request.url, true);
|
xhr.open(method, request.url, true);
|
||||||
console.log(request);
|
console.log(request);
|
||||||
xhr.onload = () => response(xhr.responseText);
|
xhr.onload = () => {
|
||||||
|
console.log(xhr.responseUrl);
|
||||||
|
response(xhr.responseText);
|
||||||
|
}
|
||||||
xhr.onerror = () => response(xhr.statusText);
|
xhr.onerror = () => response(xhr.statusText);
|
||||||
if (method == "POST") {
|
if (method == "POST") {
|
||||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||||
@@ -253,9 +256,9 @@ function updateTabs() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const UPDATE_INTERVAL = 1000 * 60 * 16; // 16 mins
|
const UPDATE_INTERVAL = 1000 * 60 * 16;
|
||||||
setInterval(updateStatus, UPDATE_INTERVAL);
|
setInterval(updateStatus, UPDATE_INTERVAL);
|
||||||
|
// updateStatus();
|
||||||
function updateStatus(sendResponse) {
|
function updateStatus(sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
@@ -264,26 +267,28 @@ function updateStatus(sendResponse) {
|
|||||||
try {
|
try {
|
||||||
let c = courses[i];
|
let c = courses[i];
|
||||||
let oldstatus = c.status;
|
let oldstatus = c.status;
|
||||||
let oldlink = c.registerlink;
|
let oldlink = c.link;
|
||||||
var xhr = new XMLHttpRequest();
|
$.ajax({url: oldlink, success: function(result){
|
||||||
xhr.open("GET", c.link, false);
|
if(result){
|
||||||
xhr.send();
|
console.log(result);
|
||||||
let result = xhr.responseText;
|
var object = $('<div/>').html(result).contents();
|
||||||
let dummy = document.createElement('html');
|
let newstatus = object.find('[data-th="Status"]').text();
|
||||||
dummy.innerHTML = result;
|
let registerlink = object.find('td[data-th="Add"] a');
|
||||||
let newstatus = dummy.querySelector('[data-th="Status"]').textContent;
|
if (registerlink) {
|
||||||
let registerlink = dummy.querySelector('td[data-th="Add"] a');
|
registerlink = registerlink.attr('href');
|
||||||
if (registerlink) {
|
}
|
||||||
registerlink = registerlink.getAttribute('href');
|
var haschanged = (newstatus == oldstatus && registerlink == oldlink);
|
||||||
}
|
if (!haschanged) {
|
||||||
var haschanged = (newstatus == oldstatus && registerlink == oldlink);
|
console.log(c.unique + ' updated from ' + oldstatus + " to " + newstatus + " and " + oldlink + " to " + registerlink);
|
||||||
if (!haschanged) {
|
}
|
||||||
console.log(c.unique + 'updated from ' + oldstatus + " to " + newstatus + " and " + oldlink + " to " + registerlink);
|
nochange &= haschanged;
|
||||||
}
|
c.registerlink = registerlink;
|
||||||
nochange &= haschanged;
|
c.status = newstatus;
|
||||||
c.registerlink = registerlink;
|
}}});
|
||||||
c.status = newstatus;
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e);
|
||||||
console.log('Not logged into UT Coursebook. Could not update class statuses.');
|
console.log('Not logged into UT Coursebook. Could not update class statuses.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -716,14 +716,9 @@ function getDescription() {
|
|||||||
// console.log(window.location.href);
|
// console.log(window.location.href);
|
||||||
// console.log(profurl);
|
// console.log(profurl);
|
||||||
console.log('hello');
|
console.log('hello');
|
||||||
chrome.runtime.sendMessage({
|
$.ajax({url: profurl, success: function(response){
|
||||||
method: "GET",
|
if (response) {
|
||||||
action: "xhttp",
|
console.log(profurl);
|
||||||
url: profurl,
|
|
||||||
data: ""
|
|
||||||
}, function (response) {
|
|
||||||
if (response) {
|
|
||||||
// console.log(response);
|
|
||||||
var output = "";
|
var output = "";
|
||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
object.find('#details > p').each(function () {
|
object.find('#details > p').each(function () {
|
||||||
@@ -740,6 +735,7 @@ function getDescription() {
|
|||||||
output += sentence;
|
output += sentence;
|
||||||
});
|
});
|
||||||
description = output;
|
description = output;
|
||||||
|
console.log(response);
|
||||||
if (!description) {
|
if (!description) {
|
||||||
description = "<p style='color:red;font-style:bold'>You have been logged out. Please refresh the page and log back in using your UT EID and password.</p>"
|
description = "<p style='color:red;font-style:bold'>You have been logged out. Please refresh the page and log back in using your UT EID and password.</p>"
|
||||||
}
|
}
|
||||||
@@ -771,7 +767,7 @@ function getDescription() {
|
|||||||
rmpLink = "http://www.ratemyprofessors.com/campusRatings.jsp?sid=1255";
|
rmpLink = "http://www.ratemyprofessors.com/campusRatings.jsp?sid=1255";
|
||||||
eCISLink = "http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?";
|
eCISLink = "http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?";
|
||||||
}
|
}
|
||||||
});
|
}});
|
||||||
}
|
}
|
||||||
/* Load the database*/
|
/* Load the database*/
|
||||||
function loadDataBase() {
|
function loadDataBase() {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "UT Registration Plus",
|
"name": "UT Registration Plus",
|
||||||
"version": "0.2.2.2",
|
"version": "0.2.2.3",
|
||||||
"options_page": "options.html",
|
"options_page": "options.html",
|
||||||
"description": "Improves the course registration process at the University of Texas at Austin!",
|
"description": "Improves the course registration process at the University of Texas at Austin!",
|
||||||
"permissions": ["tabs",
|
"permissions": ["tabs",
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
"grades.db", "images/disticon.png"
|
"grades.db", "images/disticon.png"
|
||||||
],
|
],
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["js/background.js", "js/moment.min.js", "js/jquery-3.3.1.min.js"],
|
"scripts": ["js/jquery-3.3.1.min.js", "js/background.js", "js/moment.min.js"],
|
||||||
"persistent": true
|
"persistent": true
|
||||||
},
|
},
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
<body style="position:relative;">
|
<body style="position:relative;">
|
||||||
<div class="card" id="header">
|
<div class="card" id="header">
|
||||||
<div id="buttons" style="padding: 5px 10px 5px 10px;display: flex;justify-content: space-between;">
|
<div id="buttons" style="padding: 5px 10px 5px 10px;display: flex;justify-content: space-between;">
|
||||||
<button id="clear" class="matbut" style="font-size:15px; background:#4CAF50;margin: 10px;">Clear All</button>
|
<button id="clear" class="matbut" style="font-size:15px; background:#4CAF50;margin: 7px;">Clear All</button>
|
||||||
<button id="schedule" class="matbut" style="font-size:15px;background:#FF9800;margin: 10px;">Course List</button>
|
<button id="schedule" class="matbut" style="font-size:15px;background:#FF9800;margin: 7px;">Course List</button>
|
||||||
<button id="calendar" class="matbut" style="font-size:15px; background: #FF0000; margin:10px;">My Schedule</button>
|
<button id="calendar" class="matbut" style="font-size:15px; background: #FF0000; margin:7px;">My Schedule</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
|
|||||||
Reference in New Issue
Block a user