diff --git a/background.js b/background.js
index 082ad879..015b8d35 100644
--- a/background.js
+++ b/background.js
@@ -1,24 +1,19 @@
chrome.runtime.onMessage.addListener(function(request, sender, response) {
-
-chrome.runtime.onMessage.addListener(
-function (request, sender, sendResponse) {
- console.log(sender.tab ?
- "from a content script:" + sender.tab.url :
- "from the extension");
- if (request.greeting == "hello")
- sendResponse({ farewell: "goodbye" });
-});
- const xhr = new XMLHttpRequest();
- const method = request.method ? request.method.toUpperCase() : "GET";
- xhr.open(method, request.url, true);
- xhr.onload = () => response(xhr.responseText);
- xhr.onerror = () => response(xhr.statusText);
- if (method == "POST") {
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- }
- xhr.send(request.data);
- return true;
+ const xhr = new XMLHttpRequest();
+ const method = request.method ? request.method.toUpperCase() : "GET";
+ xhr.open(method, request.url, true);
+ xhr.onload = () => response(xhr.responseText);
+ xhr.onerror = () => response(xhr.statusText);
+ if (method == "POST") {
+ xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+ xhr.send(request.data);
+ return true;
});
-
+chrome.runtime.onInstalled.addListener(function() {
+ chrome.storage.sync.set({color: '#3aa757'}, function() {
+ console.log("The color is green.");
+ });
+});
diff --git a/content.js b/content.js
index 2c6a3356..aef6cc42 100644
--- a/content.js
+++ b/content.js
@@ -11,7 +11,7 @@ var description;
$(document).ready( function() {
loadDataBase();
//make heading
- $("table thead th:nth-child(8)").after('
×Computer Fluency (C S 302)
with Bruce Porter
'
$("#container").prepend(modhtml);
//console.log(grades);
@@ -21,7 +21,8 @@ $(document).ready( function() {
} else if($(this).has('th').length == 0){
var rating;
- var profname = $(this).find('td').eq(4).text() + "";
+ var profname = $(this).find('td[data-th="Instructor"]').text() + "";
+ console.log(profname);
if(profname == ""){
//console.log("No Professor");
rating = "No Prof :(";
@@ -32,15 +33,17 @@ $(document).ready( function() {
$(this).append('
| ');
}
});
- $(this).find(".distButton").click(function(){
- //var coursename = $(this).closest(':has(.course_header)').find('.course_header');
- //CLEAN UP, "gack"- Michael Scott
+ $(".distButton").click(function(){
var row = $(this).closest('tr');
getCourseInfo(row);
- //console.log(profname + " "+department+" "+course_nbr);
- //console.log(coursename);
getDistribution();
});
+ $("#saveCourse").click(function(){
+
+ });
+ $("#rateMyProf").click(function(){
+ window.open(rmpLink);
+ });
});
@@ -50,9 +53,11 @@ function getCourseInfo(row){
coursename = $(this).find('td').text() + "";
}
if($(this).is(row)){
- profurl = $(this).find('td a').prop('href');
- profname = $(this).find('td').eq(4).text().split(', ')[0];
- profinit = $(this).find('td').eq(4).text().split(',')[1];
+ profurl = $(this).find('td[data-th="Unique"] a').prop('href');
+ profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0];
+ profinit = $(this).find('td[data-th="Instructor"]').text().split(',')[1];
+ //COME BACK AND FINISH
+ console.log($(this).find('td[data-th="Days"] >span').text());
return false;
}
});
@@ -101,12 +106,6 @@ function openDialog(dep,cls,sem,professor,res){
span.onclick = function() {
modal.style.display = "none";
}
- $("#saveCourse").click(function(){
-
- });
- $("#rateMyProf").click(function(){
- window.open(rmpLink);
- });
chart = Highcharts.chart('chart', {
chart: {
type: 'column',
@@ -212,7 +211,7 @@ function getDescription(){
$(".description").animate({'opacity': 0}, 400, function(){
$(this).html(description).animate({'opacity': 1}, 300);
});
- var first = object.find('td').eq(4).text();
+ 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";
diff --git a/icons/icon128.png b/icons/icon128.png
new file mode 100644
index 00000000..2596067a
Binary files /dev/null and b/icons/icon128.png differ
diff --git a/icons/icon16.png b/icons/icon16.png
new file mode 100644
index 00000000..b81e4475
Binary files /dev/null and b/icons/icon16.png differ
diff --git a/icons/icon32.png b/icons/icon32.png
new file mode 100644
index 00000000..ba29380e
Binary files /dev/null and b/icons/icon32.png differ
diff --git a/icons/icon48.png b/icons/icon48.png
new file mode 100644
index 00000000..fcd2e098
Binary files /dev/null and b/icons/icon48.png differ
diff --git a/manifest.json b/manifest.json
index 761469c6..112bdb70 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,14 +1,16 @@
{
"manifest_version": 2,
-
+
"name": "UT Course Extension",
"version": "0.1.0",
"description": "Chrome Extension to show more information on the UT Course catalog",
"permissions": [
+ "declarativeContent",
+ "storage",
"*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*",
- "*://*.ratemyprofessors.com/*",
- "*://*.catalog.utexas.edu/ribbit/"
- ],
+ "*://*.ratemyprofessors.com/*",
+ "*://*.catalog.utexas.edu/ribbit/"
+ ],
"content_scripts": [{
"css": ["styles.css"],
"js": ["sql-memory-growth.js","highcharts.js","jquery-3.3.1.min.js","content.js"],
@@ -16,9 +18,23 @@
}],
"web_accessible_resources": [
"grades.db","disticon.png"],
- "background": {
+ "background": {
"scripts": ["background.js"],
"persistent": true
-
+ },
+ "browser_action": {
+ "default_popup": "popup.html",
+ "default_icon": {
+ "16": "icons/icon16.png",
+ "32": "icons/icon32.png",
+ "48": "icons/icon48.png",
+ "128": "icons/icon128.png"
+ }
+ },
+ "icons": {
+ "16": "icons/icon16.png",
+ "32": "icons/icon32.png",
+ "48": "icons/icon48.png",
+ "128": "icons/icon128.png"
}
}
\ No newline at end of file
diff --git a/popup.html b/popup.html
new file mode 100644
index 00000000..0ce1cc05
--- /dev/null
+++ b/popup.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file