updated the search to now do the semester, class, and level search, and put link to RIS on popup
This commit is contained in:
@@ -283,7 +283,7 @@ input[type=number]::-webkit-outer-spin-button {
|
||||
|
||||
.select-style {
|
||||
border: 1px solid #979797;
|
||||
margin: 10px 0px;
|
||||
margin: 5px 0px;
|
||||
border-radius: 5px;
|
||||
display: none;
|
||||
background: transparent no-repeat 90% 50%;
|
||||
@@ -324,7 +324,7 @@ input[type=number]::-webkit-outer-spin-button {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#class_id_input {
|
||||
.class_id_input {
|
||||
display: none;
|
||||
border: 1px solid #979797;
|
||||
border-radius: 5px;
|
||||
@@ -332,7 +332,7 @@ input[type=number]::-webkit-outer-spin-button {
|
||||
padding: 5px 8px;
|
||||
}
|
||||
|
||||
#class_id_input::placeholder {
|
||||
.class_id_input::placeholder {
|
||||
color: rgba(0, 0, 45, 0.48);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
var grades;
|
||||
var current_semesters = {};
|
||||
var departments = [];
|
||||
var should_open = false;
|
||||
onStartup();
|
||||
|
||||
@@ -39,6 +40,9 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
||||
response({ semesters: current_semesters});
|
||||
getCurrentSemesters();
|
||||
break;
|
||||
case "currentDepartments":
|
||||
response({departments: departments});
|
||||
break;
|
||||
case "setOpen":
|
||||
should_open = true;
|
||||
chrome.tabs.create({ url: request.url});
|
||||
@@ -117,9 +121,9 @@ function onStartup(){
|
||||
updateBadge(true);
|
||||
loadDataBase()
|
||||
getCurrentSemesters();
|
||||
getCurrentDepartments();
|
||||
}
|
||||
|
||||
|
||||
function getCurrentSemesters(){
|
||||
$.get('https://registrar.utexas.edu/schedules', function (response) {
|
||||
if (response) {
|
||||
@@ -150,6 +154,19 @@ function getCurrentSemesters(){
|
||||
}
|
||||
|
||||
|
||||
function getCurrentDepartments(){
|
||||
$.get('https://catalog.utexas.edu/undergraduate/appendix-b/', function(response){
|
||||
if(response){;
|
||||
departments = [];
|
||||
htmlToNode(response).find('.column1').each(function(i){
|
||||
if(i > 0){
|
||||
let abv = $(this).text();
|
||||
departments.push(abv);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateBadge(first, new_changes) {
|
||||
if (new_changes) {
|
||||
@@ -401,4 +418,3 @@ function loadBinaryFile(path, success) {
|
||||
};
|
||||
xhr.send();
|
||||
};
|
||||
|
||||
|
||||
46
js/popup.js
46
js/popup.js
@@ -2,6 +2,7 @@ var courses;
|
||||
|
||||
setCourseList();
|
||||
getSemesters();
|
||||
getDepartments();
|
||||
|
||||
var can_remove = true;
|
||||
|
||||
@@ -105,9 +106,9 @@ $("#clear").click(function () {
|
||||
showEmpty();
|
||||
});
|
||||
|
||||
$("#schedule").click(function () {
|
||||
$("#RIS").click(function () {
|
||||
chrome.tabs.create({
|
||||
'url': 'https://registrar.utexas.edu/schedules'
|
||||
'url': 'https://utdirect.utexas.edu/registrar/ris.WBX'
|
||||
});
|
||||
});
|
||||
|
||||
@@ -201,22 +202,16 @@ $('#export-class').click(function () {
|
||||
});
|
||||
});
|
||||
|
||||
function openCoursePage(sem, unique) {
|
||||
var link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`;
|
||||
openMoreInfoWithOpenModal(link);
|
||||
function openSearch(semester, department, level) {
|
||||
var link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${semester}/results/?fos_fl=${department}&level=${level}&search_type_main=FIELD`
|
||||
chrome.tabs.create({ url: link});
|
||||
}
|
||||
|
||||
$("#search-class").click(() => {
|
||||
var unique_id = $("#class_id_input").val();
|
||||
if (!isNaN(unique_id)) {
|
||||
if (unique_id.length == 5) {
|
||||
let selected_semester = $("#semesters").find(":selected").val();
|
||||
openCoursePage(selected_semester, unique_id);
|
||||
$("#class_id_input").val('');
|
||||
return;
|
||||
}
|
||||
}
|
||||
alert("Oops, check your input. Class IDs should have 5 digits!");
|
||||
let semester = $("#semesters").find(":selected").val();
|
||||
let department = $("#department").find(":selected").val();
|
||||
let level = $("#level").find(":selected").val();
|
||||
openSearch(semester, department, level);
|
||||
});
|
||||
|
||||
$("#options_button").click(function () {
|
||||
@@ -367,9 +362,10 @@ function showEmpty() {
|
||||
|
||||
function hideSearchPopup() {
|
||||
$("#search>i").text('search');
|
||||
$("#class_id_input").hide();
|
||||
$("#semcon").hide();
|
||||
$("#depcon").hide();
|
||||
$("#semesters").hide();
|
||||
$("#levcon").hide();
|
||||
$("#search-popup").addClass('hide');
|
||||
}
|
||||
|
||||
@@ -378,7 +374,8 @@ function showSearchPopup() {
|
||||
$("#class_id_input").show();
|
||||
$("#semesters").show();
|
||||
$("#semcon").show();
|
||||
$('#class_id_input').focus();
|
||||
$("#depcon").show();
|
||||
$("#levcon").show();
|
||||
$("#search-popup").removeClass('hide');
|
||||
}
|
||||
|
||||
@@ -397,7 +394,6 @@ function getSemesters() {
|
||||
command: "currentSemesters"
|
||||
}, function(response){
|
||||
let { semesters } = response;
|
||||
console.log(semesters);
|
||||
let semester_names = Object.keys(semesters);
|
||||
for(let i = 0; i<semester_names.length;i++){
|
||||
let name = semester_names[i];
|
||||
@@ -405,3 +401,17 @@ function getSemesters() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function getDepartments() {
|
||||
chrome.runtime.sendMessage({
|
||||
command: "currentDepartments"
|
||||
}, function(response){
|
||||
let { departments } = response;
|
||||
console.log(departments);
|
||||
for(let i = 0; i<departments.length; i++){
|
||||
let abv = departments[i];
|
||||
$("#department").append(`<option value='${abv}'>${abv}</option>`);
|
||||
}
|
||||
$("#department").val('C S');
|
||||
});
|
||||
}
|
||||
|
||||
20
popup.html
20
popup.html
@@ -12,7 +12,7 @@
|
||||
<div class="card" id="card-header">
|
||||
<div id="buttons" style="padding: 5px 10px 5px 10px;display: flex;justify-content: space-between;">
|
||||
<button id="clear" class="matbut" style="font-size:15px; background:#4CAF50;margin: 7px;">Clear All</button>
|
||||
<button id="schedule" class="matbut" style="font-size:15px;background:#FF9800;margin: 7px;">Course List</button>
|
||||
<button id="RIS" class="matbut" style="font-size:15px;background:#FF9800;margin: 7px;">Registrar Info </button>
|
||||
<button id="calendar" class="matbut" style="font-size:15px; background: #FF0000; margin:7px;">My Schedule</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -50,8 +50,22 @@
|
||||
<select id="semesters"></select>
|
||||
</label>
|
||||
</div>
|
||||
<input type="text" id="class_id_input" class="item" name="class_id" maxlength="5"
|
||||
placeholder="Course ID #"></input>
|
||||
<div id='depcon' class="select-style item">
|
||||
<label>
|
||||
<select id="department"></select>
|
||||
</label>
|
||||
</div>
|
||||
<div id='levcon' class="select-style item">
|
||||
<label>
|
||||
<select id="level">
|
||||
<option value="L">Lower</option>
|
||||
<option value="U">Upper</option>
|
||||
<option value="G">Grad</option>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<!-- <input type="text" id="class_id_input" class="class_id_input item" name="class_id" maxlength="5"
|
||||
placeholder="Course ID #"></input> -->
|
||||
</div>
|
||||
<button id="search-class" class="matbut">Search</button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user