From aa3b68fe9e3eaa4795b511fdf21484b1f85cad5d Mon Sep 17 00:00:00 2001 From: 10001shh Date: Sun, 9 Dec 2018 16:14:53 -0600 Subject: [PATCH 001/131] live version --- js/calendar.js | 30 ++++++++++++++++-------------- manifest.json | 2 +- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/js/calendar.js b/js/calendar.js index 01b9bdd9..484a1655 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -82,22 +82,24 @@ $(function () { var dayarr = Array.from(dtmap.values()); console.log(timearr); console.log(dayarr); - for (var i = 0; i < dayarr.length; i++) { - var place = findLoc(dayarr[i], timearr[i], course.datetimearr); - var building = place.substring(0, place.search(/\d/) - 1); - if (building == "") { - building = "Undecided Location"; - } - //cal.addEvent(subject, description, location, begin, end, rrule) - let rrurle = { - freq: "WEEKLY", - interval: 1, - byday: [""] + for (int i = 0; i < ) + for (var i = 0; i < dayarr.length; i++) { + var place = findLoc(dayarr[i], timearr[i], course.datetimearr); + var building = place.substring(0, place.search(/\d/) - 1); + if (building == "") { + building = "Undecided Location"; + } + //cal.addEvent(subject, description, location, begin, end, rrule) + let rrurle = { + freq: "WEEKLY", + interval: 1, + byday: [""] + + } + // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); + // output += `

${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

`; } - // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); - // output += `

${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

`; - } } cal.download(); diff --git a/manifest.json b/manifest.json index 0bc38607..1165ff9b 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "UT Registration Plus", - "version": "0.2.2.1", + "version": "0.2.2.2", "options_page": "options.html", "description": "Improves the course registration process at the University of Texas at Austin!", "permissions": ["tabs", From 3d564fcea59dee6de5267be64b9e73f93daa6135 Mon Sep 17 00:00:00 2001 From: 10001shh Date: Sun, 9 Dec 2018 16:17:12 -0600 Subject: [PATCH 002/131] live version --- js/calendar.js | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/js/calendar.js b/js/calendar.js index 484a1655..80aab49b 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -82,24 +82,23 @@ $(function () { var dayarr = Array.from(dtmap.values()); console.log(timearr); console.log(dayarr); - for (int i = 0; i < ) - for (var i = 0; i < dayarr.length; i++) { - var place = findLoc(dayarr[i], timearr[i], course.datetimearr); - var building = place.substring(0, place.search(/\d/) - 1); - if (building == "") { - building = "Undecided Location"; + for (var i = 0; i < dayarr.length; i++) { + var place = findLoc(dayarr[i], timearr[i], course.datetimearr); + var building = place.substring(0, place.search(/\d/) - 1); + if (building == "") { + building = "Undecided Location"; - } - //cal.addEvent(subject, description, location, begin, end, rrule) - let rrurle = { - freq: "WEEKLY", - interval: 1, - byday: [""] - - } - // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); - // output += `

${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

`; } + //cal.addEvent(subject, description, location, begin, end, rrule) + let rrurle = { + freq: "WEEKLY", + interval: 1, + byday: [""] + + } + // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); + // output += `

${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

`; + } } cal.download(); From 84630a1292eff731a8f180ab1ab882166f25b78e Mon Sep 17 00:00:00 2001 From: Sriram Hariharan Date: Sun, 9 Dec 2018 18:07:34 -0600 Subject: [PATCH 003/131] updated todo --- js/content.js | 4 ++-- js/options.js | 4 ++-- todo | 14 +++++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/js/content.js b/js/content.js index 2a9ddf85..9751b1f9 100644 --- a/js/content.js +++ b/js/content.js @@ -343,7 +343,7 @@ function openDialog(dep, cls, sem, professor, res) { $("#myModal").fadeOut(200); $("#snackbar").attr("class", ""); } - //set up the chart + //set up the chart chart = Highcharts.chart('chart', { chart: { type: 'column', @@ -567,4 +567,4 @@ function loadBinaryFile(path, success) { success(arr.join("")); }; xhr.send(); -}; \ No newline at end of file +}; diff --git a/js/options.js b/js/options.js index 95aa237a..b25a6d1b 100644 --- a/js/options.js +++ b/js/options.js @@ -12,7 +12,7 @@ $("#toggleConflictHighlighting").click(function(){ if(action == "Turn Off"){ chrome.storage.sync.set({courseConflictHighlight: false}, function() { on(); - }); + }); } else{ chrome.storage.sync.set({courseConflictHighlight: true}, function() { off(); @@ -33,4 +33,4 @@ function on(){ function off(){ $("#toggleConflictHighlighting").text("Turn Off"); $("#toggleConflictHighlighting").css("background","#F44336"); -} \ No newline at end of file +} diff --git a/todo b/todo index dc01a8b3..fc2572df 100644 --- a/todo +++ b/todo @@ -1,13 +1,17 @@ -TODO as of 8/28/18 +TODO as of 12/9/18 FEATURES: -- import calendar -- import into UT registration plus - +- Export calendar format +- import into and export from UT registration plus +- load all courses on first pages +- work on UT Planner +- work on +- BUGS TO FIX: - +- Showing the icon on the flags pages +- Fix the update/install bug DONE/FIXED: - unneeded Logout message on individual course pages From b4f19a0c612550e71bedfc8000ddecab4f73791b Mon Sep 17 00:00:00 2001 From: sghsri Date: Tue, 11 Dec 2018 13:34:17 -0600 Subject: [PATCH 004/131] import on course schedule page --- js/import.js | 33 ++++++++++++++++++++++++++------- manifest.json | 2 +- todo | 4 ++-- 3 files changed, 29 insertions(+), 10 deletions(-) diff --git a/js/import.js b/js/import.js index b449e085..52b86a39 100644 --- a/js/import.js +++ b/js/import.js @@ -1,15 +1,34 @@ var link; +var waitlist; +var sem; $(function () { //template https://utdirect.utexas.edu/apps/registrar/course_schedule/20189/51475/ - var sem = $('[name="s_ccyys"]').val(); - $("[href='#top']").before("
"); + console.log(window.location.href); + var importbutton = "
"; + waitlist = !(window.location.href.includes('https://utdirect.utexas.edu/registration/classlist.WBX')); + if(waitlist){ + sem = $('[name="s_ccyys"]').val(); + $("[href='#top']").before(importbutton); + } else { + sem = $("option[selected='selected']").val(); + $("table").after(importbutton); + } + console.log(sem); $("#import").prepend("
defaultmessage..
"); $("#import").click(function () { - $(".tbg").last().find(".tbon>td:first-child").each(function () { - let unique = $(this).text().replace(/\s/g, ''); - link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`; - getInfo(); - }); + if(waitlist){ + $(".tbg").last().find(".tbon>td:first-child").each(function () { + let unique = $(this).text().replace(/\s/g, ''); + link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`; + getInfo(); + }); + } else { + $("tr>td:first-child").each(function(){ + let unique = $(this).text().replace(/\s/g, ''); + link = `https://utdirect.utexas.edu/apps/registrar/course_schedule/${sem}/${unique}/`; + getInfo(); + }); + } $("#import").text("Courses Saved!").css("background-color", "#4CAF50"); setTimeout(function () { $("#import").html("Import into UT Reg Plus").css("background-color", "#FF9800"); diff --git a/manifest.json b/manifest.json index 1165ff9b..34705367 100644 --- a/manifest.json +++ b/manifest.json @@ -18,7 +18,7 @@ }, { "css": ["css/styles.css"], "js": ["js/moment.min.js", "js/sql-memory-growth.js", "js/highcharts.js", "js/jquery-3.3.1.min.js", "js/import.js"], - "matches": ["https://utdirect.utexas.edu/registrar/waitlist/wl_see_my_waitlists.WBX"] + "matches": ["https://utdirect.utexas.edu/registrar/waitlist/wl_see_my_waitlists.WBX", "https://utdirect.utexas.edu/registration/classlist.WBX*"] } ], diff --git a/todo b/todo index fc2572df..8ab412a7 100644 --- a/todo +++ b/todo @@ -6,8 +6,8 @@ FEATURES: - import into and export from UT registration plus - load all courses on first pages - work on UT Planner -- work on -- +- work on multiple schedules +- import courses from class schedule screen BUGS TO FIX: - Showing the icon on the flags pages From 0eb7c9b949fb5b7e34504887e94e213da759b61f Mon Sep 17 00:00:00 2001 From: sghsri Date: Tue, 11 Dec 2018 17:36:17 -0600 Subject: [PATCH 005/131] can import and export courses w/ json file --- css/popup.css | 41 ++++++++++++- js/popup.js | 157 ++++++++++++++++++++++++++++++++++++-------------- popup.html | 24 +++++++- 3 files changed, 176 insertions(+), 46 deletions(-) diff --git a/css/popup.css b/css/popup.css index 4507d85b..8fde24d8 100644 --- a/css/popup.css +++ b/css/popup.css @@ -26,14 +26,17 @@ body { } .settingsbut { + margin-right: 0px; + border: 0px +} + +.settings { position: absolute; bottom: 0; right: 0; float: right; margin-right: 5px; - border: 0px } - .matbut { border: none; outline: none; @@ -88,6 +91,40 @@ body { transform-origin: 50% 50%; } +.modal { + display: none; + position: fixed; + z-index: 1; + padding-top: 100px; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: rgb(0, 0, 0); + background-color: rgba(0, 0, 0, 0.4); +} + +.modal-content { + background-color: #fefefe; + margin: auto; + max-height: 85%; + overflow-y: auto; + padding: 20px; + border: 1px solid #888; + width: 50%; +} + +/* The Close Button */ + +.close { + color: #aaaaaa; + float: right; + padding: 5px; + font-size: 28px; + font-weight: bold; +} + + @keyframes ripple { 0% { transform: scale(0, 0); diff --git a/js/popup.js b/js/popup.js index 6a9ebb8e..56eb7960 100644 --- a/js/popup.js +++ b/js/popup.js @@ -1,50 +1,45 @@ var courses; // get the courses from storage -chrome.storage.sync.get('savedCourses', function (data) { - //find, build, and show the messages for the conflicts in the saved courses - chrome.runtime.sendMessage({ - command: "checkConflicts" - }, function (response) { - var isConflicted = []; - if (response.isConflict) { - var between = response.between; - var text = ""; - for (var i = 0; i < between.length; i++) { - text += "CONFLICT: " + getSimpleName(between[i][0].coursename, between[i][0].unique) + " and " + getSimpleName(between[i][1].coursename, between[i][1].unique); - isConflicted.push(between[i][0].unique); - isConflicted.push(between[i][1].unique); - if (i != between.length - 1) { - text += "
"; - } + +setCourseList(); + + // var modhtml = ''; + // $("#html").prepend(modhtml); + +function setCourseList(){ + $("#courseList").empty() + chrome.storage.sync.get('savedCourses', function (data) { + updateConflicts(); + courses = data.savedCourses + if (courses.length != 0) { + $("#empty").hide(); + $("#courseList").show(); + + } else{ + $("#empty").show(); + } + // build and append the course list element + for (var i = 0; i < courses.length; i++) { + var color; + status = courses[i].status; + if (status.includes("open")) { + color = "#4CAF50"; + } else if (status.includes("waitlisted")) { + color = "#FF9800" + } else if (status.includes("closed") || status.includes("cancelled")) { + color = "#FF5722"; } - $("#courseList").prepend("

" + text + ""); + var department = courses[i].coursename.substring(0, courses[i].coursename.search(/\d/) - 2); + var course_nbr = courses[i].coursename.substring(courses[i].coursename.search(/\d/), courses[i].coursename.indexOf(" ", courses[i].coursename.search(/\d/))); + var profname = prettifyName(courses[i].profname); + if (profname == "") { + profname = "Undecided Professor"; + } + var listhtml = "

  • " + department + " " + course_nbr + "" + " with " + profname + " (" + courses[i].unique + ")" + "

  • "; + $("#courseList").append(listhtml); } }); - courses = data.savedCourses; - if (courses.length != 0) { - $("#empty").hide(); - } - // build and append the course list element - for (var i = 0; i < courses.length; i++) { - var color; - status = courses[i].status; - if (status.includes("open")) { - color = "#4CAF50"; - } else if (status.includes("waitlisted")) { - color = "#FF9800" - } else if (status.includes("closed") || status.includes("cancelled")) { - color = "#FF5722"; - } - var department = courses[i].coursename.substring(0, courses[i].coursename.search(/\d/) - 2); - var course_nbr = courses[i].coursename.substring(courses[i].coursename.search(/\d/), courses[i].coursename.indexOf(" ", courses[i].coursename.search(/\d/))); - var profname = prettifyName(courses[i].profname); - if (profname == "") { - profname = "Undecided Professor"; - } - var listhtml = "
  • " + department + " " + course_nbr + "" + " with " + profname + " (" + courses[i].unique + ")" + "

  • "; - $("#courseList").append(listhtml); - } -}); +} /* prettify the name for the conflict messages*/ function getSimpleName(coursename, unique) { @@ -84,7 +79,7 @@ function updateConflicts() { /* Handle the button clicks */ $(document).ready(function () { - $("#courseList li").click(function () { + $("#courseList").on('click', 'li', function () { $(this).find("#listMoreInfo").click(function () { window.open(courses[$(this).closest("li").attr("id")].link); }); @@ -153,6 +148,41 @@ $(document).ready(function () { 'url': 'https://registrar.utexas.edu/schedules' }); }); + + $("#impexp").click(function(){ + if($("#impexp>i").text() == 'close'){ + $(".settings").find('#import').remove(); + $(".settings").find('#export').remove(); + $("#impexp>i").text('import_export'); + } else{ + $("#impexp>i").text('close'); + $(".settings").prepend(` + + + `); + } + }) + $(".settings").on('click', '#import', function () { + $("#importOrig").click(); + }); + $(".settings").on('click', '#export',function () { + chrome.storage.sync.get('savedCourses', function (data) { + var exportArray = JSON.stringify(data.savedCourses, null, 4); + var exportlink = document.createElement('a'); + var url = window.URL.createObjectURL(new Blob([exportArray], {type: "octet/stream"})); + exportlink.setAttribute('href', url); + exportlink.setAttribute('download', 'my_courses.json' ); + exportlink.click(); + }); + }); $("#open").click(function () { chrome.tabs.create({ 'url': "options.html" @@ -165,6 +195,46 @@ $(document).ready(function () { }); }); +$("#importOrig").change(function(e){ + var files = e.target.files; + var reader = new FileReader(); + reader.onload = function(){ + try{ + var impCourses = JSON.parse(this.result); + console.log(impCourses); + if(impCourses && impCourses.length && (impCourses.length == 0 || validateObject(impCourses))){ + chrome.storage.sync.set({ + savedCourses: impCourses + }); + chrome.tabs.query({}, function (tabs) { + for (var i = 0; i < tabs.length; i++) { + chrome.tabs.sendMessage(tabs[i].id, { + command: "updateCourseList" + }); + } + }); + setCourseList(impCourses); + } + } catch(err){ + + } + importOrig.value = ''; //make sure to clear input value after every import + } + reader.readAsText(files[0]); +}); + +function validateObject(impCourses){ + for(var i = 0; i(No Courses Saved)
    - + + + + + + From 0a327de5f9605dc37754b5eb9954c48690e7d318 Mon Sep 17 00:00:00 2001 From: sghsri Date: Tue, 11 Dec 2018 19:42:07 -0600 Subject: [PATCH 006/131] can export calendar into ics file, still having issues with mac recurring --- calendar.html | 4 +++ js/background.js | 29 ++++++++++++-------- js/calendar.js | 71 +++++++++++++++++++++++++++++------------------- 3 files changed, 65 insertions(+), 39 deletions(-) diff --git a/calendar.html b/calendar.html index 9b32b2b9..c3acf920 100644 --- a/calendar.html +++ b/calendar.html @@ -10,7 +10,11 @@
    + + + + \ No newline at end of file diff --git a/js/background.js b/js/background.js index b80ea0f9..c8c44d96 100644 --- a/js/background.js +++ b/js/background.js @@ -41,18 +41,25 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) { /* Initially set the course data in storage */ chrome.runtime.onInstalled.addListener(function (details) { - if (details.reason == "install" || details.reason == "update") { - var arr = new Array(); - chrome.storage.sync.set({ - savedCourses: arr - }, function () { - console.log('initial course list'); - }); - chrome.storage.sync.set({ - courseConflictHighlight: true - }, function () { - console.log('initial highlighting: true'); + if (details.reason == "install") { + chrome.storage.sync.get('savedCourses', function(data){ + if(!data.savedCourses){ + console.log(data.savedCourses); + var arr = new Array(); + chrome.storage.sync.set({ + savedCourses: arr + }, function () { + console.log('initial course list'); + }); + chrome.storage.sync.set({ + courseConflictHighlight: true + }, function () { + console.log('initial highlighting: true'); + }); + } }); + } else if(details.reason == "update"){ + console.log("updated"); } }); diff --git a/js/calendar.js b/js/calendar.js index 80aab49b..4ac960a3 100644 --- a/js/calendar.js +++ b/js/calendar.js @@ -74,34 +74,7 @@ $(function () { } else { $("#register").text("Register").css("background-color", "#4CAF50"); } - var cal = ics(); - for (i in savedCourses) { - let course = savedCourses[i]; - var dtmap = makeMap(course.datetimearr); - var timearr = Array.from(dtmap.keys()); - var dayarr = Array.from(dtmap.values()); - console.log(timearr); - console.log(dayarr); - for (var i = 0; i < dayarr.length; i++) { - var place = findLoc(dayarr[i], timearr[i], course.datetimearr); - var building = place.substring(0, place.search(/\d/) - 1); - if (building == "") { - building = "Undecided Location"; - } - //cal.addEvent(subject, description, location, begin, end, rrule) - let rrurle = { - freq: "WEEKLY", - interval: 1, - byday: [""] - - } - // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); - // output += `

    ${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

    `; - } - - } - cal.download(); } }); }); @@ -145,6 +118,47 @@ $(function () { } }); + $("#export").click(function(){ + var cal = ics(); + var calendarEvents = $('#calendar').fullCalendar('clientEvents'); + console.log(calendarEvents); + for(i in calendarEvents){ + let event = calendarEvents[i]; + var title = event.title; + var classname = title.substring(0, title.indexOf('with')); + var description = title.substring(title.indexOf('with')); + var time = event.start._d.toUTCString(); + console.log(event.start._i); + let rrule = { + freq: "WEEKLY", + interval: 1, + byday: [time.substring(0, time.indexOf(",")-1).toUpperCase()] + } + cal.addEvent(classname, description, event.building, event.start._i, event.end._i, rrule); + } + // for (i in savedCourses) { + // let course = savedCourses[i]; + // var dtmap = makeMap(course.datetimearr); + // var timearr = Array.from(dtmap.keys()); + // var dayarr = Array.from(dtmap.values()); + // console.log(timearr); + // console.log(dayarr); + // for (var i = 0; i < dayarr.length; i++) { + // var place = findLoc(dayarr[i], timearr[i], course.datetimearr); + // var building = place.substring(0, place.search(/\d/) - 1); + // if (building == "") { + // building = "Undecided Location"; + + // } + // //cal.addEvent(subject, description, location, begin, end, rrule) + // cal.addEvent(course.coursename, `with${course.profname}`, building, '', '', ''); + // // output += `

    ${dayarr[i]}: ${timearr[i].split(",")[0]} to ${timearr[i].split(",")[1]}${place}

    `; + // } + + // } + cal.download(); + }); + /* convert from the dtarr and maek the time lines*/ function makeLine(datetimearr) { $(".time").remove(); @@ -239,13 +253,13 @@ $(function () { // console.log(moment().day(fullday)); var fullday = days.get(session[0]); var classInfo = savedCourses[i]; + console.log(session); var department = classInfo.coursename.substring(0, classInfo.coursename.search(/\d/) - 2); var course_nbr = classInfo.coursename.substring(classInfo.coursename.search(/\d/), classInfo.coursename.indexOf(" ", classInfo.coursename.search(/\d/))); var uncapProf = prettifyName(classInfo.profname); if (uncapProf == "") { uncapProf = "Undecided"; } - var year = moment().day(fullday)._d.toString().split(" ")[3]; var monthNum = moment(moment().day(fullday)._d.toString().split(" ")[1], "MMM").format('MM'); var beg = `${year}-${monthNum}-`; @@ -268,6 +282,7 @@ $(function () { session[1][1] + ":00", color: materialColors[colorCounter], + building: session[2], index: i, allday: false }); From adad33c7ba072a0e779a99362a9273f0e0c9cca5 Mon Sep 17 00:00:00 2001 From: sghsri Date: Tue, 11 Dec 2018 21:16:47 -0600 Subject: [PATCH 007/131] fixed flags page icons --- js/content.js | 24 +++++++++++++----------- popup.html | 13 ++----------- todo | 10 +++++----- 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/js/content.js b/js/content.js index 9751b1f9..8aa86c43 100644 --- a/js/content.js +++ b/js/content.js @@ -31,17 +31,19 @@ const butdelay = 75; $(function () { loadDataBase(); //make heading and modal - $("table thead th:last-child").after('Plus'); - var modhtml = '