hour metric on popup, cleaning up utplanner/removing adding from it (because of status)
This commit is contained in:
@@ -118,7 +118,7 @@ i {
|
|||||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12);
|
||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
padding: 7px 5px 5px 7px;
|
padding: 7px 5px 5px 7px;
|
||||||
margin: 0px 10px 0px 0px;
|
margin: 0px 5px 0px 0px;
|
||||||
border-radius: 7px;
|
border-radius: 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,3 +393,24 @@ input[type=number]::-webkit-outer-spin-button {
|
|||||||
.hide {
|
.hide {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.meta{
|
||||||
|
margin:0;
|
||||||
|
color:#FF9800;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0px;
|
||||||
|
left: 0px;
|
||||||
|
vertical-align: middle;
|
||||||
|
padding: 7px 5px 5px 7px;
|
||||||
|
margin: 0px 5px 0px 5px;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-metric{
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-container{
|
||||||
|
margin: 5px 5px 10px 5px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Template {
|
|||||||
<button class=matbut id="moreInfo" style="background: #2196F3;"> More Info </button>
|
<button class=matbut id="moreInfo" style="background: #2196F3;"> More Info </button>
|
||||||
<button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button>
|
<button class=matbut id="textbook" style="background: #FFC107;"> Textbook </button>
|
||||||
<button class=matbut id="Syllabi"> Past Syllabi </button>
|
<button class=matbut id="Syllabi"> Past Syllabi </button>
|
||||||
<button class=matbut id="saveCourse" value="add" style="background: #F44336;"> Save Course +</button>
|
<button class=matbut id="saveCourse" value="add" style="background: #F44336;opacity:.4;"> Unable to Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ $("#calendar").after(Template.Calendar.modal());
|
|||||||
chrome.storage.sync.get("savedCourses", function (data) {
|
chrome.storage.sync.get("savedCourses", function (data) {
|
||||||
// Iterate through each saved course and add to 'event'
|
// Iterate through each saved course and add to 'event'
|
||||||
saved_courses = data.savedCourses;
|
saved_courses = data.savedCourses;
|
||||||
|
console.log(saved_courses);
|
||||||
let event_source = buildEventSource(saved_courses);
|
let event_source = buildEventSource(saved_courses);
|
||||||
|
|
||||||
$("#calendar").fullCalendar({
|
$("#calendar").fullCalendar({
|
||||||
|
|||||||
@@ -14,10 +14,14 @@ class Colors {
|
|||||||
static open = "#4CAF50";
|
static open = "#4CAF50";
|
||||||
static waitlisted = "#FF9800";
|
static waitlisted = "#FF9800";
|
||||||
static closed = "#FF5722";
|
static closed = "#FF5722";
|
||||||
|
static no_status = "#607D8B";
|
||||||
|
|
||||||
|
|
||||||
static open_light = "#C8E6C9";
|
static open_light = "#C8E6C9";
|
||||||
static waitlisted_light = "#FFE0B2";
|
static waitlisted_light = "#FFE0B2";
|
||||||
static closed_light = "#FFCCBC";
|
static closed_light = "#FFCCBC";
|
||||||
|
static no_status_light = "#CFD8DC";
|
||||||
|
|
||||||
|
|
||||||
static highlight_conflict = "#F44336";
|
static highlight_conflict = "#F44336";
|
||||||
static highlight_default = "#333333";
|
static highlight_default = "#333333";
|
||||||
|
|||||||
@@ -337,11 +337,11 @@ function openDialog(course_info, res) {
|
|||||||
command: "alreadyContains",
|
command: "alreadyContains",
|
||||||
unique: course_info["unique"]
|
unique: course_info["unique"]
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
if (response.alreadyContains) {
|
|
||||||
$("#saveCourse").text("Remove Course -");
|
let button_text = response.alreadyContains ? "Remove Course -" : "Add Course +";
|
||||||
} else {
|
let button_val = response.alreadyContains ? "remove" : "add";
|
||||||
$("#saveCourse").text("Add Course +");
|
$("#saveCourse").text(button_text);
|
||||||
}
|
$("#saveCourse").val(button_val);
|
||||||
});
|
});
|
||||||
buildSemestersDropdown(course_info, res)
|
buildSemestersDropdown(course_info, res)
|
||||||
var data = []
|
var data = []
|
||||||
|
|||||||
31
js/popup.js
31
js/popup.js
@@ -11,6 +11,7 @@ function setCourseList() {
|
|||||||
updateConflicts();
|
updateConflicts();
|
||||||
courses = data.savedCourses
|
courses = data.savedCourses
|
||||||
handleEmpty();
|
handleEmpty();
|
||||||
|
let num_hours = 0;
|
||||||
// build and append the course list element
|
// build and append the course list element
|
||||||
for (var i = 0; i < courses.length; i++) {
|
for (var i = 0; i < courses.length; i++) {
|
||||||
let {
|
let {
|
||||||
@@ -28,10 +29,12 @@ function setCourseList() {
|
|||||||
department,
|
department,
|
||||||
number
|
number
|
||||||
} = seperateCourseNameParts(coursename)
|
} = seperateCourseNameParts(coursename)
|
||||||
|
num_hours += parseInt(number.substring(0,1));
|
||||||
|
|
||||||
let list_html = Template.Popup.list_item(i, list_tile_color, unique, department, number, profname, list_sub_color, line);
|
let list_html = Template.Popup.list_item(i, list_tile_color, unique, department, number, profname, list_sub_color, line);
|
||||||
$("#courseList").append(list_html);
|
$("#courseList").append(list_html);
|
||||||
}
|
}
|
||||||
|
$("#meta-metric").text(num_hours);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,6 +142,7 @@ $("#search").click(function () {
|
|||||||
|
|
||||||
$('#import-class').click(function () {
|
$('#import-class').click(function () {
|
||||||
$("#import_input").click();
|
$("#import_input").click();
|
||||||
|
console.log('back to improting');
|
||||||
});
|
});
|
||||||
|
|
||||||
function isImportedValid(imported_courses) {
|
function isImportedValid(imported_courses) {
|
||||||
@@ -146,6 +150,7 @@ function isImportedValid(imported_courses) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$("#import_input").change(function (e) {
|
$("#import_input").change(function (e) {
|
||||||
|
console.log('hello');
|
||||||
var files = e.target.files;
|
var files = e.target.files;
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onload = function () {
|
reader.onload = function () {
|
||||||
@@ -158,6 +163,7 @@ $("#import_input").change(function (e) {
|
|||||||
updateAllTabsCourseList();
|
updateAllTabsCourseList();
|
||||||
setCourseList();
|
setCourseList();
|
||||||
hideImportExportPopup();
|
hideImportExportPopup();
|
||||||
|
$("#import_input").val('');
|
||||||
} else {
|
} else {
|
||||||
Alert('There was an error.');
|
Alert('There was an error.');
|
||||||
}
|
}
|
||||||
@@ -219,13 +225,6 @@ $("#options_button").click(function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#courseList").on('mouseover', '.copybut', function () {
|
$("#courseList").on('mouseover', '.copybut', function () {
|
||||||
$(this).addClass('shadow');
|
$(this).addClass('shadow');
|
||||||
}).on('mouseleave', '.copybut', function () {
|
}).on('mouseleave', '.copybut', function () {
|
||||||
@@ -264,11 +263,16 @@ function handleRegister(clicked_item, curr_course) {
|
|||||||
} = curr_course;
|
} = curr_course;
|
||||||
let register_button = $(clicked_item).find("#register");
|
let register_button = $(clicked_item).find("#register");
|
||||||
let can_not_register = canNotRegister(status, registerlink);
|
let can_not_register = canNotRegister(status, registerlink);
|
||||||
|
|
||||||
let register_text = can_not_register ? "Can't Register" :
|
let register_text = can_not_register ? "Can't Register" :
|
||||||
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;
|
||||||
|
|
||||||
|
if(!status){
|
||||||
|
register_text = "No Status";
|
||||||
|
register_color = Colors.no_status;
|
||||||
|
}
|
||||||
|
|
||||||
$(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) {
|
||||||
@@ -286,6 +290,7 @@ function handleRemove(clicked_item, curr_course) {
|
|||||||
$(list).find("#conflict").fadeOut(300, function () {
|
$(list).find("#conflict").fadeOut(300, function () {
|
||||||
$(clicked_item).remove();
|
$(clicked_item).remove();
|
||||||
});
|
});
|
||||||
|
subtractHours(curr_course);
|
||||||
chrome.runtime.sendMessage({
|
chrome.runtime.sendMessage({
|
||||||
command: "courseStorage",
|
command: "courseStorage",
|
||||||
course: curr_course,
|
course: curr_course,
|
||||||
@@ -302,6 +307,15 @@ function handleRemove(clicked_item, curr_course) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function subtractHours(curr_course){
|
||||||
|
let curr_total_hours = parseInt($("#meta-metric").text());
|
||||||
|
let curr_course_number = seperateCourseNameParts(curr_course.coursename).number;
|
||||||
|
let curr_individual_hours = parseInt(curr_course_number.substring(0,1));
|
||||||
|
$("#meta-metric").text(curr_total_hours-curr_individual_hours);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function handleMoreInfo(clicked_item, curr_course) {
|
function handleMoreInfo(clicked_item, curr_course) {
|
||||||
$(clicked_item).find("#listMoreInfo").click(function () {
|
$(clicked_item).find("#listMoreInfo").click(function () {
|
||||||
window.open(curr_course.link);
|
window.open(curr_course.link);
|
||||||
@@ -348,6 +362,7 @@ function showEmpty() {
|
|||||||
$("#courseList").hide();
|
$("#courseList").hide();
|
||||||
$("#empty").fadeIn(200);
|
$("#empty").fadeIn(200);
|
||||||
$("#main").html(Text.emptyText());
|
$("#main").html(Text.emptyText());
|
||||||
|
$("#meta-metric").text('0');
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideSearchPopup() {
|
function hideSearchPopup() {
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ function getStatusColor(status, sub = false) {
|
|||||||
color = sub ? Colors.waitlisted_light : Colors.waitlisted;
|
color = sub ? Colors.waitlisted_light : Colors.waitlisted;
|
||||||
} else if (status.includes("closed") || status.includes("cancelled")) {
|
} else if (status.includes("closed") || status.includes("cancelled")) {
|
||||||
color = sub ? Colors.closed_light : Colors.closed;
|
color = sub ? Colors.closed_light : Colors.closed;
|
||||||
|
} else {
|
||||||
|
color = sub ? Colors.no_status_light : Colors.no_status;
|
||||||
}
|
}
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,12 @@ chrome.runtime.sendMessage({
|
|||||||
semester_code = response.semesters[key];
|
semester_code = response.semesters[key];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if ($('html').hasClass('gr__utexas_collegescheduler_com')) {
|
|
||||||
$.initialize("table.section-detail-grid", function () {
|
$.initialize("table.section-detail-grid", function () {
|
||||||
$(this).find('thead>tr').append('<th> Plus</th')
|
$(this).find('thead>tr').append('<th> Plus</th')
|
||||||
$(this).find('tbody>tr').each(function () {
|
$(this).find('tbody>tr').each(function () {
|
||||||
$(this).append(Template.Main.extension_button());
|
$(this).append(Template.Main.extension_button());
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
$("body").prepend(Template.UTPlanner.modal());
|
$("body").prepend(Template.UTPlanner.modal());
|
||||||
$("body").on('click', '#distButton', function () {
|
$("body").on('click', '#distButton', function () {
|
||||||
@@ -101,13 +98,6 @@ $("#moreInfo").click(function () {
|
|||||||
}, Timing.button_delay);
|
}, Timing.button_delay);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#myModal").on('click', '#saveCourse', function () {
|
|
||||||
setTimeout(function () {
|
|
||||||
saveCourse();
|
|
||||||
}, 0);
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function toggleChartLoading(loading) {
|
function toggleChartLoading(loading) {
|
||||||
if (loading) {
|
if (loading) {
|
||||||
@@ -229,47 +219,6 @@ function standardizeName(department, number, name){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveCourse() {
|
|
||||||
let {
|
|
||||||
department, name, number, prof_name, times, unique, individual
|
|
||||||
} = curr_course;
|
|
||||||
let dtarr = makeDateTimeArray(times);
|
|
||||||
let full_name = standardizeName(department, number, name);
|
|
||||||
var c = new Course(full_name, unique, prof_name, dtarr, "open", individual, "");
|
|
||||||
console.log(c);
|
|
||||||
chrome.runtime.sendMessage({
|
|
||||||
command: "courseStorage",
|
|
||||||
course: c,
|
|
||||||
action: $("#saveCourse").val()
|
|
||||||
}, function (response) {
|
|
||||||
$("#saveCourse").text(response.label);
|
|
||||||
$("#saveCourse").val(response.value);
|
|
||||||
$("#snackbar").text(response.done);
|
|
||||||
toggleSnackbar();
|
|
||||||
chrome.runtime.sendMessage({
|
|
||||||
command: "updateCourseList"
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function makeDateTimeArray(times){
|
|
||||||
let dtarr = [];
|
|
||||||
times.forEach(function(session){
|
|
||||||
date = session.substring(0, session.indexOf(' ')).toUpperCase();
|
|
||||||
time = session.substring(session.indexOf(' ') + 1, session.lastIndexOf('-')).trim().split(' - ');
|
|
||||||
place = session.substring(session.lastIndexOf('-') + 1).trim();
|
|
||||||
timearr = [];
|
|
||||||
time.forEach(function(ind_time){
|
|
||||||
timearr.push(moment(ind_time, ["h:mma"]).format("h:mm A"))
|
|
||||||
})
|
|
||||||
seperateDays(date, true).forEach(function(ind_day){
|
|
||||||
dtarr.push([ind_day, timearr, place]);
|
|
||||||
})
|
|
||||||
});
|
|
||||||
return dtarr;
|
|
||||||
}
|
|
||||||
|
|
||||||
function allowClosing() {
|
function allowClosing() {
|
||||||
$('.close').click(function () {
|
$('.close').click(function () {
|
||||||
close();
|
close();
|
||||||
|
|||||||
14
popup.html
14
popup.html
@@ -31,8 +31,11 @@
|
|||||||
<div style="margin-bottom: 0px; display:inline-block"></div>
|
<div style="margin-bottom: 0px; display:inline-block"></div>
|
||||||
<input type="file" id="import_input" accept=".json" style="display:none" />
|
<input type="file" id="import_input" accept=".json" style="display:none" />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div id="meta-data" class="meta-container">
|
||||||
|
<p class="meta"> <span class="meta-metric" id="meta-metric">17</span> hr</p>
|
||||||
|
</div>
|
||||||
<div class="settings">
|
<div class="settings">
|
||||||
|
|
||||||
<button title='Search' style="background-color:white;margin-left: 5px;margin-right: 3px;" class="settingsbut"
|
<button title='Search' style="background-color:white;margin-left: 5px;margin-right: 3px;" class="settingsbut"
|
||||||
id='search'>
|
id='search'>
|
||||||
<i style='color:#FF9800' class="material-icons">
|
<i style='color:#FF9800' class="material-icons">
|
||||||
@@ -42,18 +45,14 @@
|
|||||||
|
|
||||||
<div id="search-popup" class="hide">
|
<div id="search-popup" class="hide">
|
||||||
<div class="flex-container">
|
<div class="flex-container">
|
||||||
|
|
||||||
<div id='semcon' class="select-style item">
|
<div id='semcon' class="select-style item">
|
||||||
<label>
|
<label>
|
||||||
<select id="semesters"></select>
|
<select id="semesters"></select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="text" id="class_id_input" class="item" name="class_id" maxlength="5"
|
<input type="text" id="class_id_input" class="item" name="class_id" maxlength="5"
|
||||||
placeholder="Course ID #"></input>
|
placeholder="Course ID #"></input>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button id="search-class" class="matbut">Search</button>
|
<button id="search-class" class="matbut">Search</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -78,8 +77,9 @@
|
|||||||
id='options_button'>
|
id='options_button'>
|
||||||
<i style='color:#FF9800' class="material-icons">
|
<i style='color:#FF9800' class="material-icons">
|
||||||
settings
|
settings
|
||||||
</i></button>
|
</i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user