can now import waitlisted classes into ut reg +
This commit is contained in:
@@ -147,9 +147,15 @@ class Template {
|
|||||||
|
|
||||||
static Import = class Import {
|
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() {
|
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 () {
|
$(function () {
|
||||||
waitlist = !(window.location.href.includes('https://utdirect.utexas.edu/registration/classlist.WBX'));
|
waitlist = !(window.location.href.includes('https://utdirect.utexas.edu/registration/classlist.WBX'));
|
||||||
sem = waitlist ? $('[name="s_ccyys"]').val() : $("option[selected='selected']").val();
|
sem = waitlist ? $('[name="s_ccyys"]').val() : $("option[selected='selected']").val();
|
||||||
if (waitlist)
|
if (waitlist) {
|
||||||
$("[href='#top']").before(Template.Import.import_button());
|
$("[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());
|
$("table").after(Template.Import.import_button());
|
||||||
$("#import").prepend("<div id='snackbar'>import snackbar..</div>");
|
$("#import").prepend("<div id='snackbar'>import snackbar..</div>");
|
||||||
|
|
||||||
@@ -14,15 +15,25 @@ $(function () {
|
|||||||
$(search_nodes).each(function () {
|
$(search_nodes).each(function () {
|
||||||
importCourse($(this));
|
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() {
|
function importButtonAnimation(button) {
|
||||||
$("#import").text("Courses Saved!").css("background-color", Colors.open);
|
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 () {
|
setTimeout(function () {
|
||||||
$("#import").html(Template.Import.button_text_default).css('background-color', Colors.waitlisted);
|
$(button).html(return_text).css('background-color', Colors.waitlisted);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,9 @@ function formatShortenedCourseName(course) {
|
|||||||
return `${department} ${number} (${course.unique})`;
|
return `${department} ${number} (${course.unique})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).click(function(event) {
|
$(document).click(function (event) {
|
||||||
$target = $(event.target);
|
$target = $(event.target);
|
||||||
|
|
||||||
// If we're not clicking on search button or search popup, and popup is visible, hide it
|
// If we're not clicking on search button or search popup, and popup is visible, hide it
|
||||||
if (!$target.closest('#search').length && !$target.closest('#search-popup').length && $('#search-popup').is(":visible")) {
|
if (!$target.closest('#search').length && !$target.closest('#search-popup').length && $('#search-popup').is(":visible")) {
|
||||||
hideSearchPopup();
|
hideSearchPopup();
|
||||||
@@ -195,7 +195,6 @@ $('#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);
|
window.open(link);
|
||||||
@@ -265,8 +264,8 @@ function handleRegister(clicked_item, curr_course) {
|
|||||||
status.includes("waitlisted") ? "Join Waitlist" : "Register";
|
status.includes("waitlisted") ? "Join Waitlist" : "Register";
|
||||||
let register_color = can_not_register ? Colors.closed :
|
let register_color = can_not_register ? Colors.closed :
|
||||||
status.includes("waitlisted") ? Colors.waitlisted : Colors.open;
|
status.includes("waitlisted") ? Colors.waitlisted : Colors.open;
|
||||||
|
|
||||||
$(register_button).text(register_text).css('background-color', register_color);
|
$(register_button).text(register_text).css('background-color', register_color);
|
||||||
|
|
||||||
if (!can_not_register) {
|
if (!can_not_register) {
|
||||||
$(register_button).click(function () {
|
$(register_button).click(function () {
|
||||||
setCurrentTabUrl(registerlink);
|
setCurrentTabUrl(registerlink);
|
||||||
@@ -313,7 +312,6 @@ function handleEmpty() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function copyButtonAnimation() {
|
function copyButtonAnimation() {
|
||||||
$(this).find('i').text('check');
|
$(this).find('i').text('check');
|
||||||
$(this).stop(true, false).removeAttr('style').removeClass('shadow', {
|
$(this).stop(true, false).removeAttr('style').removeClass('shadow', {
|
||||||
|
|||||||
Reference in New Issue
Block a user