diff --git a/background.js b/background.js index 2cb9e6df..2ef55255 100644 --- a/background.js +++ b/background.js @@ -81,7 +81,7 @@ function add(request, sender, sendResponse) { courses.push(request.course) console.log(courses); chrome.storage.sync.set({savedCourses: courses}); - sendResponse({done:"Added: "+request.course.unique+request.course.coursename,label:"Remove Course -"}); + sendResponse({done:"Added: ("+request.course.unique+") "+request.course.coursename,label:"Remove Course -"}); }); } function remove(request, sender, sendResponse) { @@ -94,7 +94,7 @@ function remove(request, sender, sendResponse) { courses.splice(index,1); console.log(courses); chrome.storage.sync.set({savedCourses: courses}); - sendResponse({done:"removed: "+request.course.unique+request.course.coursename,label:"Add Course +"}); + sendResponse({done:"Removed: ("+request.course.unique+") "+request.course.coursename,label:"Add Course +"}); }); } diff --git a/content.js b/content.js index a84f2911..5250ef6d 100644 --- a/content.js +++ b/content.js @@ -9,7 +9,7 @@ var profurl; var department; var course_nbr; var datetimearr = []; - +var chart; var description; var status; const days = new Map([["M" ,"Monday"], @@ -24,6 +24,7 @@ $(document).ready( function() { $("table thead th:last-child").after('Plus'); var modhtml = '"; + var listhtml = "
  • "+department + " "+course_nbr+""+" with "+profname+" ("+courses[i].unique+")"+"

    "+makeLine(i)+"

  • "; $("#courseList").append(listhtml); } }); +function getSimpleName(coursename, unique){ + var department = coursename.substring(0,coursename.search(/\d/)-2); + var course_nbr = coursename.substring(coursename.search(/\d/),coursename.indexOf(" ",coursename.search(/\d/))); + return department+" "+course_nbr+" ("+unique+")"; +} + $(document).ready(function() { $("#clear").click(function(){ clear(); }); + $("#courseList li").click(function(){ + //makeLine($(this).attr("id")); + if($(this).find("p").not(':visible')){ + $(this).find("p").fadeIn(500); + } + else{ + $(this).find("p").hide(); + } + // window.open(courses[$(this).attr("id")].link); + }); }); +function makeLine(index){ + var datetimearr = courses[index].datetimearr; + //converted times back + var dtmap = new Map([]); + for(var i = 0; i: "+timearr[i].split(",")[0]+" to "+timearr[i].split(",")[1]+"
    "; + } + return output; +} + + function clear(){ chrome.storage.sync.set({savedCourses: []}); console.log("cleared"); - $("#courseList").fadeOut(300); + $("#courseList").fadeOut(300,function(){ + $("#empty").show(); + + }); } function update(){ diff --git a/styles.css b/styles.css index b164a3bb..c52a9ad0 100644 --- a/styles.css +++ b/styles.css @@ -152,4 +152,46 @@ .matbut:focus:not(:active)::after { animation: ripple 1s ease-out; +} + +#snackbar { + visibility: hidden; + min-width: 250px; + margin-left: -125px; + background-color: #333; + color: #fff; + text-align: center; + border-radius: 2px; + padding: 16px; + position: fixed; + z-index: 1; + left: 50%; + bottom: 30px; +} + +#snackbar.show { + visibility: visible; + + -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s; + animation: fadein 0.5s, fadeout 0.5s 2.5s; +} + +@-webkit-keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@keyframes fadein { + from {bottom: 0; opacity: 0;} + to {bottom: 30px; opacity: 1;} +} + +@-webkit-keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} +} + +@keyframes fadeout { + from {bottom: 30px; opacity: 1;} + to {bottom: 0; opacity: 0;} } \ No newline at end of file diff --git a/todo b/todo index 7094cd65..3622bf05 100644 --- a/todo +++ b/todo @@ -9,6 +9,9 @@ TODO as of 7/10/18: - underline Courses maybe? click to go to using the planner link thing - schedule generator - show schedule conflicts on the course page +-highlight in red on save course screen +- sync saved +-use maps for schedule conflict -added/removing/action toasts CLEAN UP: @@ -41,3 +44,4 @@ FIXED/DONE as of 7/10/18: - popup.html - Schedule Conflicts - when almost everything is blank: M 379H as example +