optimization

This commit is contained in:
Sriram Hariharan
2019-01-12 13:15:56 -06:00
parent 4590bfffa7
commit d45c2eecbe
2 changed files with 28 additions and 8 deletions

View File

@@ -154,7 +154,7 @@
opacity: 1; opacity: 1;
} }
20% { 15% {
transform: scale(25, 25); transform: scale(25, 25);
opacity: 1; opacity: 1;
} }

View File

@@ -115,7 +115,9 @@ $(window).scroll(function () {
}); });
$("#myModal").on('click', '#saveCourse', function () { $("#myModal").on('click', '#saveCourse', function () {
setTimeout(function () {
saveCourse(); saveCourse();
}, 0);
}); });
$("#Syllabi").click(function () { $("#Syllabi").click(function () {
@@ -243,6 +245,9 @@ function saveCourse() {
/* Update the course list to show if the row contains a course that conflicts with the saved course is one of the saved courses */ /* Update the course list to show if the row contains a course that conflicts with the saved course is one of the saved courses */
function update(start) { function update(start) {
chrome.storage.sync.get('courseConflictHighlight', function (data) { chrome.storage.sync.get('courseConflictHighlight', function (data) {
var red = 0;
var black = 0;
var green = 0;
$('table').find('tr').each(function (i) { $('table').find('tr').each(function (i) {
if (i >= start) { if (i >= start) {
if (!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0) { if (!($(this).find('td').hasClass("course_header")) && $(this).has('th').length == 0) {
@@ -254,18 +259,33 @@ function update(start) {
dtarr: getDtarr(this), dtarr: getDtarr(this),
unique: uniquenum unique: uniquenum
}, function (response) { }, function (response) {
if (response.isConflict && data.courseConflictHighlight) { var tds = $(thisForm).find('td');
$(thisForm).find('td').css('color', '#F44336').css('text-decoration', 'line-through').css('font-weight', 'normal'); // console.log(tds.css('color'));
} else { if (response.isConflict && data.courseConflictHighlight && !response.alreadyContains) {
$(thisForm).find('td').css('color', 'black').css('text-decoration', 'none').css('font-weight', 'normal'); if (tds.css('color') != 'rgb(244, 67, 54)') {
console.log('made red ' + uniquenum);
red++;
tds.css('color', '#F44336').css('text-decoration', 'line-through').css('font-weight', 'normal');
}
} else if (!response.alreadyContains) {
if (tds.css('color') != 'rgb(51, 51, 51)') {
console.log('made black ' + uniquenum);
black++;
tds.css('color', 'black').css('text-decoration', 'none').css('font-weight', 'normal');
}
} }
if (response.alreadyContains) { if (response.alreadyContains) {
$(thisForm).find('td').css('color', '#4CAF50').css('text-decoration', 'none').css('font-weight', 'bold'); if (tds.css('color') != 'rgb(76, 175, 80)') {
green++;
console.log('made green ' + uniquenum);
tds.css('color', '#4CAF50').css('text-decoration', 'none').css('font-weight', 'bold');
}
} }
}); });
} }
} }
}); });
//console.log(`red: ${red} black: ${black} green: ${green}`);
}); });
} }
@@ -665,7 +685,7 @@ function getDescription() {
data: "" data: ""
}, function (response) { }, function (response) {
if (response) { if (response) {
console.log(response); // console.log(response);
var output = ""; var output = "";
var object = $('<div/>').html(response).contents(); var object = $('<div/>').html(response).contents();
object.find('#details > p').each(function () { object.find('#details > p').each(function () {