From 5bfb5c08655fefd46cdf43f4bacfba83f85ba8aa Mon Sep 17 00:00:00 2001 From: sghsri Date: Wed, 12 Dec 2018 22:10:57 -0600 Subject: [PATCH] can change the semester --- css/popup.css | 5 +---- js/background.js | 2 +- js/popup.js | 40 ++++++++++++++++++++++++++++++++++++++-- manifest.json | 3 ++- popup.html | 2 ++ 5 files changed, 44 insertions(+), 8 deletions(-) diff --git a/css/popup.css b/css/popup.css index 0bc9148a..263def55 100644 --- a/css/popup.css +++ b/css/popup.css @@ -152,13 +152,10 @@ body { animation: ripple 1s ease-out; } -input[type=number]{ +input{ width: 80px; font-weight: bold; } -::placeholder{ - -}; input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; diff --git a/js/background.js b/js/background.js index b0c2f29d..d03a9132 100644 --- a/js/background.js +++ b/js/background.js @@ -235,4 +235,4 @@ function updateStatus() { }); // console.log("updated status' and registerlinks"); }); -} \ No newline at end of file +} diff --git a/js/popup.js b/js/popup.js index 7b766fe0..9663825c 100644 --- a/js/popup.js +++ b/js/popup.js @@ -5,6 +5,7 @@ setCourseList(); // var modhtml = ''; // $("#html").prepend(modhtml); +getSemesters(); function setCourseList(){ @@ -172,12 +173,14 @@ $(document).ready(function () { } }); $("#search").click(function(){ - if($("#search>i").text() == 'close'){ + if($("#search>i").text() == 'close') { $("#search>i").text('search'); $("#class_id").hide(); + $("#semesters").hide(); } else{ $("#search>i").text('close'); $("#class_id").show(); + $("#semesters").show(); } }); $('#import').click(function () { @@ -198,7 +201,7 @@ $(document).ready(function () { var unique = $(this).val(); if(!isNaN(unique)){ if(unique.length == 5){ - getInfo("20192", unique); + getInfo($("#semesters").find(":selected").val(), unique); return; } } @@ -337,6 +340,39 @@ function clear() { showEmpty(); } +function getSemesters(){ + var schedulelist = 'https://registrar.utexas.edu/schedules'; + chrome.runtime.sendMessage({ + method: "GET", + action: "xhttp", + url: schedulelist, + data: "" + }, function (response) { + if (response) { + var object = $('
').html(response).contents(); + object.find('.callout2>ul>li>a').each(function () { + if($(this).text() != "Course Schedule Archive"){ + var semname = $(this).text(); + chrome.runtime.sendMessage({ + method: "GET", + action: "xhttp", + url: $(this).attr('href'), + data: "" + }, function (response) { + if (response) { + var object = $('
').html(response).contents(); + object.find('.gobutton>a').each(function () { + var semnum = $(this).attr('href').substring($(this).attr('href').lastIndexOf('/')+1); + $("#semesters").append(``); + }); + } + }); + } + }); + } + }); +} + /*Course object for passing to background*/ function Course(coursename, unique, profname, datetimearr, status, link, registerlink) { diff --git a/manifest.json b/manifest.json index 41ab3aed..0383ffca 100644 --- a/manifest.json +++ b/manifest.json @@ -9,7 +9,8 @@ "declarativeContent", "storage", "*://*.utdirect.utexas.edu/apps/registrar/course_schedule/*", - "*://*.catalog.utexas.edu/ribbit/" + "*://*.catalog.utexas.edu/ribbit/", + "*://*.registrar.utexas.edu/schedules" ], "content_scripts": [{ "css": ["css/styles.css"], diff --git a/popup.html b/popup.html index bd0493b6..36f308fb 100644 --- a/popup.html +++ b/popup.html @@ -27,6 +27,8 @@
+