open modal when hitting more info from popup or utplanner

This commit is contained in:
sghsri
2019-08-27 11:01:05 -05:00
parent 2c5a0945c7
commit 024d491e63
6 changed files with 46 additions and 32 deletions

View File

@@ -2,12 +2,8 @@ console.log(`UT Registration Plus is running on this page: ${window.location.hre
var curr_course = {}
var semester_code = new URL(window.location.href).pathname.split('/')[4];
var done_loading = true;
updateListConflictHighlighting();
var next = $("#next_nav_link");
if (next) {
@@ -20,12 +16,6 @@ if (next) {
//This extension may be super lit, but you know what's even more lit?
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
$(window).scroll(function () {
if ($(document).height() <= $(window).scrollTop() + $(window).height() + 150)
loadNextPages();
});
if (document.querySelector('#fos_fl')) {
let params = (new URL(document.location)).searchParams;
let dep = params.get("fos_fl");
@@ -53,9 +43,18 @@ if (!$("#kw_results_table").length) {
});
}
if(isIndividualCoursePage()){
chrome.runtime.sendMessage({
command: "shouldOpen",
}, function (response) {
if(response.open){
$("#distButton").click();
}
});
}
updateListConflictHighlighting();
/*Handle the button clicks*/
$("body").on('click', '#distButton', function () {
var row = $(this).closest('tr');
$('.modal-content').stop().animate({
@@ -131,7 +130,7 @@ function getCourseInfo(row) {
let course_name = "";
let course_row = {}
let individual = undefined;
if ($("#textbook_button").length) {
if (isIndividualCoursePage()) {
course_name = $("#details h2").text();
course_row = $('table');
individual = document.URL;
@@ -562,6 +561,14 @@ function close() {
$("#snackbar").attr("class", "");
}
/*Listen for update mssage coming from popup or calendar or other course catalog pages*/
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.command == "updateCourseList") {
updateListConflictHighlighting(0);
}
}
);
$(document).keydown(function (e) {
/*Close Modal when hit escape*/
@@ -573,11 +580,8 @@ $(document).keydown(function (e) {
});
/*Listen for update mssage coming from popup or calendar or other course catalog pages*/
chrome.runtime.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.command == "updateCourseList") {
updateListConflictHighlighting(0);
}
}
);
$(window).scroll(function () {
if ($(document).height() <= $(window).scrollTop() + $(window).height() + 150)
loadNextPages();
});