can now import waitlisted classes into ut reg +
This commit is contained in:
@@ -147,9 +147,15 @@ class Template {
|
||||
|
||||
static Import = class Import {
|
||||
|
||||
static button_text_default = "<span style='font-size:small'>Import to </span><b>UT Reg Plus<b>";
|
||||
static button_text_default = "<span style='font-size:small'>Import to </span><b>UT Reg +<b>";
|
||||
static waitlist_button_text_default = "<span style='font-size:small'>Import Waitlists to </span><b>UT Reg +<b>";
|
||||
static button_success = "Courses Saved!";
|
||||
static import_button() {
|
||||
return `<button class='matbut' id='import' style='margin:20px 0px 20px 0px;'>${this.button_text_default}</button><br>`;
|
||||
return `<button class='matbut' id='import' style='margin:15px 0px;'>${this.button_text_default}</button><br>`;
|
||||
}
|
||||
|
||||
static waitlist_import_button() {
|
||||
return `<button class='matbut' id='import_waitlist' style='margin:0px'>${this.waitlist_button_text_default}</button><br>`;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
23
js/import.js
23
js/import.js
@@ -3,9 +3,10 @@ var sem;
|
||||
$(function () {
|
||||
waitlist = !(window.location.href.includes('https://utdirect.utexas.edu/registration/classlist.WBX'));
|
||||
sem = waitlist ? $('[name="s_ccyys"]').val() : $("option[selected='selected']").val();
|
||||
if (waitlist)
|
||||
if (waitlist) {
|
||||
$("[href='#top']").before(Template.Import.import_button());
|
||||
else
|
||||
$("[name='wl_see_my_waitlists']").after(Template.Import.waitlist_import_button());
|
||||
} else
|
||||
$("table").after(Template.Import.import_button());
|
||||
$("#import").prepend("<div id='snackbar'>import snackbar..</div>");
|
||||
|
||||
@@ -14,15 +15,25 @@ $(function () {
|
||||
$(search_nodes).each(function () {
|
||||
importCourse($(this));
|
||||
})
|
||||
importButtonAnimation();
|
||||
importButtonAnimation($(this));
|
||||
});
|
||||
|
||||
$("#import_waitlist").click(function () {
|
||||
search_nodes = $("tr.tb span:first-child");
|
||||
$(search_nodes).each(function () {
|
||||
importCourse($(this));
|
||||
})
|
||||
importButtonAnimation($(this));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function importButtonAnimation() {
|
||||
$("#import").text("Courses Saved!").css("background-color", Colors.open);
|
||||
function importButtonAnimation(button) {
|
||||
let is_waitlisted_button = $(button).attr('id') == "import_waitlist";
|
||||
let return_text = is_waitlisted_button ? Template.Import.waitlist_button_text_default : Template.Import.button_text_default;
|
||||
$(button).text(Template.Import.button_success).css("background-color", Colors.open);
|
||||
setTimeout(function () {
|
||||
$("#import").html(Template.Import.button_text_default).css('background-color', Colors.waitlisted);
|
||||
$(button).html(return_text).css('background-color', Colors.waitlisted);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ function formatShortenedCourseName(course) {
|
||||
return `${department} ${number} (${course.unique})`;
|
||||
}
|
||||
|
||||
$(document).click(function(event) {
|
||||
$(document).click(function (event) {
|
||||
$target = $(event.target);
|
||||
|
||||
// If we're not clicking on search button or search popup, and popup is visible, hide it
|
||||
@@ -195,7 +195,6 @@ $('#export-class').click(function () {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function openCoursePage(sem, unique) {
|
||||
var link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`;
|
||||
window.open(link);
|
||||
@@ -265,8 +264,8 @@ function handleRegister(clicked_item, curr_course) {
|
||||
status.includes("waitlisted") ? "Join Waitlist" : "Register";
|
||||
let register_color = can_not_register ? Colors.closed :
|
||||
status.includes("waitlisted") ? Colors.waitlisted : Colors.open;
|
||||
|
||||
$(register_button).text(register_text).css('background-color', register_color);
|
||||
|
||||
if (!can_not_register) {
|
||||
$(register_button).click(function () {
|
||||
setCurrentTabUrl(registerlink);
|
||||
@@ -313,7 +312,6 @@ function handleEmpty() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function copyButtonAnimation() {
|
||||
$(this).find('i').text('check');
|
||||
$(this).stop(true, false).removeAttr('style').removeClass('shadow', {
|
||||
|
||||
Reference in New Issue
Block a user