register button
This commit is contained in:
@@ -7,6 +7,7 @@ var profname;
|
|||||||
var profinit;
|
var profinit;
|
||||||
var uniquenum;
|
var uniquenum;
|
||||||
var profurl;
|
var profurl;
|
||||||
|
var registerlink;
|
||||||
var department;
|
var department;
|
||||||
var course_nbr;
|
var course_nbr;
|
||||||
var datetimearr = [];
|
var datetimearr = [];
|
||||||
@@ -95,7 +96,7 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function saveCourse() {
|
function saveCourse() {
|
||||||
var c = new Course(coursename, uniquenum, profname, datetimearr, status, profurl);
|
var c = new Course(coursename, uniquenum, profname, datetimearr, status, profurl, registerlink);
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
command: "courseStorage",
|
command: "courseStorage",
|
||||||
course: c,
|
course: c,
|
||||||
@@ -177,13 +178,14 @@ function getDtarr(row) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*Course object for passing to background*/
|
/*Course object for passing to background*/
|
||||||
function Course(coursename, unique, profname, datetimearr, status, link) {
|
function Course(coursename, unique, profname, datetimearr, status, link, registerlink) {
|
||||||
this.coursename = coursename;
|
this.coursename = coursename;
|
||||||
this.unique = unique;
|
this.unique = unique;
|
||||||
this.profname = profname;
|
this.profname = profname;
|
||||||
this.datetimearr = datetimearr;
|
this.datetimearr = datetimearr;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
this.link = link;
|
this.link = link;
|
||||||
|
this.registerlink = registerlink;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*For a row, get all the course information and add the date-time-lines*/
|
/*For a row, get all the course information and add the date-time-lines*/
|
||||||
@@ -196,6 +198,8 @@ function getCourseInfo(row) {
|
|||||||
}
|
}
|
||||||
if ($(this).is(row)) {
|
if ($(this).is(row)) {
|
||||||
profurl = $(this).find('td[data-th="Unique"] a').prop('href');
|
profurl = $(this).find('td[data-th="Unique"] a').prop('href');
|
||||||
|
registerlink = $(this).find('td[data-th="Add"] a').prop('href');
|
||||||
|
console.log(registerlink);
|
||||||
uniquenum = $(this).find('td[data-th="Unique"]').text();
|
uniquenum = $(this).find('td[data-th="Unique"]').text();
|
||||||
status = $(this).find('td[data-th="Status"]').text();
|
status = $(this).find('td[data-th="Status"]').text();
|
||||||
profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0];
|
profname = $(this).find('td[data-th="Instructor"]').text().split(', ')[0];
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ chrome.storage.sync.get('savedCourses', function (data) {
|
|||||||
if (profname == "") {
|
if (profname == "") {
|
||||||
profname = "Undecided Professor";
|
profname = "Undecided Professor";
|
||||||
}
|
}
|
||||||
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; display:inline-block;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><p style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;'>▼</p></div></div><div id='moreInfo' style='display: none;'><p style='font-weight:bold;padding:10px;margin:0px 5px 0px 15px;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>";
|
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; display:inline-block;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><p style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;'>▼</p></div></div><div id='moreInfo' style='display: none;'><p style='font-weight:bold;padding:10px;margin:0px 5px 0px 15px;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='register' style='float:right;background:#4CAF50; margin:5px;'>Register</button><button class='matbut' id='listMoreInfo' style='float:right;background:#2196F3; margin:5px;'>More Info</button></div></div></li>";
|
||||||
$("#courseList").append(listhtml);
|
$("#courseList").append(listhtml);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -88,6 +88,12 @@ $(document).ready(function () {
|
|||||||
$(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);
|
||||||
});
|
});
|
||||||
|
$(this).find("#register").click(function () {
|
||||||
|
let registerlink = courses[$(this).closest("li").attr("id")].registerlink;
|
||||||
|
chrome.tabs.query({currentWindow: true, active: true}, function (tab) {
|
||||||
|
chrome.tabs.update(tab.id, {url: registerlink});
|
||||||
|
});
|
||||||
|
});
|
||||||
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
|
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
|
||||||
$(this).find("#listRemove").click(function () {
|
$(this).find("#listRemove").click(function () {
|
||||||
var thisForm = this;
|
var thisForm = this;
|
||||||
|
|||||||
Reference in New Issue
Block a user