cleaned up some code
This commit is contained in:
@@ -1,13 +1,4 @@
|
|||||||
chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
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 xhr = new XMLHttpRequest();
|
||||||
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);
|
||||||
@@ -20,5 +11,9 @@ function (request, sender, sendResponse) {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
chrome.runtime.onInstalled.addListener(function() {
|
||||||
|
chrome.storage.sync.set({color: '#3aa757'}, function() {
|
||||||
|
console.log("The color is green.");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|||||||
33
content.js
33
content.js
@@ -11,7 +11,7 @@ var description;
|
|||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
loadDataBase();
|
loadDataBase();
|
||||||
//make heading
|
//make heading
|
||||||
$("table thead th:nth-child(8)").after('<th scope=col>Dist</th>');
|
$("table thead th:nth-child(9)").after('<th scope=col>Dist</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>Computer Fluency (C S 302)</h2><h2 class=profname>with Bruce Porter</h2><div class=topbuttons><button class=matbut id="rateMyProf"> RMP </button><button class=matbut id="eCIS"> eCIS </button><button class=matbut id="saveCourse"> Save Course </button></div></div></div><div class=card><div class=cardcontainer><h2 class=description></h2></div></div><div class=card><div class=cardcontainer><div id=chart></div></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>Computer Fluency (C S 302)</h2><h2 class=profname>with Bruce Porter</h2><div class=topbuttons><button class=matbut id="rateMyProf"> RMP </button><button class=matbut id="eCIS"> eCIS </button><button class=matbut id="saveCourse"> Save Course </button></div></div></div><div class=card><div class=cardcontainer><h2 class=description></h2></div></div><div class=card><div class=cardcontainer><div id=chart></div></div></div></div>'
|
||||||
$("#container").prepend(modhtml);
|
$("#container").prepend(modhtml);
|
||||||
//console.log(grades);
|
//console.log(grades);
|
||||||
@@ -21,7 +21,8 @@ $(document).ready( function() {
|
|||||||
|
|
||||||
} else if($(this).has('th').length == 0){
|
} else if($(this).has('th').length == 0){
|
||||||
var rating;
|
var rating;
|
||||||
var profname = $(this).find('td').eq(4).text() + "";
|
var profname = $(this).find('td[data-th="Instructor"]').text() + "";
|
||||||
|
console.log(profname);
|
||||||
if(profname == ""){
|
if(profname == ""){
|
||||||
//console.log("No Professor");
|
//console.log("No Professor");
|
||||||
rating = "No Prof :(";
|
rating = "No Prof :(";
|
||||||
@@ -32,15 +33,17 @@ $(document).ready( function() {
|
|||||||
$(this).append('<td data-th="Dist"><input type="image" class="distButton" style="vertical-align: bottom;" width="30" height="30" src='+chrome.extension.getURL('disticon.png')+' /></td>');
|
$(this).append('<td data-th="Dist"><input type="image" class="distButton" style="vertical-align: bottom;" width="30" height="30" src='+chrome.extension.getURL('disticon.png')+' /></td>');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(this).find(".distButton").click(function(){
|
$(".distButton").click(function(){
|
||||||
//var coursename = $(this).closest(':has(.course_header)').find('.course_header');
|
|
||||||
//CLEAN UP, "gack"- Michael Scott
|
|
||||||
var row = $(this).closest('tr');
|
var row = $(this).closest('tr');
|
||||||
getCourseInfo(row);
|
getCourseInfo(row);
|
||||||
//console.log(profname + " "+department+" "+course_nbr);
|
|
||||||
//console.log(coursename);
|
|
||||||
getDistribution();
|
getDistribution();
|
||||||
});
|
});
|
||||||
|
$("#saveCourse").click(function(){
|
||||||
|
|
||||||
|
});
|
||||||
|
$("#rateMyProf").click(function(){
|
||||||
|
window.open(rmpLink);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -50,9 +53,11 @@ function getCourseInfo(row){
|
|||||||
coursename = $(this).find('td').text() + "";
|
coursename = $(this).find('td').text() + "";
|
||||||
}
|
}
|
||||||
if($(this).is(row)){
|
if($(this).is(row)){
|
||||||
profurl = $(this).find('td a').prop('href');
|
profurl = $(this).find('td[data-th="Unique"] a').prop('href');
|
||||||
profname = $(this).find('td').eq(4).text().split(', ')[0];
|
profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0];
|
||||||
profinit = $(this).find('td').eq(4).text().split(',')[1];
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -101,12 +106,6 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
span.onclick = function() {
|
span.onclick = function() {
|
||||||
modal.style.display = "none";
|
modal.style.display = "none";
|
||||||
}
|
}
|
||||||
$("#saveCourse").click(function(){
|
|
||||||
|
|
||||||
});
|
|
||||||
$("#rateMyProf").click(function(){
|
|
||||||
window.open(rmpLink);
|
|
||||||
});
|
|
||||||
chart = Highcharts.chart('chart', {
|
chart = Highcharts.chart('chart', {
|
||||||
chart: {
|
chart: {
|
||||||
type: 'column',
|
type: 'column',
|
||||||
@@ -212,7 +211,7 @@ function getDescription(){
|
|||||||
$(".description").animate({'opacity': 0}, 400, function(){
|
$(".description").animate({'opacity': 0}, 400, function(){
|
||||||
$(this).html(description).animate({'opacity': 1}, 300);
|
$(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(first.indexOf(", "),first.indexOf(" ",first.indexOf(", ")+2));
|
||||||
first = first.substring(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";
|
rmpLink = "http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university+of+texas+at+austin&queryoption=HEADER&query="+first+" "+profname+";&facetSearch=true";
|
||||||
|
|||||||
BIN
icons/icon128.png
Normal file
BIN
icons/icon128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
icons/icon16.png
Normal file
BIN
icons/icon16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
icons/icon32.png
Normal file
BIN
icons/icon32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
BIN
icons/icon48.png
Normal file
BIN
icons/icon48.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
@@ -5,6 +5,8 @@
|
|||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Chrome Extension to show more information on the UT Course catalog",
|
"description": "Chrome Extension to show more information on the UT Course catalog",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
|
"declarativeContent",
|
||||||
|
"storage",
|
||||||
"*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*",
|
"*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*",
|
||||||
"*://*.ratemyprofessors.com/*",
|
"*://*.ratemyprofessors.com/*",
|
||||||
"*://*.catalog.utexas.edu/ribbit/"
|
"*://*.catalog.utexas.edu/ribbit/"
|
||||||
@@ -19,6 +21,20 @@
|
|||||||
"background": {
|
"background": {
|
||||||
"scripts": ["background.js"],
|
"scripts": ["background.js"],
|
||||||
"persistent": true
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
popup.html
Normal file
15
popup.html
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
button {
|
||||||
|
height: 30px;
|
||||||
|
width: 30px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<button id="changeColor"></button>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user