updated todo
This commit is contained in:
@@ -7,8 +7,11 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
|||||||
remove(request,sender,response);
|
remove(request,sender,response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(request.command == "checkConflicts"){
|
||||||
|
//Check conflicts
|
||||||
|
}
|
||||||
else if(request.command == "alreadyContains"){
|
else if(request.command == "alreadyContains"){
|
||||||
alreadyContains(request.course,response);
|
alreadyContains(request.unique,response);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
@@ -58,13 +61,13 @@ function remove(request, sender, sendResponse) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function alreadyContains(course,sendResponse){
|
function alreadyContains(unique,sendResponse){
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
courses = data.savedCourses;
|
courses = data.savedCourses;
|
||||||
var contains = false;
|
var contains = false;
|
||||||
var i = 0;
|
var i = 0;
|
||||||
while(i < courses.length && !contains){
|
while(i < courses.length && !contains){
|
||||||
if(courses[i].unique == course.unique){
|
if(courses[i].unique == unique){
|
||||||
contains = true;
|
contains = true;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
|||||||
28
content.js
28
content.js
@@ -21,26 +21,20 @@ const butdelay = 100;
|
|||||||
|
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
loadDataBase();
|
loadDataBase();
|
||||||
//make heading
|
//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>Computer Fluency (C S 302)</h2><h2 class=profname>with Bruce Porter</h2><div 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="Syllabi"> Past Syllabi </button><button class=matbut id="saveCourse" style="background: #F44336;"> Save Course +</button></div></div></div><div class=card><div class=cardcontainer><ul class=description style="list-style-type:disc"></ul></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" style="background: #4CAF50;"> RMP </button><button class=matbut id="eCIS" style="background: #CDDC39;"> eCIS </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><ul class=description style="list-style-type:disc"></ul></div></div><div class=card><div class=cardcontainer><div id=chart></div></div></div></div>'
|
||||||
$("#container").prepend(modhtml);
|
$("#container").prepend(modhtml);
|
||||||
//console.log(grades);
|
|
||||||
$('table').find('tr').each(function(){
|
|
||||||
if($(this).find('td').hasClass("course_header")){
|
|
||||||
|
|
||||||
} else if($(this).has('th').length == 0){
|
$('table').find('tr').each(function(){
|
||||||
var rating;
|
if(!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0){
|
||||||
var profname = $(this).find('td[data-th="Instructor"]').text() + "";
|
//if a course row, then add the extension button and do something if that course has been "saved"
|
||||||
//console.log(profname);
|
|
||||||
if(profname == ""){
|
|
||||||
//console.log("No Professor");
|
|
||||||
rating = "No Prof :(";
|
|
||||||
} else {
|
|
||||||
let lastname = profname.split(',')[0];
|
|
||||||
rating = "Hello";
|
|
||||||
}
|
|
||||||
$(this).append('<td data-th="Plus"><input type="image" class="distButton" style="vertical-align: bottom; display:block;" width="25" height="25" src='+chrome.extension.getURL('disticon.png')+' /></td>');
|
$(this).append('<td data-th="Plus"><input type="image" class="distButton" style="vertical-align: bottom; display:block;" width="25" height="25" src='+chrome.extension.getURL('disticon.png')+' /></td>');
|
||||||
|
chrome.runtime.sendMessage({command: "alreadyContains",unique: $(this).find('td[data-th="Unique"]').text()}, function(response) {
|
||||||
|
if(response.alreadyContains){
|
||||||
|
//DO SOMETHING IF ALREADY CONTAINS
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -56,7 +50,6 @@ $(document).ready( function() {
|
|||||||
$("#saveCourse").text(response.label);
|
$("#saveCourse").text(response.label);
|
||||||
alert(response.done);
|
alert(response.done);
|
||||||
});
|
});
|
||||||
$("#saveCourse").text("Remove Course");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#Syllabi").click(function(){
|
$("#Syllabi").click(function(){
|
||||||
@@ -189,8 +182,7 @@ function getDistribution(){
|
|||||||
|
|
||||||
function openDialog(dep,cls,sem,professor,res){
|
function openDialog(dep,cls,sem,professor,res){
|
||||||
$(".modal").fadeIn(fadetime);
|
$(".modal").fadeIn(fadetime);
|
||||||
var c = new Course(coursename,uniquenum, profname, times, dates, locations, status, profurl);
|
chrome.runtime.sendMessage({command: "alreadyContains",unique: uniquenum}, function(response) {
|
||||||
chrome.runtime.sendMessage({command: "alreadyContains",course: c}, function(response) {
|
|
||||||
console.log("Already Contains: "+response.alreadyContains);
|
console.log("Already Contains: "+response.alreadyContains);
|
||||||
if(response.alreadyContains){
|
if(response.alreadyContains){
|
||||||
$("#saveCourse").text("Remove Course -");
|
$("#saveCourse").text("Remove Course -");
|
||||||
|
|||||||
6
todo
6
todo
@@ -1,12 +1,11 @@
|
|||||||
TODO:
|
TODO:
|
||||||
- undefined prof, show all possible profs from past?
|
- undefined prof, show all possible profs from past?
|
||||||
DIFFERENT IF NO PROF
|
DIFFERENT IF NO PROF
|
||||||
- Saving courses
|
|
||||||
- popup.html
|
- popup.html
|
||||||
- Online classes/no location
|
- Online classes/no location
|
||||||
- Schedule Conflicts
|
- Schedule Conflicts
|
||||||
- waitlist/closed/open colors
|
|
||||||
- fix close button
|
- fix close button
|
||||||
|
- save image of modal?
|
||||||
- Degree plan?
|
- Degree plan?
|
||||||
- underline Courses maybe? click to go to using the planner link thing
|
- underline Courses maybe? click to go to using the planner link thing
|
||||||
- when almost everything is blank: M 379H as example
|
- when almost everything is blank: M 379H as example
|
||||||
@@ -34,4 +33,5 @@ FIXED/DONE since 7/7/18:
|
|||||||
- location w/ map
|
- location w/ map
|
||||||
- eCIS? link or scrape (nah just scrape)
|
- eCIS? link or scrape (nah just scrape)
|
||||||
- maybe modal animations?
|
- maybe modal animations?
|
||||||
|
- Saving courses
|
||||||
|
- waitlist/closed/open colors
|
||||||
|
|||||||
Reference in New Issue
Block a user