refactored database loading and querying to background script
This commit is contained in:
105
js/background.js
105
js/background.js
@@ -1,6 +1,8 @@
|
|||||||
updateBadge(true);
|
updateBadge(true);
|
||||||
|
var grades;
|
||||||
|
loadDataBase()
|
||||||
/* Handle messages and their commands from content and popup scripts*/
|
/* Handle messages and their commands from content and popup scripts*/
|
||||||
chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
||||||
switch (request.command) {
|
switch (request.command) {
|
||||||
case "courseStorage":
|
case "courseStorage":
|
||||||
if (request.action == "add") {
|
if (request.action == "add") {
|
||||||
@@ -31,6 +33,8 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
|||||||
case "updateCourseList":
|
case "updateCourseList":
|
||||||
updateTabs();
|
updateTabs();
|
||||||
break;
|
break;
|
||||||
|
case "gradesQuery":
|
||||||
|
executeQuery(request.query, response);
|
||||||
default:
|
default:
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const method = request.method ? request.method.toUpperCase() : "GET";
|
const method = request.method ? request.method.toUpperCase() : "GET";
|
||||||
@@ -51,35 +55,35 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/* Initially set the course data in storage */
|
/* Initially set the course data in storage */
|
||||||
chrome.runtime.onInstalled.addListener(function(details) {
|
chrome.runtime.onInstalled.addListener(function (details) {
|
||||||
if (details.reason == "install") {
|
if (details.reason == "install") {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
if (!data.savedCourses) {
|
if (!data.savedCourses) {
|
||||||
var arr = new Array();
|
var arr = new Array();
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
savedCourses: arr
|
savedCourses: arr
|
||||||
}, function() {
|
}, function () {
|
||||||
console.log('initial course list');
|
console.log('initial course list');
|
||||||
});
|
});
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
courseConflictHighlight: true
|
courseConflictHighlight: true
|
||||||
}, function() {
|
}, function () {
|
||||||
console.log('initial highlighting: true');
|
console.log('initial highlighting: true');
|
||||||
});
|
});
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
loadAll: true
|
loadAll: true
|
||||||
}, function() {
|
}, function () {
|
||||||
console.log('initial loadAll: true');
|
console.log('initial loadAll: true');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (details.reason == "update") {
|
} else if (details.reason == "update") {
|
||||||
console.log("updated");
|
console.log("updated");
|
||||||
chrome.storage.sync.get('loadAll', function(data) {
|
chrome.storage.sync.get('loadAll', function (data) {
|
||||||
if (data.loadAll == undefined) {
|
if (data.loadAll == undefined) {
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
loadAll: true
|
loadAll: true
|
||||||
}, function() {
|
}, function () {
|
||||||
console.log('initial loadAll: true');
|
console.log('initial loadAll: true');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -88,8 +92,39 @@ chrome.runtime.onInstalled.addListener(function(details) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function executeQuery(query, sendResponse) {
|
||||||
|
console.log(grades)
|
||||||
|
var res = grades.exec(query)[0];
|
||||||
|
sendResponse({
|
||||||
|
data: res,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Load the database*/
|
||||||
|
function loadDataBase() {
|
||||||
|
sql = window.SQL;
|
||||||
|
loadBinaryFile('grades.db', function (data) {
|
||||||
|
var sqldb = new SQL.Database(data);
|
||||||
|
grades = sqldb;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/* load the database from file */
|
||||||
|
function loadBinaryFile(path, success) {
|
||||||
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open("GET", chrome.extension.getURL(path), true);
|
||||||
|
xhr.responseType = "arraybuffer";
|
||||||
|
xhr.onload = function () {
|
||||||
|
var data = new Uint8Array(xhr.response);
|
||||||
|
var arr = new Array();
|
||||||
|
for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
|
||||||
|
success(arr.join(""));
|
||||||
|
};
|
||||||
|
xhr.send();
|
||||||
|
};
|
||||||
|
|
||||||
function updateBadge(first) {
|
function updateBadge(first) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
if (data.savedCourses) {
|
if (data.savedCourses) {
|
||||||
let text = "";
|
let text = "";
|
||||||
if (data.savedCourses.length > 0) {
|
if (data.savedCourses.length > 0) {
|
||||||
@@ -105,7 +140,7 @@ function updateBadge(first) {
|
|||||||
});
|
});
|
||||||
timeout = 200;
|
timeout = 200;
|
||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
chrome.browserAction.setBadgeBackgroundColor({
|
chrome.browserAction.setBadgeBackgroundColor({
|
||||||
color: '#bf5700'
|
color: '#bf5700'
|
||||||
});
|
});
|
||||||
@@ -117,7 +152,7 @@ function updateBadge(first) {
|
|||||||
|
|
||||||
/* Find all the conflicts in the courses and send them out/ if there is even a conflict*/
|
/* Find all the conflicts in the courses and send them out/ if there is even a conflict*/
|
||||||
function checkConflicts(sendResponse) {
|
function checkConflicts(sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var conflicts = [];
|
var conflicts = [];
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
for (var i = 0; i < courses.length; i++) {
|
for (var i = 0; i < courses.length; i++) {
|
||||||
@@ -144,7 +179,7 @@ function checkConflicts(sendResponse) {
|
|||||||
|
|
||||||
/* Find if the course at unique and with currdatearr is contained in the saved courses and if it conflicts with any other courses*/
|
/* Find if the course at unique and with currdatearr is contained in the saved courses and if it conflicts with any other courses*/
|
||||||
function isSingleConflict(currdatearr, unique, sendResponse) {
|
function isSingleConflict(currdatearr, unique, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
var conflict = false;
|
var conflict = false;
|
||||||
for (var i = 0; i < courses.length; i++) {
|
for (var i = 0; i < courses.length; i++) {
|
||||||
@@ -188,7 +223,7 @@ function isConflict(adtarr, bdtarr) {
|
|||||||
|
|
||||||
/* Add the requested course to the storage*/
|
/* Add the requested course to the storage*/
|
||||||
function add(request, sender, sendResponse) {
|
function add(request, sender, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
if (!contains(courses, request.course.unique)) {
|
if (!contains(courses, request.course.unique)) {
|
||||||
courses.push(request.course)
|
courses.push(request.course)
|
||||||
@@ -206,7 +241,7 @@ function add(request, sender, sendResponse) {
|
|||||||
}
|
}
|
||||||
/* Find and Remove the requested course from the storage*/
|
/* Find and Remove the requested course from the storage*/
|
||||||
function remove(request, sender, sendResponse) {
|
function remove(request, sender, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
console.log(courses);
|
console.log(courses);
|
||||||
var index = 0;
|
var index = 0;
|
||||||
@@ -227,7 +262,7 @@ function remove(request, sender, sendResponse) {
|
|||||||
|
|
||||||
/* Find if the unique is already contained within the storage*/
|
/* Find if the unique is already contained within the storage*/
|
||||||
function alreadyContains(unique, sendResponse) {
|
function alreadyContains(unique, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
sendResponse({
|
sendResponse({
|
||||||
alreadyContains: contains(courses, unique)
|
alreadyContains: contains(courses, unique)
|
||||||
@@ -247,7 +282,7 @@ function contains(courses, unique) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateTabs() {
|
function updateTabs() {
|
||||||
chrome.tabs.query({}, function(tabs) {
|
chrome.tabs.query({}, function (tabs) {
|
||||||
for (var i = 0; i < tabs.length; i++) {
|
for (var i = 0; i < tabs.length; i++) {
|
||||||
chrome.tabs.sendMessage(tabs[i].id, {
|
chrome.tabs.sendMessage(tabs[i].id, {
|
||||||
command: "updateCourseList"
|
command: "updateCourseList"
|
||||||
@@ -260,7 +295,7 @@ const UPDATE_INTERVAL = 1000 * 60 * 16;
|
|||||||
setInterval(updateStatus, UPDATE_INTERVAL);
|
setInterval(updateStatus, UPDATE_INTERVAL);
|
||||||
// updateStatus();
|
// 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;
|
||||||
var nochange = true;
|
var nochange = true;
|
||||||
for (let i = 0; i < courses.length; i++) {
|
for (let i = 0; i < courses.length; i++) {
|
||||||
@@ -268,23 +303,27 @@ function updateStatus(sendResponse) {
|
|||||||
let c = courses[i];
|
let c = courses[i];
|
||||||
let oldstatus = c.status;
|
let oldstatus = c.status;
|
||||||
let oldlink = c.link;
|
let oldlink = c.link;
|
||||||
$.ajax({url: oldlink, success: function(result){
|
$.ajax({
|
||||||
if(result){
|
url: oldlink,
|
||||||
console.log(result);
|
success: function (result) {
|
||||||
var object = $('<div/>').html(result).contents();
|
if (result) {
|
||||||
let newstatus = object.find('[data-th="Status"]').text();
|
console.log(result);
|
||||||
let registerlink = object.find('td[data-th="Add"] a');
|
var object = $('<div/>').html(result).contents();
|
||||||
if (registerlink) {
|
let newstatus = object.find('[data-th="Status"]').text();
|
||||||
registerlink = registerlink.attr('href');
|
let registerlink = object.find('td[data-th="Add"] a');
|
||||||
|
if (registerlink) {
|
||||||
|
registerlink = registerlink.attr('href');
|
||||||
|
}
|
||||||
|
var haschanged = (newstatus == oldstatus && registerlink == oldlink);
|
||||||
|
if (!haschanged) {
|
||||||
|
console.log(c.unique + ' updated from ' + oldstatus + " to " + newstatus + " and " + oldlink + " to " + registerlink);
|
||||||
|
}
|
||||||
|
nochange &= haschanged;
|
||||||
|
c.registerlink = registerlink;
|
||||||
|
c.status = newstatus;
|
||||||
}
|
}
|
||||||
var haschanged = (newstatus == oldstatus && registerlink == oldlink);
|
}
|
||||||
if (!haschanged) {
|
});
|
||||||
console.log(c.unique + ' updated from ' + oldstatus + " to " + newstatus + " and " + oldlink + " to " + registerlink);
|
|
||||||
}
|
|
||||||
nochange &= haschanged;
|
|
||||||
c.registerlink = registerlink;
|
|
||||||
c.status = newstatus;
|
|
||||||
}}});
|
|
||||||
|
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
163
js/content.js
163
js/content.js
@@ -34,9 +34,6 @@ const butdelay = 75;
|
|||||||
|
|
||||||
console.log('UT Registration Plus is running on this page.');
|
console.log('UT Registration Plus is running on this page.');
|
||||||
|
|
||||||
|
|
||||||
var utplanner = false;
|
|
||||||
|
|
||||||
if (document.querySelector('#fos_fl')) {
|
if (document.querySelector('#fos_fl')) {
|
||||||
let params = (new URL(document.location)).searchParams;
|
let params = (new URL(document.location)).searchParams;
|
||||||
let dep = params.get("fos_fl");
|
let dep = params.get("fos_fl");
|
||||||
@@ -51,25 +48,14 @@ if (document.querySelector('#fos_fl')) {
|
|||||||
|
|
||||||
|
|
||||||
next = $("#next_nav_link");
|
next = $("#next_nav_link");
|
||||||
if(next){
|
if (next) {
|
||||||
chrome.storage.sync.get('loadAll', function (data) {
|
chrome.storage.sync.get('loadAll', function (data) {
|
||||||
if (data.loadAll) {
|
if (data.loadAll) {
|
||||||
$('[title*="next listing"]').remove();
|
$('[title*="next listing"]').remove();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if($('html').hasClass('gr__utexas_collegescheduler_com')){
|
|
||||||
utplanner = true;
|
|
||||||
$.initialize("table.section-detail-grid", function() {
|
|
||||||
$(this).find('thead>tr').append('<th> Plus</th')
|
|
||||||
$(this).find('tbody>tr').each(function(){
|
|
||||||
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
loadDataBase();
|
|
||||||
//make heading and modal
|
//make heading and modal
|
||||||
if (!$("#kw_results_table").length) {
|
if (!$("#kw_results_table").length) {
|
||||||
$("table thead th:last-child").after('<th scope=col>Plus</th>');
|
$("table thead th:last-child").after('<th scope=col>Plus</th>');
|
||||||
@@ -470,27 +456,30 @@ function getDistribution(sem) {
|
|||||||
query += "and sem like '%" + sem + "%'";
|
query += "and sem like '%" + sem + "%'";
|
||||||
}
|
}
|
||||||
query += "order by a1+a2+a3+b1+b2+b3+c1+c2+c3+d1+d2+d3+f desc";
|
query += "order by a1+a2+a3+b1+b2+b3+c1+c2+c3+d1+d2+d3+f desc";
|
||||||
var res = grades.exec(query)[0];
|
alert(query)
|
||||||
var output = "";
|
chrome.runtime.sendMessage({
|
||||||
if (!sem) {
|
command: "gradesQuery",
|
||||||
openDialog(department, coursename, "aggregate", profname, res);
|
query: query
|
||||||
} else {
|
}, function (response) {
|
||||||
var data;
|
var res = response.data;
|
||||||
if (typeof res == 'undefined' || profname == "") {
|
if (!sem) {
|
||||||
data = [];
|
openDialog(department, coursename, "aggregate", profname, res);
|
||||||
} else {
|
} else {
|
||||||
data = res.values[0];
|
var data;
|
||||||
|
if (typeof res == 'undefined' || profname == "") {
|
||||||
|
data = [];
|
||||||
|
} else {
|
||||||
|
data = res.values[0];
|
||||||
|
}
|
||||||
|
setChart(data);
|
||||||
}
|
}
|
||||||
setChart(data);
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Open the modal and show all the data*/
|
/*Open the modal and show all the data*/
|
||||||
function openDialog(dep, cls, sem, professor, res) {
|
function openDialog(dep, cls, sem, professor, res) {
|
||||||
$("#myModal").fadeIn(fadetime);
|
$("#myModal").fadeIn(fadetime);
|
||||||
//initial text on the "save course button"
|
//initial text on the "save course button"
|
||||||
|
|
||||||
|
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
command: "alreadyContains",
|
command: "alreadyContains",
|
||||||
unique: uniquenum
|
unique: uniquenum
|
||||||
@@ -734,77 +723,59 @@ function getDescription() {
|
|||||||
// console.log(window.location.href);
|
// console.log(window.location.href);
|
||||||
// console.log(profurl);
|
// console.log(profurl);
|
||||||
console.log('hello');
|
console.log('hello');
|
||||||
$.ajax({url: profurl, success: function(response){
|
$.ajax({
|
||||||
if (response) {
|
url: profurl,
|
||||||
console.log(profurl);
|
success: function (response) {
|
||||||
var output = "";
|
if (response) {
|
||||||
var object = $('<div/>').html(response).contents();
|
console.log(profurl);
|
||||||
object.find('#details > p').each(function () {
|
var output = "";
|
||||||
var sentence = $(this).text();
|
var object = $('<div/>').html(response).contents();
|
||||||
if (sentence.indexOf("Prerequisite") == 0) {
|
object.find('#details > p').each(function () {
|
||||||
sentence = "<li style='font-weight: bold;' class='descriptionli'>" + sentence + "</li>";
|
var sentence = $(this).text();
|
||||||
} else if (sentence.indexOf("May be") >= 0) {
|
if (sentence.indexOf("Prerequisite") == 0) {
|
||||||
sentence = "<li style='font-style: italic;' class='descriptionli'>" + sentence + "</li>";
|
sentence = "<li style='font-weight: bold;' class='descriptionli'>" + sentence + "</li>";
|
||||||
} else if (sentence.indexOf("Restricted to") == 0) {
|
} else if (sentence.indexOf("May be") >= 0) {
|
||||||
sentence = "<li style='color:red;' class='descriptionli'>" + sentence + "</li>";
|
sentence = "<li style='font-style: italic;' class='descriptionli'>" + sentence + "</li>";
|
||||||
} else {
|
} else if (sentence.indexOf("Restricted to") == 0) {
|
||||||
sentence = "<li class='descriptionli'>" + sentence + "</li>";
|
sentence = "<li style='color:red;' class='descriptionli'>" + sentence + "</li>";
|
||||||
|
} else {
|
||||||
|
sentence = "<li class='descriptionli'>" + sentence + "</li>";
|
||||||
|
}
|
||||||
|
output += sentence;
|
||||||
|
});
|
||||||
|
description = output;
|
||||||
|
console.log(response);
|
||||||
|
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").animate({
|
||||||
|
'opacity': 0
|
||||||
|
}, 200, function () {
|
||||||
|
$(this).html(description).animate({
|
||||||
|
'opacity': 1
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
|
var first = object.find('td[data-th="Instructor"]').text();
|
||||||
|
first = first.substring(first.indexOf(", "), first.indexOf(" ", first.indexOf(", ") + 2));
|
||||||
|
first = first.substring(2);
|
||||||
|
rmpLink = `http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university+of+texas+at+austin&queryoption=HEADER&query=${first} ${profname};&facetSearch=true`;
|
||||||
|
if (profname == "") {
|
||||||
|
eCISLink = `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?s_in_action_sw=S&s_in_search_type_sw=C&s_in_max_nbr_return=10&s_in_search_course_dept=${department}&s_in_search_course_num=${course_nbr}`;
|
||||||
|
} else {
|
||||||
|
eCISLink = `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?&s_in_action_sw=S&s_in_search_type_sw=N&s_in_search_name=${profname.substring(0, 1) + profname.substring(1).toLowerCase()}%2C%20${first.substring(0, 1) + first.substring(1).toLowerCase()}`;
|
||||||
}
|
}
|
||||||
output += sentence;
|
|
||||||
});
|
|
||||||
description = output;
|
|
||||||
console.log(response);
|
|
||||||
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").animate({
|
|
||||||
'opacity': 0
|
|
||||||
}, 200, function () {
|
|
||||||
$(this).html(description).animate({
|
|
||||||
'opacity': 1
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
var first = object.find('td[data-th="Instructor"]').text();
|
|
||||||
first = first.substring(first.indexOf(", "), first.indexOf(" ", first.indexOf(", ") + 2));
|
|
||||||
first = first.substring(2);
|
|
||||||
rmpLink = `http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university+of+texas+at+austin&queryoption=HEADER&query=${first} ${profname};&facetSearch=true`;
|
|
||||||
if (profname == "") {
|
|
||||||
eCISLink = `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?s_in_action_sw=S&s_in_search_type_sw=C&s_in_max_nbr_return=10&s_in_search_course_dept=${department}&s_in_search_course_num=${course_nbr}`;
|
|
||||||
} else {
|
} else {
|
||||||
eCISLink = `http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?&s_in_action_sw=S&s_in_search_type_sw=N&s_in_search_name=${profname.substring(0, 1) + profname.substring(1).toLowerCase()}%2C%20${first.substring(0, 1) + first.substring(1).toLowerCase()}`;
|
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").animate({
|
||||||
|
'opacity': 0
|
||||||
|
}, 200, function () {
|
||||||
|
$(this).html(description).animate({
|
||||||
|
'opacity': 1
|
||||||
|
}, 200);
|
||||||
|
});
|
||||||
|
rmpLink = "http://www.ratemyprofessors.com/campusRatings.jsp?sid=1255";
|
||||||
|
eCISLink = "http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
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").animate({
|
|
||||||
'opacity': 0
|
|
||||||
}, 200, function () {
|
|
||||||
$(this).html(description).animate({
|
|
||||||
'opacity': 1
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
rmpLink = "http://www.ratemyprofessors.com/campusRatings.jsp?sid=1255";
|
|
||||||
eCISLink = "http://utdirect.utexas.edu/ctl/ecis/results/index.WBX?";
|
|
||||||
}
|
}
|
||||||
}});
|
|
||||||
}
|
|
||||||
/* Load the database*/
|
|
||||||
function loadDataBase() {
|
|
||||||
sql = window.SQL;
|
|
||||||
loadBinaryFile('grades.db', function (data) {
|
|
||||||
var sqldb = new SQL.Database(data);
|
|
||||||
grades = sqldb;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/* load the database from file */
|
|
||||||
function loadBinaryFile(path, success) {
|
|
||||||
var xhr = new XMLHttpRequest();
|
|
||||||
xhr.open("GET", chrome.extension.getURL(path), true);
|
|
||||||
xhr.responseType = "arraybuffer";
|
|
||||||
xhr.onload = function () {
|
|
||||||
var data = new Uint8Array(xhr.response);
|
|
||||||
var arr = new Array();
|
|
||||||
for (var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
|
|
||||||
success(arr.join(""));
|
|
||||||
};
|
|
||||||
xhr.send();
|
|
||||||
};
|
|
||||||
|
|||||||
9
js/utplanner.js
Normal file
9
js/utplanner.js
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
if ($('html').hasClass('gr__utexas_collegescheduler_com')) {
|
||||||
|
$.initialize("table.section-detail-grid", function () {
|
||||||
|
console.log('hello')
|
||||||
|
$(this).find('thead>tr').append('<th> Plus</th')
|
||||||
|
$(this).find('tbody>tr').each(function () {
|
||||||
|
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -9,15 +9,19 @@
|
|||||||
"declarativeContent",
|
"declarativeContent",
|
||||||
"storage",
|
"storage",
|
||||||
"*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*",
|
"*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*",
|
||||||
"*://*.utexas.collegescheduler.com/terms/*/schedules/*",
|
"*://*.utexas.collegescheduler.com/*",
|
||||||
"*://*.catalog.utexas.edu/ribbit/",
|
"*://*.catalog.utexas.edu/ribbit/",
|
||||||
"*://*.registrar.utexas.edu/schedules/*",
|
"*://*.registrar.utexas.edu/schedules/*",
|
||||||
"*://*.login.utexas.edu/login/*"
|
"*://*.login.utexas.edu/login/*"
|
||||||
],
|
],
|
||||||
"content_scripts": [{
|
"content_scripts": [{
|
||||||
"css": ["css/styles.css"],
|
"css": ["css/styles.css"],
|
||||||
"js": ["js/moment.min.js", "js/sql-memory-growth.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/jquery.initialize.min.js", "js/content.js"],
|
"js": ["js/moment.min.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/jquery.initialize.min.js", "js/content.js"],
|
||||||
"matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*", "https://utexas.collegescheduler.com/terms/*"]
|
"matches": ["https://utdirect.utexas.edu/apps/registrar/course_schedule/*"]
|
||||||
|
}, {
|
||||||
|
"css": ["css/styles.css"],
|
||||||
|
"js": ["js/moment.min.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/jquery.initialize.min.js", "js/utplanner.js"],
|
||||||
|
"matches": ["https://utexas.collegescheduler.com/*"]
|
||||||
}, {
|
}, {
|
||||||
"css": ["css/styles.css"],
|
"css": ["css/styles.css"],
|
||||||
"js": ["js/moment.min.js", "js/sql-memory-growth.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/import.js"],
|
"js": ["js/moment.min.js", "js/sql-memory-growth.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/import.js"],
|
||||||
@@ -27,7 +31,7 @@
|
|||||||
"grades.db", "images/disticon.png"
|
"grades.db", "images/disticon.png"
|
||||||
],
|
],
|
||||||
"background": {
|
"background": {
|
||||||
"scripts": ["js/jquery-3.3.1.min.js", "js/background.js", "js/moment.min.js"],
|
"scripts": ["js/jquery-3.3.1.min.js", "js/sql-memory-growth.js", "js/background.js", "js/moment.min.js"],
|
||||||
"persistent": true
|
"persistent": true
|
||||||
},
|
},
|
||||||
"browser_action": {
|
"browser_action": {
|
||||||
|
|||||||
Reference in New Issue
Block a user