updated todo
This commit is contained in:
@@ -7,8 +7,11 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
||||
remove(request,sender,response);
|
||||
}
|
||||
}
|
||||
if(request.command == "checkConflicts"){
|
||||
//Check conflicts
|
||||
}
|
||||
else if(request.command == "alreadyContains"){
|
||||
alreadyContains(request.course,response);
|
||||
alreadyContains(request.unique,response);
|
||||
}
|
||||
else{
|
||||
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) {
|
||||
courses = data.savedCourses;
|
||||
var contains = false;
|
||||
var i = 0;
|
||||
while(i < courses.length && !contains){
|
||||
if(courses[i].unique == course.unique){
|
||||
if(courses[i].unique == unique){
|
||||
contains = true;
|
||||
}
|
||||
i++;
|
||||
|
||||
28
content.js
28
content.js
@@ -21,26 +21,20 @@ const butdelay = 100;
|
||||
|
||||
$(document).ready( function() {
|
||||
loadDataBase();
|
||||
//make heading
|
||||
//make heading and modal
|
||||
$("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>'
|
||||
$("#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){
|
||||
var rating;
|
||||
var profname = $(this).find('td[data-th="Instructor"]').text() + "";
|
||||
//console.log(profname);
|
||||
if(profname == ""){
|
||||
//console.log("No Professor");
|
||||
rating = "No Prof :(";
|
||||
} else {
|
||||
let lastname = profname.split(',')[0];
|
||||
rating = "Hello";
|
||||
}
|
||||
$('table').find('tr').each(function(){
|
||||
if(!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0){
|
||||
//if a course row, then add the extension button and do something if that course has been "saved"
|
||||
$(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);
|
||||
alert(response.done);
|
||||
});
|
||||
$("#saveCourse").text("Remove Course");
|
||||
});
|
||||
|
||||
$("#Syllabi").click(function(){
|
||||
@@ -189,8 +182,7 @@ function getDistribution(){
|
||||
|
||||
function openDialog(dep,cls,sem,professor,res){
|
||||
$(".modal").fadeIn(fadetime);
|
||||
var c = new Course(coursename,uniquenum, profname, times, dates, locations, status, profurl);
|
||||
chrome.runtime.sendMessage({command: "alreadyContains",course: c}, function(response) {
|
||||
chrome.runtime.sendMessage({command: "alreadyContains",unique: uniquenum}, function(response) {
|
||||
console.log("Already Contains: "+response.alreadyContains);
|
||||
if(response.alreadyContains){
|
||||
$("#saveCourse").text("Remove Course -");
|
||||
|
||||
6
todo
6
todo
@@ -1,12 +1,11 @@
|
||||
TODO:
|
||||
- undefined prof, show all possible profs from past?
|
||||
DIFFERENT IF NO PROF
|
||||
- Saving courses
|
||||
- popup.html
|
||||
- Online classes/no location
|
||||
- Schedule Conflicts
|
||||
- waitlist/closed/open colors
|
||||
- fix close button
|
||||
- save image of modal?
|
||||
- Degree plan?
|
||||
- underline Courses maybe? click to go to using the planner link thing
|
||||
- when almost everything is blank: M 379H as example
|
||||
@@ -34,4 +33,5 @@ FIXED/DONE since 7/7/18:
|
||||
- location w/ map
|
||||
- eCIS? link or scrape (nah just scrape)
|
||||
- maybe modal animations?
|
||||
|
||||
- Saving courses
|
||||
- waitlist/closed/open colors
|
||||
|
||||
Reference in New Issue
Block a user