minor changes
This commit is contained in:
@@ -72,6 +72,11 @@ $(function () {
|
|||||||
if (!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0) {
|
if (!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0) {
|
||||||
//if a course row, then add the extension button
|
//if a course row, then add the extension button
|
||||||
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
||||||
|
// if ($(this).find('td[data-th="Status"]').text().includes('waitlisted')) {
|
||||||
|
// $(this).find('td').each(function () {
|
||||||
|
// $(this).css('background-color', '#E0E0E0');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -151,12 +156,19 @@ function loadNextPages(inHTML) {
|
|||||||
nextpage.find('tbody>tr').each(function () {
|
nextpage.find('tbody>tr').each(function () {
|
||||||
if (!($(this).find('td').hasClass("course_header") && $(this).has('th').length == 0)) {
|
if (!($(this).find('td').hasClass("course_header") && $(this).has('th').length == 0)) {
|
||||||
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
$(this).append(`<td data-th="Plus"><input type="image" class="distButton" id="distButton" style="vertical-align: bottom; display:block;" width="20" height="20" src='${chrome.extension.getURL('images/disticon.png')}'/></td>`);
|
||||||
|
// if ($(this).find('td[data-th="Status"]').text().includes('waitlisted')) {
|
||||||
|
// $(this).find('td').each(function () {
|
||||||
|
// $(this).css('background-color', '#E0E0E0');
|
||||||
|
// });
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
current.append($(this));
|
current.append($(this));
|
||||||
});
|
});
|
||||||
loadNextPages(response);
|
loadNextPages(response);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -377,7 +389,7 @@ function getDistribution(sem) {
|
|||||||
|
|
||||||
/*Open the modal and show all the data*/
|
/*Open the modal and show all the data*/
|
||||||
function openDialog(dep, cls, sem, professor, res) {
|
function openDialog(dep, cls, sem, professor, res) {
|
||||||
$("#myModal").scrollTop(0);
|
$("#myModal").fadeIn(fadetime);
|
||||||
//initial text on the "save course button"
|
//initial text on the "save course button"
|
||||||
|
|
||||||
|
|
||||||
@@ -560,6 +572,7 @@ function setChart(data) {
|
|||||||
chart.renderer.text('Could not find data for this Instructor teaching this Course.', 100, 120)
|
chart.renderer.text('Could not find data for this Instructor teaching this Course.', 100, 120)
|
||||||
.css({
|
.css({
|
||||||
fontSize: '20px',
|
fontSize: '20px',
|
||||||
|
width: '300px',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
left: '160px'
|
left: '160px'
|
||||||
})
|
})
|
||||||
|
|||||||
108
js/popup.js
108
js/popup.js
@@ -3,20 +3,21 @@ var courses;
|
|||||||
|
|
||||||
setCourseList();
|
setCourseList();
|
||||||
|
|
||||||
// var modhtml = '<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer></div></div></div></div>';
|
// var modhtml = '<div class=modal id=myModal><div class=modal-content><span class=close>×</span><div class=card><div class=cardcontainer></div></div></div></div>';
|
||||||
// $("#html").prepend(modhtml);
|
// $("#html").prepend(modhtml);
|
||||||
getSemesters();
|
getSemesters();
|
||||||
|
|
||||||
|
|
||||||
function setCourseList(){
|
function setCourseList() {
|
||||||
$("#courseList").empty()
|
$("#courseList").empty()
|
||||||
chrome.storage.sync.get('savedCourses', function (data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
updateConflicts();
|
updateConflicts();
|
||||||
courses = data.savedCourses
|
courses = data.savedCourses
|
||||||
|
console.log(courses.length);
|
||||||
if (courses.length != 0) {
|
if (courses.length != 0) {
|
||||||
$("#empty").hide();
|
$("#empty").hide();
|
||||||
$("#courseList").show();
|
$("#courseList").show();
|
||||||
} else{
|
} else {
|
||||||
showEmpty();
|
showEmpty();
|
||||||
}
|
}
|
||||||
// build and append the course list element
|
// build and append the course list element
|
||||||
@@ -44,15 +45,16 @@ function setCourseList(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
function showEmpty(){
|
function showEmpty() {
|
||||||
var emptyText = ["Doesn't Look Like Anything To Me.", "You Can't Fail Classes You're Not In.", "Pro-Tip: Don't Take O-Chem.",
|
var emptyText = ["Doesn't Look Like Anything To Me.", "You Can't Fail Classes You're Not In.", "Pro-Tip: Don't Take O-Chem.",
|
||||||
"No Work Happens On PCL 5th Floor.", "Sophomore But Freshman By Credit.", "Pain is temporary, GPA is forever.",
|
"No Work Happens On PCL 5th Floor.", "Sophomore But Freshman By Credit.", "Pain is temporary, GPA is forever.",
|
||||||
"You've Yee'd Your Last Haw.","lol everything is already waitlisted.", "At Least You're Not At A&M.",
|
"You've Yee'd Your Last Haw.", "lol everything is already waitlisted.", "At Least You're Not At A&M.",
|
||||||
`It's ${moment().format("h:mm")} and OU Still Sucks.`, 'TeXAs iS BaCK GuYZ', "'Academically Challenged'",
|
`It's ${moment().format("h:mm")} and OU Still Sucks.`, 'TeXAs iS BaCK GuYZ', "'Academically Challenged'",
|
||||||
'Does McCombs teach Parseltongue?']
|
'Does McCombs teach Parseltongue?'
|
||||||
|
]
|
||||||
$("#courseList").hide();
|
$("#courseList").hide();
|
||||||
$("#empty").fadeIn(200);
|
$("#empty").fadeIn(200);
|
||||||
$("#main").html(emptyText[Math.floor(Math.random()*emptyText.length)]);
|
$("#main").html(emptyText[Math.floor(Math.random() * emptyText.length)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* prettify the name for the conflict messages*/
|
/* prettify the name for the conflict messages*/
|
||||||
@@ -161,24 +163,24 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#impexp").click(function(){
|
$("#impexp").click(function () {
|
||||||
if($("#impexp>i").text() == 'close'){
|
if ($("#impexp>i").text() == 'close') {
|
||||||
$('#import').hide();
|
$('#import').hide();
|
||||||
$('#export').hide();
|
$('#export').hide();
|
||||||
$("#impexp>i").text('import_export');
|
$("#impexp>i").text('import_export');
|
||||||
} else{
|
} else {
|
||||||
$("#impexp>i").text('close');
|
$("#impexp>i").text('close');
|
||||||
$('#import').show();
|
$('#import').show();
|
||||||
$('#export').show();
|
$('#export').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$("#search").click(function(){
|
$("#search").click(function () {
|
||||||
if($("#search>i").text() == 'close') {
|
if ($("#search>i").text() == 'close') {
|
||||||
$("#search>i").text('search');
|
$("#search>i").text('search');
|
||||||
$("#class_id").hide();
|
$("#class_id").hide();
|
||||||
$("#semcon").hide();
|
$("#semcon").hide();
|
||||||
$("#semesters").hide();
|
$("#semesters").hide();
|
||||||
} else{
|
} else {
|
||||||
$("#search>i").text('close');
|
$("#search>i").text('close');
|
||||||
$("#class_id").show();
|
$("#class_id").show();
|
||||||
$("#semesters").show();
|
$("#semesters").show();
|
||||||
@@ -193,17 +195,19 @@ $(document).ready(function () {
|
|||||||
chrome.storage.sync.get('savedCourses', function (data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var exportArray = JSON.stringify(data.savedCourses, null, 4);
|
var exportArray = JSON.stringify(data.savedCourses, null, 4);
|
||||||
var exportlink = document.createElement('a');
|
var exportlink = document.createElement('a');
|
||||||
var url = window.URL.createObjectURL(new Blob([exportArray], {type: "octet/stream"}));
|
var url = window.URL.createObjectURL(new Blob([exportArray], {
|
||||||
|
type: "octet/stream"
|
||||||
|
}));
|
||||||
exportlink.setAttribute('href', url);
|
exportlink.setAttribute('href', url);
|
||||||
exportlink.setAttribute('download', 'my_courses.json' );
|
exportlink.setAttribute('download', 'my_courses.json');
|
||||||
exportlink.click();
|
exportlink.click();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$("#class_id").on("keyup", function(e){
|
$("#class_id").on("keyup", function (e) {
|
||||||
if(e.keyCode == 13){
|
if (e.keyCode == 13) {
|
||||||
var unique = $(this).val();
|
var unique = $(this).val();
|
||||||
if(!isNaN(unique)){
|
if (!isNaN(unique)) {
|
||||||
if(unique.length == 5){
|
if (unique.length == 5) {
|
||||||
getInfo($("#semesters").find(":selected").val(), unique);
|
getInfo($("#semesters").find(":selected").val(), unique);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -224,14 +228,14 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$("#importOrig").change(function(e){
|
$("#importOrig").change(function (e) {
|
||||||
var files = e.target.files;
|
var files = e.target.files;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function(){
|
reader.onload = function () {
|
||||||
try{
|
try {
|
||||||
var impCourses = JSON.parse(this.result);
|
var impCourses = JSON.parse(this.result);
|
||||||
console.log(impCourses);
|
console.log(impCourses);
|
||||||
if(impCourses && impCourses.length && (impCourses.length == 0 || validateObject(impCourses))){
|
if (impCourses && impCourses.length && (impCourses.length == 0 || validateObject(impCourses))) {
|
||||||
chrome.storage.sync.set({
|
chrome.storage.sync.set({
|
||||||
savedCourses: impCourses
|
savedCourses: impCourses
|
||||||
});
|
});
|
||||||
@@ -244,20 +248,20 @@ $("#importOrig").change(function(e){
|
|||||||
});
|
});
|
||||||
setCourseList();
|
setCourseList();
|
||||||
}
|
}
|
||||||
} catch(err){
|
} catch (err) {
|
||||||
|
|
||||||
}
|
}
|
||||||
importOrig.value = ''; //make sure to clear input value after every import
|
importOrig.value = ''; //make sure to clear input value after every import
|
||||||
}
|
}
|
||||||
reader.readAsText(files[0]);
|
reader.readAsText(files[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
function validateObject(impCourses){
|
function validateObject(impCourses) {
|
||||||
for(var i = 0; i<impCourses.length; i++){
|
for (var i = 0; i < impCourses.length; i++) {
|
||||||
var course = impCourses[i];
|
var course = impCourses[i];
|
||||||
var isValid = course["coursename"] && course["datetimearr"] && course["link"] && course["profname"] && course["status"] && course["unique"];
|
var isValid = course["coursename"] && course["datetimearr"] && course["link"] && course["profname"] && course["status"] && course["unique"];
|
||||||
console.log(isValid);
|
console.log(isValid);
|
||||||
if(!isValid){
|
if (!isValid) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -343,7 +347,7 @@ function clear() {
|
|||||||
showEmpty();
|
showEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSemesters(){
|
function getSemesters() {
|
||||||
var schedulelist = 'https://registrar.utexas.edu/schedules';
|
var schedulelist = 'https://registrar.utexas.edu/schedules';
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
@@ -354,22 +358,22 @@ function getSemesters(){
|
|||||||
if (response) {
|
if (response) {
|
||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
object.find('.callout2>ul>li>a').each(function () {
|
object.find('.callout2>ul>li>a').each(function () {
|
||||||
if($(this).text() != "Course Schedule Archive"){
|
if ($(this).text() != "Course Schedule Archive") {
|
||||||
var semname = $(this).text().split(" ")[0].substring(0,2)+" " +$(this).text().split(" ")[1];
|
var semname = $(this).text().split(" ")[0].substring(0, 2) + " " + $(this).text().split(" ")[1];
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
method: "GET",
|
method: "GET",
|
||||||
action: "xhttp",
|
action: "xhttp",
|
||||||
url: $(this).attr('href'),
|
url: $(this).attr('href'),
|
||||||
data: ""
|
data: ""
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
if (response) {
|
if (response) {
|
||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
object.find('.gobutton>a').each(function () {
|
object.find('.gobutton>a').each(function () {
|
||||||
var semnum = $(this).attr('href').substring($(this).attr('href').lastIndexOf('/')+1);
|
var semnum = $(this).attr('href').substring($(this).attr('href').lastIndexOf('/') + 1);
|
||||||
$("#semesters").append(`<option value="${semnum}"">${semname}</option>`);
|
$("#semesters").append(`<option value="${semnum}"">${semname}</option>`);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -400,7 +404,7 @@ function getInfo(sem, unique) {
|
|||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
var c = getCourseObject(object, link);
|
var c = getCourseObject(object, link);
|
||||||
console.log(c);
|
console.log(c);
|
||||||
if(c.coursename){
|
if (c.coursename) {
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
command: "courseStorage",
|
command: "courseStorage",
|
||||||
course: c,
|
course: c,
|
||||||
@@ -463,4 +467,4 @@ function convertTime(time) {
|
|||||||
converted[i] = moment(converted[i], ["h:mm A"]).format("HH:mm");
|
converted[i] = moment(converted[i], ["h:mm A"]).format("HH:mm");
|
||||||
}
|
}
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
2
todo
2
todo
@@ -3,7 +3,6 @@ TODO as of 12/11/18
|
|||||||
FEATURES:
|
FEATURES:
|
||||||
- work on UT Planner
|
- work on UT Planner
|
||||||
- work on multiple schedules
|
- work on multiple schedules
|
||||||
- all semester's grade distribution
|
|
||||||
- polish
|
- polish
|
||||||
- clean upcalendar export and add more options to screen
|
- clean upcalendar export and add more options to screen
|
||||||
- maybe show how many people have a class in their cart
|
- maybe show how many people have a class in their cart
|
||||||
@@ -23,6 +22,7 @@ DONE/FIXED:
|
|||||||
- Location in popup extra info
|
- Location in popup extra info
|
||||||
- Export calendar format
|
- Export calendar format
|
||||||
- import courses from class schedule screen
|
- import courses from class schedule screen
|
||||||
|
- all semester's grade distribution
|
||||||
- import into and export from UT registration plus
|
- import into and export from UT registration plus
|
||||||
- Showing the icon on the flags pages
|
- Showing the icon on the flags pages
|
||||||
- Easter egg, no course messages
|
- Easter egg, no course messages
|
||||||
|
|||||||
Reference in New Issue
Block a user