cleaning up and comments
This commit is contained in:
@@ -36,7 +36,6 @@
|
|||||||
background: #FF9800;
|
background: #FF9800;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ripple magic */
|
|
||||||
.matbut{
|
.matbut{
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
158
css/styles.css
158
css/styles.css
@@ -1,63 +1,62 @@
|
|||||||
/* The Modal (background) */
|
|
||||||
.modal {
|
.modal {
|
||||||
display: none; /* Hidden by default */
|
display: none;
|
||||||
position: fixed; /* Stay in place */
|
position: fixed;
|
||||||
z-index: 1; /* Sit on top */
|
z-index: 1;
|
||||||
padding-top: 100px; /* Location of the box */
|
padding-top: 100px;
|
||||||
left: 0;
|
left: 0;
|
||||||
top: 0;
|
top: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%; /* Full height */
|
height: 100%;
|
||||||
background-color: rgb(0,0,0); /* Fallback color */
|
background-color: rgb(0,0,0);
|
||||||
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
|
background-color: rgba(0,0,0,0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-content {
|
.modal-content {
|
||||||
background-color: #fefefe;
|
background-color: #fefefe;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
max-height: 85%;
|
max-height: 85%;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border: 1px solid #888;
|
border: 1px solid #888;
|
||||||
width: 50%;
|
width: 50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* The Close Button */
|
/* The Close Button */
|
||||||
.close {
|
.close {
|
||||||
color: #aaaaaa;
|
color: #aaaaaa;
|
||||||
float: right;
|
float: right;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 28px;
|
font-size: 28px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
font-weight: bold ;
|
font-weight: bold ;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
margin:5px 0px 5px 0px;
|
margin:5px 0px 5px 0px;
|
||||||
|
|
||||||
}
|
}
|
||||||
.description {
|
.description {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.profname {
|
.profname {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
padding-bottom: 5px;
|
padding-bottom: 5px;
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dateTimePlace {
|
.dateTimePlace {
|
||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
font-size: smaller;
|
font-size: smaller;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
#chart {
|
#chart {
|
||||||
@@ -65,43 +64,39 @@
|
|||||||
max-width: 800px;
|
max-width: 800px;
|
||||||
height: 250px;
|
height: 250px;
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
z-index:1;
|
z-index:1;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card {
|
.card {
|
||||||
/* Add shadows to create the "card" effect */
|
transition: 0.3s;
|
||||||
transition: 0.3s;
|
margin-bottom: 10px;
|
||||||
margin-bottom: 10px;
|
box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)
|
||||||
box-shadow:0 2px 5px 0 rgba(0,0,0,0.16),0 2px 10px 0 rgba(0,0,0,0.12)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* On mouse-over, add a deeper shadow */
|
|
||||||
.card:hover {
|
.card:hover {
|
||||||
box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)
|
box-shadow:0 4px 10px 0 rgba(0,0,0,0.2),0 4px 20px 0 rgba(0,0,0,0.19)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add some padding inside the card container */
|
|
||||||
.cardcontainer {
|
.cardcontainer {
|
||||||
padding: 2px 16px;
|
padding: 2px 16px;
|
||||||
transition:width 300ms ease-in-out, height 300ms ease-in-out;
|
transition:width 300ms ease-in-out, height 300ms ease-in-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
.description {
|
.description {
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.close:hover,
|
.close:hover,
|
||||||
.close:focus {
|
.close:focus {
|
||||||
color: #000;
|
color: #000;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.topbuttons .matbut {
|
.topbuttons .matbut {
|
||||||
display:inline-block;
|
display:inline-block;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Material style */
|
|
||||||
.matbut {
|
.matbut {
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
@@ -116,7 +111,6 @@
|
|||||||
background: #FF9800;
|
background: #FF9800;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ripple magic */
|
|
||||||
.matbut{
|
.matbut{
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -140,15 +134,15 @@
|
|||||||
0% {
|
0% {
|
||||||
transform: scale(0, 0);
|
transform: scale(0, 0);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
20% {
|
20% {
|
||||||
transform: scale(25, 25);
|
transform: scale(25, 25);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
100% {
|
100% {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale(40, 40);
|
transform: scale(40, 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.matbut:focus:not(:active)::after {
|
.matbut:focus:not(:active)::after {
|
||||||
@@ -156,42 +150,42 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
#snackbar {
|
#snackbar {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
margin-left: -200px;
|
margin-left: -200px;
|
||||||
background-color: #333;
|
background-color: #333;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
bottom: 30px;
|
bottom: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#snackbar.show {
|
#snackbar.show {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
|
|
||||||
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
-webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||||
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
animation: fadein 0.5s, fadeout 0.5s 2.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes fadein {
|
@-webkit-keyframes fadein {
|
||||||
from {bottom: 0; opacity: 0;}
|
from {bottom: 0; opacity: 0;}
|
||||||
to {bottom: 30px; opacity: 1;}
|
to {bottom: 30px; opacity: 1;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadein {
|
@keyframes fadein {
|
||||||
from {bottom: 0; opacity: 0;}
|
from {bottom: 0; opacity: 0;}
|
||||||
to {bottom: 30px; opacity: 1;}
|
to {bottom: 30px; opacity: 1;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@-webkit-keyframes fadeout {
|
@-webkit-keyframes fadeout {
|
||||||
from {bottom: 30px; opacity: 1;}
|
from {bottom: 30px; opacity: 1;}
|
||||||
to {bottom: 0; opacity: 0;}
|
to {bottom: 0; opacity: 0;}
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes fadeout {
|
@keyframes fadeout {
|
||||||
from {bottom: 30px; opacity: 1;}
|
from {bottom: 30px; opacity: 1;}
|
||||||
to {bottom: 0; opacity: 0;}
|
to {bottom: 0; opacity: 0;}
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/* Handle messages and their commands from content and popup scripts*/
|
||||||
chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
||||||
if(request.command == "courseStorage") {
|
if(request.command == "courseStorage") {
|
||||||
if(request.action == "add"){
|
if(request.action == "add"){
|
||||||
@@ -30,13 +31,15 @@ chrome.runtime.onMessage.addListener(function(request, sender, response) {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
chrome.runtime.onInstalled.addListener(function() {
|
/* Initially set the course data in storage */
|
||||||
|
chrome.runtime.onInstalled.addListener(function() {
|
||||||
var arr = new Array();
|
var arr = new Array();
|
||||||
chrome.storage.sync.set({savedCourses: arr}, function() {
|
chrome.storage.sync.set({savedCourses: arr}, function() {
|
||||||
console.log('initial course list');
|
console.log('initial course list');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Find all the conflicts in the courses and send them out/ if there is even a conflict*/
|
||||||
function checkConflicts(sendResponse) {
|
function checkConflicts(sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var conflicts = [];
|
var conflicts = [];
|
||||||
@@ -58,6 +61,7 @@ function checkConflicts(sendResponse) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find if the course at unique and with currdatearr is contained in the saved courses and if it conflicts with any other courses*/
|
||||||
function isSingleConflict(currdatearr, unique, sendResponse){
|
function isSingleConflict(currdatearr, unique, sendResponse){
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
@@ -80,6 +84,7 @@ function isSingleConflict(currdatearr, unique, sendResponse){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if conflict between two date-time-arrs*/
|
||||||
function isConflict(adtarr, bdtarr){
|
function isConflict(adtarr, bdtarr){
|
||||||
for(var i = 0; i<adtarr.length;i++){
|
for(var i = 0; i<adtarr.length;i++){
|
||||||
var currday = adtarr[i][0];
|
var currday = adtarr[i][0];
|
||||||
@@ -97,6 +102,7 @@ function isConflict(adtarr, bdtarr){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Add the requested course to the storage*/
|
||||||
function add(request, sender, sendResponse) {
|
function add(request, sender, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
@@ -106,6 +112,8 @@ function add(request, sender, sendResponse) {
|
|||||||
sendResponse({done:"Added: ("+request.course.unique+") "+request.course.coursename,label:"Remove Course -"});
|
sendResponse({done:"Added: ("+request.course.unique+") "+request.course.coursename,label:"Remove Course -"});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find and Remove the requested course from the storage*/
|
||||||
function remove(request, sender, sendResponse) {
|
function remove(request, sender, sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
@@ -121,6 +129,7 @@ function remove(request, sender, sendResponse) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Find if the unique is already contained within the storage*/
|
||||||
function alreadyContains(unique,sendResponse){
|
function alreadyContains(unique,sendResponse){
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
|
|||||||
@@ -26,18 +26,16 @@ $(document).ready( function() {
|
|||||||
var modhtml ='<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer><h2 class=title id="title">Computer Fluency (C S 302)</h2><h2 class=profname id="profname">with Bruce Porter</h2><div id="topbuttons" 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 style=""><ul class=description id="description" style="list-style-type:disc"></ul></div></div><div class=card ><div id="chartcontainer" 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 id="title">Computer Fluency (C S 302)</h2><h2 class=profname id="profname">with Bruce Porter</h2><div id="topbuttons" 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 style=""><ul class=description id="description" style="list-style-type:disc"></ul></div></div><div class=card ><div id="chartcontainer" class=cardcontainer><div id=chart></div></div></div></div>';
|
||||||
$("#container").prepend(modhtml);
|
$("#container").prepend(modhtml);
|
||||||
$("#myModal").prepend("<div id='snackbar'>defaultmessage..</div>");
|
$("#myModal").prepend("<div id='snackbar'>defaultmessage..</div>");
|
||||||
|
//go through all the rows in the list
|
||||||
$('table').find('tr').each(function(){
|
$('table').find('tr').each(function(){
|
||||||
if(!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0){
|
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"
|
//if a course row, then add the extension button and do something if that course has been "saved"
|
||||||
var thisForm = this;
|
var thisForm = this;
|
||||||
$(this).append('<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='+chrome.extension.getURL('images/disticon.png')+' /></td>');
|
$(this).append('<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='+chrome.extension.getURL('images/disticon.png')+' /></td>');
|
||||||
var uniquenum = $(this).find('td[data-th="Unique"]').text();
|
var uniquenum = $(this).find('td[data-th="Unique"]').text();
|
||||||
console.log(uniquenum);
|
|
||||||
chrome.runtime.sendMessage({command: "isSingleConflict",dtarr: getDtarr(this),unique:uniquenum}, function(response) {
|
chrome.runtime.sendMessage({command: "isSingleConflict",dtarr: getDtarr(this),unique:uniquenum}, function(response) {
|
||||||
if(response.isConflict){
|
if(response.isConflict){
|
||||||
//DO SOMETHING IF ALREADY CONTAINS
|
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','#F44336');
|
$(this).css('color','#F44336');
|
||||||
$(this).css('text-decoration','line-through');
|
$(this).css('text-decoration','line-through');
|
||||||
$(this).css('font-weight','normal');
|
$(this).css('font-weight','normal');
|
||||||
@@ -45,7 +43,6 @@ $(document).ready( function() {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','black');
|
$(this).css('color','black');
|
||||||
$(this).css('text-decoration','none');
|
$(this).css('text-decoration','none');
|
||||||
$(this).css('font-weight','normal');
|
$(this).css('font-weight','normal');
|
||||||
@@ -53,7 +50,6 @@ $(document).ready( function() {
|
|||||||
}
|
}
|
||||||
if(response.alreadyContains){
|
if(response.alreadyContains){
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','#4CAF50');
|
$(this).css('color','#4CAF50');
|
||||||
$(this).css('text-decoration','none');
|
$(this).css('text-decoration','none');
|
||||||
$(this).css('font-weight','bold');
|
$(this).css('font-weight','bold');
|
||||||
@@ -62,7 +58,7 @@ $(document).ready( function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*Handle the button clicks*/
|
||||||
$(".distButton").click(function(){
|
$(".distButton").click(function(){
|
||||||
var row = $(this).closest('tr');
|
var row = $(this).closest('tr');
|
||||||
getCourseInfo(row);
|
getCourseInfo(row);
|
||||||
@@ -95,12 +91,14 @@ $(document).ready( function() {
|
|||||||
window.open(eCISLink);
|
window.open(eCISLink);
|
||||||
}, butdelay);
|
}, butdelay);
|
||||||
});
|
});
|
||||||
|
/*Close Modal when hit escape*/
|
||||||
$(document).keydown(function(e) {
|
$(document).keydown(function(e) {
|
||||||
if (e.keyCode == 27) {
|
if (e.keyCode == 27) {
|
||||||
$("#myModal").fadeOut(fadetime);
|
$("#myModal").fadeOut(fadetime);
|
||||||
}
|
}
|
||||||
$("#snackbar").attr("class","");
|
$("#snackbar").attr("class","");
|
||||||
});
|
});
|
||||||
|
/*Listen for update mssage coming from popup*/
|
||||||
chrome.runtime.onMessage.addListener(
|
chrome.runtime.onMessage.addListener(
|
||||||
function(request, sender, sendResponse) {
|
function(request, sender, sendResponse) {
|
||||||
if (request.command == "update"){
|
if (request.command == "update"){
|
||||||
@@ -109,17 +107,15 @@ $(document).ready( function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* Update the course list to show if the row contains a course that conflicts with the saved course is one of the saved courses */
|
||||||
function update(){
|
function update(){
|
||||||
$('table').find('tr').each(function(){
|
$('table').find('tr').each(function(){
|
||||||
if(!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0){
|
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"
|
|
||||||
var thisForm = this;
|
var thisForm = this;
|
||||||
var uniquenum = $(this).find('td[data-th="Unique"]').text();
|
var uniquenum = $(this).find('td[data-th="Unique"]').text();
|
||||||
chrome.runtime.sendMessage({command: "isSingleConflict",dtarr: getDtarr(this),unique:uniquenum}, function(response) {
|
chrome.runtime.sendMessage({command: "isSingleConflict",dtarr: getDtarr(this),unique:uniquenum}, function(response) {
|
||||||
if(response.isConflict){
|
if(response.isConflict){
|
||||||
//DO SOMETHING IF ALREADY CONTAINS
|
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','#F44336');
|
$(this).css('color','#F44336');
|
||||||
$(this).css('text-decoration','line-through');
|
$(this).css('text-decoration','line-through');
|
||||||
$(this).css('font-weight','normal');
|
$(this).css('font-weight','normal');
|
||||||
@@ -127,7 +123,6 @@ function update(){
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','black');
|
$(this).css('color','black');
|
||||||
$(this).css('text-decoration','none');
|
$(this).css('text-decoration','none');
|
||||||
$(this).css('font-weight','normal');
|
$(this).css('font-weight','normal');
|
||||||
@@ -135,18 +130,17 @@ function update(){
|
|||||||
}
|
}
|
||||||
if(response.alreadyContains){
|
if(response.alreadyContains){
|
||||||
$(thisForm).find('td').each(function(){
|
$(thisForm).find('td').each(function(){
|
||||||
// $(this).css('font-weight','bold');
|
|
||||||
$(this).css('color','#4CAF50');
|
$(this).css('color','#4CAF50');
|
||||||
$(this).css('text-decoration','none');
|
$(this).css('text-decoration','none');
|
||||||
$(this).css('font-weight','bold');
|
$(this).css('font-weight','bold');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For a row, get the date-time-array for checking conflicts*/
|
||||||
function getDtarr(row){
|
function getDtarr(row){
|
||||||
var numlines = $(row).find('td[data-th="Days"]>span').length;
|
var numlines = $(row).find('td[data-th="Days"]>span').length;
|
||||||
var dtarr = [];
|
var dtarr = [];
|
||||||
@@ -170,6 +164,7 @@ function getDtarr(row){
|
|||||||
return dtarr;
|
return dtarr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Course object for passing to background*/
|
||||||
function Course(coursename, unique, profname,datetimearr, status, link){
|
function Course(coursename, unique, profname,datetimearr, status, link){
|
||||||
this.coursename = coursename;
|
this.coursename = coursename;
|
||||||
this.unique = unique;
|
this.unique = unique;
|
||||||
@@ -179,6 +174,7 @@ function Course(coursename, unique, profname,datetimearr, status, link){
|
|||||||
this.link = link;
|
this.link = link;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*For a row, get all the course information and add the date-time-lines*/
|
||||||
function getCourseInfo(row){
|
function getCourseInfo(row){
|
||||||
$(".dateTimePlace").remove();
|
$(".dateTimePlace").remove();
|
||||||
$('table').find('tr').each(function(){
|
$('table').find('tr').each(function(){
|
||||||
@@ -201,11 +197,11 @@ function getCourseInfo(row){
|
|||||||
var time = $(this).find('td[data-th="Hour"]>span:eq('+i+')').text();
|
var time = $(this).find('td[data-th="Hour"]>span:eq('+i+')').text();
|
||||||
var place = $(this).find('td[data-th="Room"]>span:eq('+i+')').text();
|
var place = $(this).find('td[data-th="Room"]>span:eq('+i+')').text();
|
||||||
$("#topbuttons").before('<h2 class="dateTimePlace">'+makeLine(date,time,place)+'</th>');
|
$("#topbuttons").before('<h2 class="dateTimePlace">'+makeLine(date,time,place)+'</th>');
|
||||||
// makeLine(date,time,place);
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
/*Handle if on the individual course page*/
|
||||||
if(typeof coursename == 'undefined'){
|
if(typeof coursename == 'undefined'){
|
||||||
coursename = $("#details h2").text();
|
coursename = $("#details h2").text();
|
||||||
profinit = profinit.substring(0,1);
|
profinit = profinit.substring(0,1);
|
||||||
@@ -216,7 +212,7 @@ function getCourseInfo(row){
|
|||||||
course_nbr = coursename.substring(coursename.search(/\d/),coursename.indexOf(" ",coursename.search(/\d/)));
|
course_nbr = coursename.substring(coursename.search(/\d/),coursename.indexOf(" ",coursename.search(/\d/)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//THIS CODE IS EXTREMELY MESSY, CLEAN UP GACK
|
/* Make the day-time-arr and make the text for the date-time-line*/
|
||||||
function makeLine(date, time, place){
|
function makeLine(date, time, place){
|
||||||
var arr = [];
|
var arr = [];
|
||||||
var output = "";
|
var output = "";
|
||||||
@@ -260,6 +256,7 @@ function makeLine(date, time, place){
|
|||||||
return output + " at "+time.replace(/\./g,'').replace(/\-/g,' to ')+" in "+"<a style='font-size:medium' target='_blank' href='"+"https://maps.utexas.edu/buildings/UTM/"+building+"''>"+building+"</>";
|
return output + " at "+time.replace(/\./g,'').replace(/\-/g,' to ')+" in "+"<a style='font-size:medium' target='_blank' href='"+"https://maps.utexas.edu/buildings/UTM/"+building+"''>"+building+"</>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Convert time to 24hour format*/
|
||||||
function convertTime(time){
|
function convertTime(time){
|
||||||
var converted = time.replace(/\./g,'').split("-");
|
var converted = time.replace(/\./g,'').split("-");
|
||||||
for(var i = 0; i<2;i++){
|
for(var i = 0; i<2;i++){
|
||||||
@@ -267,6 +264,8 @@ function convertTime(time){
|
|||||||
}
|
}
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Query the grades database*/
|
||||||
function getDistribution(){
|
function getDistribution(){
|
||||||
var query = "select * from agg";
|
var query = "select * from agg";
|
||||||
query += " where dept like '%"+department+"%'";
|
query += " where dept like '%"+department+"%'";
|
||||||
@@ -278,8 +277,10 @@ function getDistribution(){
|
|||||||
openDialog(department,coursename,"aggregate",profname,res);
|
openDialog(department,coursename,"aggregate",profname,res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Open the modal and show all the data*/
|
||||||
function openDialog(dep,cls,sem,professor,res){
|
function openDialog(dep,cls,sem,professor,res){
|
||||||
$("#myModal").fadeIn(fadetime);
|
$("#myModal").fadeIn(fadetime);
|
||||||
|
//initial text on the "save course button"
|
||||||
chrome.runtime.sendMessage({command: "alreadyContains",unique: uniquenum}, function(response) {
|
chrome.runtime.sendMessage({command: "alreadyContains",unique: uniquenum}, function(response) {
|
||||||
if(response.alreadyContains){
|
if(response.alreadyContains){
|
||||||
$("#saveCourse").text("Remove Course -");
|
$("#saveCourse").text("Remove Course -");
|
||||||
@@ -288,6 +289,7 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
$("#saveCourse").text("Add Course +");
|
$("#saveCourse").text("Add Course +");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
//set if no grade distribution
|
||||||
var data;
|
var data;
|
||||||
if(typeof res == 'undefined'){
|
if(typeof res == 'undefined'){
|
||||||
data = [];
|
data = [];
|
||||||
@@ -295,6 +297,7 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
else{
|
else{
|
||||||
data = res.values[0];
|
data = res.values[0];
|
||||||
}
|
}
|
||||||
|
//if undefined professor, then pick the distribution for the prof with the largest number of overall student entries
|
||||||
var title = null
|
var title = null
|
||||||
if(profname == "" && typeof res != 'undefined'){
|
if(profname == "" && typeof res != 'undefined'){
|
||||||
title = res.values[0][1];
|
title = res.values[0][1];
|
||||||
@@ -324,11 +327,12 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
name = profinit+". "+profname.substring(0,1)+profname.substring(1).toLowerCase();
|
name = profinit+". "+profname.substring(0,1)+profname.substring(1).toLowerCase();
|
||||||
}
|
}
|
||||||
$("#profname").text("with "+ name);
|
$("#profname").text("with "+ name);
|
||||||
|
//close button
|
||||||
span.onclick = function() {
|
span.onclick = function() {
|
||||||
$("#myModal").fadeOut(200);
|
$("#myModal").fadeOut(200);
|
||||||
$("#snackbar").attr("class","");
|
$("#snackbar").attr("class","");
|
||||||
}
|
}
|
||||||
|
//set up the chart
|
||||||
chart = Highcharts.chart('chart', {
|
chart = Highcharts.chart('chart', {
|
||||||
chart: {
|
chart: {
|
||||||
type: 'column',
|
type: 'column',
|
||||||
@@ -397,10 +401,10 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
series: [{
|
series: [{
|
||||||
name: 'Grades',
|
name: 'Grades',
|
||||||
data: [{y: data[6], color: '#4CAF50'}, {y: data[7], color: '#8BC34A'}, {y: data[8], color: '#CDDC39'}, {y: data[9], color: '#FFEB3B'}, {y: data[10], color: '#FFC107'}, {y: data[11], color: '#FFA000'}, {y: data[12], color: '#F57C00'}, {y: data[13], color: '#FF5722'}, {y: data[14], color: '#FF5252'}, {y: data[15], color: '#E64A19'}, {y: data[16], color: '#F44336'}, {y: data[17], color: '#D32F2F'}]
|
data: [{y: data[6], color: '#4CAF50'}, {y: data[7], color: '#8BC34A'}, {y: data[8], color: '#CDDC39'}, {y: data[9], color: '#FFEB3B'}, {y: data[10], color: '#FFC107'}, {y: data[11], color: '#FFA000'}, {y: data[12], color: '#F57C00'}, {y: data[13], color: '#FF5722'}, {y: data[14], color: '#FF5252'}, {y: data[15], color: '#E64A19'}, {y: data[16], color: '#F44336'}, {y: data[17], color: '#D32F2F'}]
|
||||||
|
|
||||||
}]
|
}]
|
||||||
}, function(chart) { // on complete
|
}, function(chart) { // on complete
|
||||||
if(data.length == 0){
|
if(data.length == 0){
|
||||||
|
//if no data, then show the message and hide the series
|
||||||
chart.renderer.text('Could not find distribution for this Instructor teaching this Course', 100, 120)
|
chart.renderer.text('Could not find distribution for this Instructor teaching this Course', 100, 120)
|
||||||
.css({
|
.css({
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
@@ -414,25 +418,25 @@ function openDialog(dep,cls,sem,professor,res){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}); // When the user clicks anywhere outside of the modal, close it
|
}); // When clicks anywhere outside of the modal, close it
|
||||||
window.onclick = function(event) {
|
window.onclick = function(event) {
|
||||||
if (event.target == modal) {
|
if (event.target == modal) {
|
||||||
$("#myModal").fadeOut(fadetime);
|
$("#myModal").fadeOut(fadetime);
|
||||||
$("#snackbar").attr("class","");
|
$("#snackbar").attr("class","");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Format the title*/
|
||||||
function prettifyTitle(){
|
function prettifyTitle(){
|
||||||
val = department.length+course_nbr.length+3;
|
val = department.length+course_nbr.length+3;
|
||||||
output = coursename.substring(val).replace(/\b\w*/g, function(txt){
|
output = coursename.substring(val).replace(/\b\w*/g, function(txt){
|
||||||
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
|
||||||
});
|
});
|
||||||
|
|
||||||
return output + " ("+department+" "+course_nbr+")";
|
return output + " ("+department+" "+course_nbr+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*Get the course description from the profurl and highlight the important elements, as well as set the eCIS, and rmp links.*/
|
||||||
function getDescription(){
|
function getDescription(){
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -452,7 +456,6 @@ function getDescription(){
|
|||||||
sentence = "<li style='font-style: italic; padding: 0px 5px 5px 5px;'>"+sentence+"</li>";
|
sentence = "<li style='font-style: italic; padding: 0px 5px 5px 5px;'>"+sentence+"</li>";
|
||||||
}
|
}
|
||||||
else if(sentence.indexOf("Restricted to") == 0){
|
else if(sentence.indexOf("Restricted to") == 0){
|
||||||
//console.log(sentence);
|
|
||||||
sentence = "<li style='color:red; padding: 0px 5px 5px 5px;'>"+sentence+"</li>";
|
sentence = "<li style='color:red; padding: 0px 5px 5px 5px;'>"+sentence+"</li>";
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -482,15 +485,15 @@ function getDescription(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Load the database*/
|
||||||
function loadDataBase(){
|
function loadDataBase(){
|
||||||
sql = window.SQL;
|
sql = window.SQL;
|
||||||
loadBinaryFile('grades.db', function(data){
|
loadBinaryFile('grades.db', function(data){
|
||||||
var sqldb = new SQL.Database(data);
|
var sqldb = new SQL.Database(data);
|
||||||
// Database is ready
|
grades = sqldb;
|
||||||
grades = sqldb;
|
|
||||||
//console.log(grades.exec(query)[0]);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
/* load the database from file */
|
||||||
function loadBinaryFile(path,success) {
|
function loadBinaryFile(path,success) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", chrome.extension.getURL(path), true);
|
xhr.open("GET", chrome.extension.getURL(path), true);
|
||||||
|
|||||||
103
js/popup.js
103
js/popup.js
@@ -1,52 +1,56 @@
|
|||||||
var courses;
|
var courses;
|
||||||
|
// get the courses from storage
|
||||||
chrome.storage.sync.get('savedCourses', function(data) {
|
chrome.storage.sync.get('savedCourses', function(data) {
|
||||||
|
//find, build, and show the messages for the conflicts in the saved courses
|
||||||
chrome.runtime.sendMessage({command: "checkConflicts"}, function(response) {
|
chrome.runtime.sendMessage({command: "checkConflicts"}, function(response) {
|
||||||
var isConflicted = [];
|
var isConflicted = [];
|
||||||
if(response.isConflict){
|
if(response.isConflict){
|
||||||
var between = response.between;
|
var between = response.between;
|
||||||
var text = "";
|
var text = "";
|
||||||
for(var i = 0; i<between.length;i++){
|
for(var i = 0; i<between.length;i++){
|
||||||
text+="CONFLICT: "+ getSimpleName(between[i][0].coursename,between[i][0].unique) + " and "+getSimpleName(between[i][1].coursename,between[i][1].unique);
|
text+="CONFLICT: "+ getSimpleName(between[i][0].coursename,between[i][0].unique) + " and "+getSimpleName(between[i][1].coursename,between[i][1].unique);
|
||||||
isConflicted.push(between[i][0].unique);
|
isConflicted.push(between[i][0].unique);
|
||||||
isConflicted.push(between[i][1].unique);
|
isConflicted.push(between[i][1].unique);
|
||||||
if(i != between.length-1){
|
if(i != between.length-1){
|
||||||
text+= "<br>";
|
text+= "<br>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$("#courseList").prepend("<p style='font-size:small; font-weight:bold; color:red; margin:5px 5px 5px 10px'>"+text+"</>");
|
$("#courseList").prepend("<p style='font-size:small; font-weight:bold; color:red; margin:5px 5px 5px 10px'>"+text+"</>");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
courses = data.savedCourses;
|
courses = data.savedCourses;
|
||||||
if(courses.length != 0){
|
if(courses.length != 0){
|
||||||
$("#empty").hide();
|
$("#empty").hide();
|
||||||
|
}
|
||||||
|
// build and append the course list element
|
||||||
|
for(var i = 0; i<courses.length;i++){
|
||||||
|
var color;
|
||||||
|
status = courses[i].status;
|
||||||
|
if(status.includes("open")){
|
||||||
|
color = "#4CAF50";
|
||||||
}
|
}
|
||||||
console.log(courses);
|
else if(status.includes("waitlisted")){
|
||||||
for(var i = 0; i<courses.length;i++){
|
color = "#FF9800"
|
||||||
var color;
|
|
||||||
status = courses[i].status;
|
|
||||||
if(status.includes("open")){
|
|
||||||
color = "#4CAF50";
|
|
||||||
}
|
|
||||||
else if(status.includes("waitlisted")){
|
|
||||||
color = "#FF9800"
|
|
||||||
}
|
|
||||||
else if(status.includes("closed") || status.includes("cancelled")){
|
|
||||||
color = "#F44336";
|
|
||||||
}
|
|
||||||
var department = courses[i].coursename.substring(0,courses[i].coursename.search(/\d/)-2);
|
|
||||||
var course_nbr = courses[i].coursename.substring(courses[i].coursename.search(/\d/),courses[i].coursename.indexOf(" ",courses[i].coursename.search(/\d/)));
|
|
||||||
var profname = courses[i].profname.substring(0,1)+courses[i].profname.substring(1).toLowerCase();
|
|
||||||
var listhtml = "<li id='"+i+"'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'><div class='card'><div class='container' style='background:"+color+"''><h4 class='truncate' style='color:white;margin:5px; font-size:large;'><b>"+department + " "+course_nbr+"<span style='font-size:medium'>"+" with </span><span style='font-size:medium'>"+profname+" ("+courses[i].unique+")"+"</span></b></h4></div></div><div id='moreInfo' style='display: none;'><p style='font-weight:bold;padding:10px;margin:0px;font-size:small;background-color:#FFCDD2;'>"+makeLine(i)+"</p><div id='infoButtons' style='border-radius:0px;'><button class='matbut' id='listRemove'style='float:right;background:#F44336; margin:5px;'>Remove</button><button class='matbut' id='listMoreInfo' style='float:right;background:#2196F3; margin:5px;'>More Info</button></div></div></li>";
|
|
||||||
$("#courseList").append(listhtml);
|
|
||||||
}
|
}
|
||||||
|
else if(status.includes("closed") || status.includes("cancelled")){
|
||||||
|
color = "#F44336";
|
||||||
|
}
|
||||||
|
var department = courses[i].coursename.substring(0,courses[i].coursename.search(/\d/)-2);
|
||||||
|
var course_nbr = courses[i].coursename.substring(courses[i].coursename.search(/\d/),courses[i].coursename.indexOf(" ",courses[i].coursename.search(/\d/)));
|
||||||
|
var profname = courses[i].profname.substring(0,1)+courses[i].profname.substring(1).toLowerCase();
|
||||||
|
var listhtml = "<li id='"+i+"'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'><div class='card'><div class='container' style='background:"+color+"''><h4 class='truncate' style='color:white;margin:5px; font-size:large;'><b>"+department + " "+course_nbr+"<span style='font-size:medium'>"+" with </span><span style='font-size:medium'>"+profname+" ("+courses[i].unique+")"+"</span></b></h4></div></div><div id='moreInfo' style='display: none;'><p style='font-weight:bold;padding:10px;margin:0px;font-size:small;background-color:#FFCDD2;'>"+makeLine(i)+"</p><div id='infoButtons' style='border-radius:0px;'><button class='matbut' id='listRemove'style='float:right;background:#F44336; margin:5px;'>Remove</button><button class='matbut' id='listMoreInfo' style='float:right;background:#2196F3; margin:5px;'>More Info</button></div></div></li>";
|
||||||
|
$("#courseList").append(listhtml);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* prettify the name for the conflict messages*/
|
||||||
function getSimpleName(coursename, unique){
|
function getSimpleName(coursename, unique){
|
||||||
var department = coursename.substring(0,coursename.search(/\d/)-2);
|
var department = coursename.substring(0,coursename.search(/\d/)-2);
|
||||||
var course_nbr = coursename.substring(coursename.search(/\d/),coursename.indexOf(" ",coursename.search(/\d/)));
|
var course_nbr = coursename.substring(coursename.search(/\d/),coursename.indexOf(" ",coursename.search(/\d/)));
|
||||||
return department+" "+course_nbr+" ("+unique+")";
|
return department+" "+course_nbr+" ("+unique+")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Update the conflict messages */
|
||||||
function updateConflicts(){
|
function updateConflicts(){
|
||||||
chrome.runtime.sendMessage({command: "checkConflicts"}, function(response) {
|
chrome.runtime.sendMessage({command: "checkConflicts"}, function(response) {
|
||||||
var isConflicted = [];
|
var isConflicted = [];
|
||||||
@@ -66,18 +70,18 @@ function updateConflicts(){
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle the button clicks */
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#courseList li").click(function(){
|
$("#courseList li").click(function(){
|
||||||
//GACKY FIX
|
|
||||||
$(this).find("#listMoreInfo").click(function(){
|
$(this).find("#listMoreInfo").click(function(){
|
||||||
window.open(courses[$(this).closest("li").attr("id")].link);
|
window.open(courses[$(this).closest("li").attr("id")].link);
|
||||||
});
|
});
|
||||||
|
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
|
||||||
$(this).find("#listRemove").click(function(){
|
$(this).find("#listRemove").click(function(){
|
||||||
|
$(thisForm).closest("ul").find("> p").remove();
|
||||||
var thisForm = this;
|
var thisForm = this;
|
||||||
chrome.runtime.sendMessage({command: "courseStorage",course: courses[$(thisForm).closest("li").attr("id")], action:"remove"}, function(response) {
|
chrome.runtime.sendMessage({command: "courseStorage",course: courses[$(thisForm).closest("li").attr("id")], action:"remove"}, function(response) {
|
||||||
$(thisForm).closest("li").fadeOut(200);
|
$(thisForm).closest("li").fadeOut(200);
|
||||||
console.log($(thisForm).closest("ul").children(":visible").length);
|
|
||||||
$(thisForm).closest("ul").find("> p").remove();
|
|
||||||
if($(thisForm).closest("ul").children(':visible').length===1){
|
if($(thisForm).closest("ul").children(':visible').length===1){
|
||||||
$("#courseList").fadeOut(300,function(){
|
$("#courseList").fadeOut(300,function(){
|
||||||
$("#empty").fadeIn(200);
|
$("#empty").fadeIn(200);
|
||||||
@@ -85,29 +89,30 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
updateConflicts();
|
updateConflicts();
|
||||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
||||||
chrome.tabs.sendMessage(tabs[0].id, {command: "update"});
|
chrome.tabs.sendMessage(tabs[0].id, {command: "update"});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
/* Show the times popout and more info options*/
|
||||||
if($(this).find("#moreInfo").is(":hidden")){
|
if($(this).find("#moreInfo").is(":hidden")){
|
||||||
$(this).find("#moreInfo").fadeIn(200);
|
$(this).find("#moreInfo").fadeIn(200);
|
||||||
//alert("hello");
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$(this).find("#moreInfo").fadeOut(200);
|
$(this).find("#moreInfo").fadeOut(200);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#clear").click(function(){
|
$("#clear").click(function(){
|
||||||
clear();
|
clear();
|
||||||
});
|
});
|
||||||
$("#schedule").click(function(){
|
$("#schedule").click(function(){
|
||||||
chrome.tabs.create({ 'url': 'https://utexas.collegescheduler.com/entry'});
|
chrome.tabs.create({ 'url': 'https://registrar.utexas.edu/schedules'});
|
||||||
});
|
});
|
||||||
$("#open").click(function(){
|
$("#open").click(function(){
|
||||||
chrome.tabs.create({ 'url': 'chrome://extensions/?options=' + chrome.runtime.id });
|
chrome.tabs.create({ 'url': 'chrome://extensions/?options=' + chrome.runtime.id });
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/* convert from the dtarr and maek the time lines*/
|
||||||
function makeLine(index){
|
function makeLine(index){
|
||||||
var datetimearr = courses[index].datetimearr;
|
var datetimearr = courses[index].datetimearr;
|
||||||
//converted times back
|
//converted times back
|
||||||
@@ -116,23 +121,17 @@ function makeLine(index){
|
|||||||
datetimearr[i][1][0] = moment(datetimearr[i][1][0], ["HH:mm"]).format("h:mm A");
|
datetimearr[i][1][0] = moment(datetimearr[i][1][0], ["HH:mm"]).format("h:mm A");
|
||||||
datetimearr[i][1][1] = moment(datetimearr[i][1][1], ["HH:mm"]).format("h:mm A");
|
datetimearr[i][1][1] = moment(datetimearr[i][1][1], ["HH:mm"]).format("h:mm A");
|
||||||
}
|
}
|
||||||
//console.log(datetimearr[0][0]);
|
|
||||||
for(var i = 0; i<datetimearr.length;i++){
|
for(var i = 0; i<datetimearr.length;i++){
|
||||||
//console.log(datetimearr[i][0]);
|
|
||||||
if(dtmap.has(String(datetimearr[i][1]))){
|
if(dtmap.has(String(datetimearr[i][1]))){
|
||||||
console.log(datetimearr[i][0]);
|
|
||||||
dtmap.set(String(datetimearr[i][1]),dtmap.get(String(datetimearr[i][1]))+datetimearr[i][0]);
|
dtmap.set(String(datetimearr[i][1]),dtmap.get(String(datetimearr[i][1]))+datetimearr[i][0]);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
console.log(datetimearr[i][0]);
|
|
||||||
dtmap.set(String(datetimearr[i][1]),datetimearr[i][0]);
|
dtmap.set(String(datetimearr[i][1]),datetimearr[i][0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var output="";
|
var output="";
|
||||||
var timearr = Array.from(dtmap.keys());
|
var timearr = Array.from(dtmap.keys());
|
||||||
var dayarr = Array.from(dtmap.values());
|
var dayarr = Array.from(dtmap.values());
|
||||||
console.log(timearr);
|
|
||||||
console.log(dayarr);
|
|
||||||
for(var i = 0; i<dayarr.length;i++){
|
for(var i = 0; i<dayarr.length;i++){
|
||||||
output += "<span style='font-size:medium'>"+dayarr[i]+"</span>: <span style='float:right'>"+timearr[i].split(",")[0]+" to "+timearr[i].split(",")[1]+"</span><br>";
|
output += "<span style='font-size:medium'>"+dayarr[i]+"</span>: <span style='float:right'>"+timearr[i].split(",")[0]+" to "+timearr[i].split(",")[1]+"</span><br>";
|
||||||
}
|
}
|
||||||
@@ -140,14 +139,14 @@ function makeLine(index){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*Clear the list and the storage of courses*/
|
||||||
function clear(){
|
function clear(){
|
||||||
chrome.storage.sync.set({savedCourses: []});
|
chrome.storage.sync.set({savedCourses: []});
|
||||||
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
|
||||||
chrome.tabs.sendMessage(tabs[0].id, {command: "update"});
|
chrome.tabs.sendMessage(tabs[0].id, {command: "update"});
|
||||||
});
|
});
|
||||||
console.log("cleared");
|
console.log("cleared");
|
||||||
$("#courseList").fadeOut(300,function(){
|
$("#courseList").fadeOut(300,function(){
|
||||||
$("#empty").fadeIn(200);
|
$("#empty").fadeIn(200);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
|
|
||||||
"name": "UT Course Extension",
|
"name": "UT Registration Plus",
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"description": "Chrome Extension to show more information on the UT Course catalog",
|
"description": "Improves the course registration process at the University of Texas at Austin!",
|
||||||
"permissions": [ "tabs",
|
"permissions": [ "tabs",
|
||||||
"declarativeContent",
|
"declarativeContent",
|
||||||
"storage",
|
"storage",
|
||||||
|
|||||||
15
popup.html
15
popup.html
@@ -8,15 +8,16 @@
|
|||||||
<div class="card" id="header">
|
<div class="card" id="header">
|
||||||
<div id="buttons" style="padding: 5px 10px 5px 10px;display: flex;justify-content: space-between;">
|
<div id="buttons" style="padding: 5px 10px 5px 10px;display: flex;justify-content: space-between;">
|
||||||
<button id="clear" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;">Clear All</button>
|
<button id="clear" class="matbut" style="font-size:medium; background:#4CAF50;margin: 10px;">Clear All</button>
|
||||||
<button id="schedule" class="matbut" style="font-size:medium;background:#FF9800;margin: 10px">UT Planner</button>
|
<button id="schedule" class="matbut" style="font-size:medium;background:#FF9800;margin: 10px">Course List</button>
|
||||||
<button id="open" class="matbut" style="font-size:medium;background:#FFC107;margin: 10px;">Options</button>
|
<button id="open" class="matbut" style="font-size:medium;background:#FFC107;margin: 10px;">Options</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<ul id= "courseList" style="list-style-type: none;padding: 5px;"></ul>
|
<ul id= "courseList" style="list-style-type: none;padding: 5px;"></ul>
|
||||||
<h2 id="empty" style="font-weight: normal;font-size: large;margin: 60px 30px 40px 30px ;">Doesn't Look Like Anything To Me.<br>
|
<h2 id="empty" style="font-weight: normal;font-size: large;margin: 60px 30px 40px 30px ;">Doesn't Look Like Anything To Me.<br>
|
||||||
<span style="font-size: small;display:table;margin:0 auto;font-weight: bold">(No Courses Saved)</span><h2>
|
<span style="font-size: small;display:table;margin:0 auto;font-weight: bold">(No Courses Saved)</span>
|
||||||
<script src="js/jquery-3.3.1.min.js"></script>
|
<h2>
|
||||||
<script src="js/moment.min.js"></script>
|
<script src="js/jquery-3.3.1.min.js"></script>
|
||||||
<script src="js/popup.js"></script>
|
<script src="js/moment.min.js"></script>
|
||||||
</body>
|
<script src="js/popup.js"></script>
|
||||||
</html>
|
</body>
|
||||||
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user