polishing
This commit is contained in:
@@ -127,9 +127,11 @@ $(function () {
|
||||
var classname = title.substring(0, title.indexOf('with'));
|
||||
var description = title.substring(title.indexOf('with'));
|
||||
var time = event.start._d.toUTCString();
|
||||
cal.addEvent(classname, description, event.building, event.start._i, event.end._i, {rrule: `RRULE:FREQ=WEEKLY;BYDAY=${time.substring(0, time.indexOf(",")-1).toUpperCase()};INTERVAL=1`});
|
||||
cal.addEvent(classname, description, event.building, event.start._i, event.end._i, {
|
||||
rrule: `RRULE:FREQ=WEEKLY;BYDAY=${time.substring(0, time.indexOf(",")-1).toUpperCase()};INTERVAL=1`
|
||||
});
|
||||
}
|
||||
cal.download("My_Calendar");
|
||||
cal.download("My_Course_Calendar");
|
||||
});
|
||||
|
||||
/* convert from the dtarr and maek the time lines*/
|
||||
|
||||
36
js/popup.js
36
js/popup.js
@@ -7,7 +7,6 @@ setCourseList();
|
||||
// $("#html").prepend(modhtml);
|
||||
getSemesters();
|
||||
|
||||
|
||||
function setCourseList() {
|
||||
$("#courseList").empty()
|
||||
chrome.storage.sync.get('savedCourses', function (data) {
|
||||
@@ -37,7 +36,24 @@ function setCourseList() {
|
||||
if (profname == "") {
|
||||
profname = "Undecided Professor";
|
||||
}
|
||||
var listhtml = "<li id='" + i + "'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'><div class='card'><div class='container' style='background:" + color + "''><h4 class='truncate' style='color:white;margin:5px; display:inline-block;font-size:large;'><b>" + department + " " + course_nbr + "<span style='font-size:medium'>" + " with </span><span style='font-size:medium'>" + profname + " (" + courses[i].unique + ")" + "</span></b></h4><p id='arrow' style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;'>►</p></div></div><div id='moreInfo' style='display: none;'><p style='font-weight:bold;padding:10px;margin:0px 5px 0px 15px;font-size:small;background-color:#FFCDD2;'>" + makeLine(i) + "</p><div id='infoButtons' style='border-radius:0px;'><button class='matbut' id='listRemove'style='float:right;background:#F44336; margin:5px;'>Remove</button><button class='matbut' id='register' style='float:right;background:#4CAF50; margin:5px;'>Register</button><button class='matbut' id='listMoreInfo' style='float:right;background:#2196F3; margin:5px;'>More Info</button></div></div></li>";
|
||||
var listhtml = `<li id='${i}'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'>
|
||||
<div class='card'>
|
||||
<div class='container' style='background:${color}'>
|
||||
<h4 class='truncate' style='color:white;margin:5px; display:inline-block;font-size:large;'>
|
||||
<b>${department} ${course_nbr} <span style='font-size:medium'> with </span><span style='font-size:medium'>${profname} (${courses[i].unique})</span></b>
|
||||
</h4>
|
||||
<p id='arrow' style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;'>►</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='moreInfo' style='display: none;'>
|
||||
<p style='font-weight:bold;padding:10px;margin:0px 5px 0px 15px;font-size:small;background-color:#FFCDD2;'>${makeLine(i)}</p>
|
||||
<div id='infoButtons' style='border-radius:0px;'>
|
||||
<button class='matbut' id='listRemove'style='float:right;background:#F44336; margin:5px;'>Remove</button>
|
||||
<button class='matbut' id='register' style='float:right;background:#4CAF50; margin:5px;'>Register</button>
|
||||
<button class='matbut' id='listMoreInfo' style='float:right;background:#2196F3; margin:5px;'>More Info</button>
|
||||
</div>
|
||||
</div>
|
||||
</li>`;
|
||||
$("#courseList").append(listhtml);
|
||||
}
|
||||
});
|
||||
@@ -193,14 +209,17 @@ $(document).ready(function () {
|
||||
});
|
||||
$('#export').click(function () {
|
||||
chrome.storage.sync.get('savedCourses', function (data) {
|
||||
var exportArray = JSON.stringify(data.savedCourses, null, 4);
|
||||
if (data.savedCourses.length > 0) {
|
||||
var exportlink = document.createElement('a');
|
||||
var url = window.URL.createObjectURL(new Blob([exportArray], {
|
||||
var url = window.URL.createObjectURL(new Blob([JSON.stringify(data.savedCourses, null, 4)], {
|
||||
type: "octet/stream"
|
||||
}));
|
||||
exportlink.setAttribute('href', url);
|
||||
exportlink.setAttribute('download', 'my_courses.json');
|
||||
exportlink.click();
|
||||
} else {
|
||||
alert('You have no Saved Courses to export.');
|
||||
}
|
||||
});
|
||||
});
|
||||
$("#class_id").on("keyup", function (e) {
|
||||
@@ -251,7 +270,7 @@ $("#importOrig").change(function (e) {
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
importOrig.value = ''; //make sure to clear input value after every import
|
||||
importOrig.value = '';
|
||||
}
|
||||
reader.readAsText(files[0]);
|
||||
});
|
||||
@@ -402,6 +421,10 @@ function getInfo(sem, unique) {
|
||||
if (response) {
|
||||
var output = "";
|
||||
var object = $('<div/>').html(response).contents();
|
||||
console.log(object.find('.error').text());
|
||||
if (object.find('.error').text().trim() == 'No class was found for your input.') {
|
||||
alert(`Could not find a course with unique number: ${unique}`);
|
||||
} else {
|
||||
var c = getCourseObject(object, link);
|
||||
console.log(c);
|
||||
if (c.coursename) {
|
||||
@@ -416,7 +439,8 @@ function getInfo(sem, unique) {
|
||||
setCourseList();
|
||||
});
|
||||
} else {
|
||||
alert("There Was An Error.")
|
||||
alert("There Was An Error. Please check if you are logged into the UT Course Schedule.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
Off</button>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<p style="padding:0px 5px 5px 0px; float: right">(v<span id="version"></span>), Sriram Hariharan, 2018<p>
|
||||
<script src="js/jquery-3.3.1.min.js"></script>
|
||||
<script src="js/options.js"></script>
|
||||
|
||||
16
popup.html
16
popup.html
@@ -31,25 +31,25 @@
|
||||
<select id="semesters" style="display: none;margin-right: 5px; border-color: #ff691a; margin-top: 3px;">
|
||||
</select>
|
||||
</div>
|
||||
<input type="text" id="class_id" name="class_id" maxlength="5"
|
||||
style="display:none;text-indent: 10px;border-style: solid; border-color:#ff691a;" placeholder="Unique #?"></input>
|
||||
<input type="text" id="class_id" name="class_id" maxlength="5" style="display:none;text-indent: 10px;border-style: solid; border-color:#ff691a;"
|
||||
placeholder="Unique #?"></input>
|
||||
|
||||
<button title='Search' style="background-color:white;" class="settingsbut" id='search'>
|
||||
<i style='color:#FF9800' class="material-icons">
|
||||
search
|
||||
</i>
|
||||
</button>
|
||||
|
||||
<button title='Import' style="background-color:white; display:none;" class="settingsbut" id='import'>
|
||||
<i style='color:#ff691a'; class="material-icons">
|
||||
arrow_upward
|
||||
</i>
|
||||
</button>
|
||||
<button title='Export' style="background-color:white; display:none;" class="settingsbut" id='export'>
|
||||
<i style='color:#ff691a' class="material-icons">
|
||||
arrow_downward
|
||||
</i>
|
||||
</button>
|
||||
<button title='Import' style="background-color:white; display:none;" class="settingsbut" id='import'>
|
||||
<i style='color:#ff691a' ; class="material-icons">
|
||||
arrow_upward
|
||||
</i>
|
||||
</button>
|
||||
|
||||
<button title='Import/Export' style="background-color:white;" class="settingsbut" id='impexp'>
|
||||
<i style='color:#FF9800' class="material-icons">
|
||||
import_export
|
||||
|
||||
Reference in New Issue
Block a user