open modal when hitting more info from popup or utplanner
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
var grades;
|
var grades;
|
||||||
var current_semesters = {};
|
var current_semesters = {};
|
||||||
|
var should_open = false;
|
||||||
onStartup();
|
onStartup();
|
||||||
|
|
||||||
/* Handle messages and their commands from content and popup scripts*/
|
/* Handle messages and their commands from content and popup scripts*/
|
||||||
@@ -34,9 +34,19 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
|||||||
break;
|
break;
|
||||||
case "gradesQuery":
|
case "gradesQuery":
|
||||||
executeQuery(request.query, response);
|
executeQuery(request.query, response);
|
||||||
|
break;
|
||||||
case "currentSemesters":
|
case "currentSemesters":
|
||||||
response({ semesters: current_semesters});
|
response({ semesters: current_semesters});
|
||||||
getCurrentSemesters();
|
getCurrentSemesters();
|
||||||
|
break;
|
||||||
|
case "setOpen":
|
||||||
|
should_open = true;
|
||||||
|
chrome.tabs.create({ url: request.url});
|
||||||
|
break;
|
||||||
|
case "shouldOpen":
|
||||||
|
response({open : should_open});
|
||||||
|
should_open = false;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const method = request.method ? request.method.toUpperCase() : "GET";
|
const method = request.method ? request.method.toUpperCase() : "GET";
|
||||||
|
|||||||
@@ -47,9 +47,6 @@ chrome.storage.sync.get("savedCourses", function (data) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function displayModal(data) {
|
function displayModal(data) {
|
||||||
$("#myModal").fadeIn(calendar_fade_time);
|
$("#myModal").fadeIn(calendar_fade_time);
|
||||||
$("#colorStrip").css('background-color', data.color);
|
$("#colorStrip").css('background-color', data.color);
|
||||||
@@ -177,9 +174,7 @@ chrome.runtime.onMessage.addListener(
|
|||||||
|
|
||||||
|
|
||||||
$("#info").click(() => {
|
$("#info").click(() => {
|
||||||
setTimeout(() => {
|
openMoreInfoWithOpenModal(curr_course.link);
|
||||||
window.open(curr_course.link);
|
|
||||||
}, button_delay);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,8 @@ console.log(`UT Registration Plus is running on this page: ${window.location.hre
|
|||||||
|
|
||||||
var curr_course = {}
|
var curr_course = {}
|
||||||
|
|
||||||
|
|
||||||
var semester_code = new URL(window.location.href).pathname.split('/')[4];
|
var semester_code = new URL(window.location.href).pathname.split('/')[4];
|
||||||
var done_loading = true;
|
var done_loading = true;
|
||||||
updateListConflictHighlighting();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var next = $("#next_nav_link");
|
var next = $("#next_nav_link");
|
||||||
if (next) {
|
if (next) {
|
||||||
@@ -20,12 +16,6 @@ if (next) {
|
|||||||
//This extension may be super lit, but you know what's even more lit?
|
//This extension may be super lit, but you know what's even more lit?
|
||||||
//Matthew Tran's twitter and insta: @MATTHEWTRANN and @matthew.trann
|
//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')) {
|
if (document.querySelector('#fos_fl')) {
|
||||||
let params = (new URL(document.location)).searchParams;
|
let params = (new URL(document.location)).searchParams;
|
||||||
let dep = params.get("fos_fl");
|
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 () {
|
$("body").on('click', '#distButton', function () {
|
||||||
var row = $(this).closest('tr');
|
var row = $(this).closest('tr');
|
||||||
$('.modal-content').stop().animate({
|
$('.modal-content').stop().animate({
|
||||||
@@ -131,7 +130,7 @@ function getCourseInfo(row) {
|
|||||||
let course_name = "";
|
let course_name = "";
|
||||||
let course_row = {}
|
let course_row = {}
|
||||||
let individual = undefined;
|
let individual = undefined;
|
||||||
if ($("#textbook_button").length) {
|
if (isIndividualCoursePage()) {
|
||||||
course_name = $("#details h2").text();
|
course_name = $("#details h2").text();
|
||||||
course_row = $('table');
|
course_row = $('table');
|
||||||
individual = document.URL;
|
individual = document.URL;
|
||||||
@@ -562,6 +561,14 @@ function close() {
|
|||||||
$("#snackbar").attr("class", "");
|
$("#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) {
|
$(document).keydown(function (e) {
|
||||||
/*Close Modal when hit escape*/
|
/*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*/
|
$(window).scroll(function () {
|
||||||
chrome.runtime.onMessage.addListener(
|
if ($(document).height() <= $(window).scrollTop() + $(window).height() + 150)
|
||||||
function (request, sender, sendResponse) {
|
loadNextPages();
|
||||||
if (request.command == "updateCourseList") {
|
});
|
||||||
updateListConflictHighlighting(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ $('#export-class').click(function () {
|
|||||||
|
|
||||||
function openCoursePage(sem, unique) {
|
function openCoursePage(sem, unique) {
|
||||||
var link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`;
|
var link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`;
|
||||||
window.open(link);
|
openMoreInfoWithOpenModal(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
$("#search-class").click(() => {
|
$("#search-class").click(() => {
|
||||||
@@ -318,7 +318,7 @@ function subtractHours(curr_course){
|
|||||||
|
|
||||||
function handleMoreInfo(clicked_item, curr_course) {
|
function handleMoreInfo(clicked_item, curr_course) {
|
||||||
$(clicked_item).find("#listMoreInfo").click(function () {
|
$(clicked_item).find("#listMoreInfo").click(function () {
|
||||||
window.open(curr_course.link);
|
openMoreInfoWithOpenModal(curr_course.link);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -111,6 +111,9 @@ function seperateCourseNameParts(name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIndividualCoursePage(){
|
||||||
|
return $("#textbook_button").length != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -139,6 +142,10 @@ function setCurrentTabUrl(link) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openMoreInfoWithOpenModal(link){
|
||||||
|
chrome.runtime.sendMessage({ command: "setOpen", url: link });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function semesterSort(semA, semB) {
|
function semesterSort(semA, semB) {
|
||||||
let semOrder = {
|
let semOrder = {
|
||||||
|
|||||||
@@ -93,9 +93,7 @@ $("#textbook").click(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$("#moreInfo").click(function () {
|
$("#moreInfo").click(function () {
|
||||||
setTimeout(function () {
|
openMoreInfoWithOpenModal(curr_course["individual"]);
|
||||||
window.open(curr_course["individual"]);
|
|
||||||
}, Timing.button_delay);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user