bugfixes, copy paste unique
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
.container {
|
||||||
padding: 2px 16px;
|
padding: 2px 16px 2px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
@@ -32,6 +32,7 @@ body {
|
|||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.settingsbut:focus {
|
.settingsbut:focus {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
@@ -49,6 +50,33 @@ body {
|
|||||||
transition: 0.3s;
|
transition: 0.3s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.copybut {
|
||||||
|
background-color: transparent;
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px 3px 0px 0px;
|
||||||
|
border: none;
|
||||||
|
font-size: 15px;
|
||||||
|
border-radius: 50%;
|
||||||
|
transition: .2s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.copybut:focus {
|
||||||
|
outline: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.copybut:hover {
|
||||||
|
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.16), 0 4px 20px 0 rgba(0, 0, 0, 0.12);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#copyicon {
|
||||||
|
font-size: x-large;
|
||||||
|
border-radius: 50%;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ul {
|
ul {
|
||||||
margin-bottom: 30px;
|
margin-bottom: 30px;
|
||||||
}
|
}
|
||||||
@@ -191,6 +219,7 @@ i {
|
|||||||
animation: ripple 1s ease-out;
|
animation: ripple 1s ease-out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
input {
|
input {
|
||||||
width: 80px;
|
width: 80px;
|
||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
|||||||
checkConflicts(response);
|
checkConflicts(response);
|
||||||
break;
|
break;
|
||||||
case "updateStatus":
|
case "updateStatus":
|
||||||
updateStatus();
|
updateStatus(response);
|
||||||
break;
|
break;
|
||||||
case "getLine":
|
case "getLine":
|
||||||
getLine(request.dtarr, response);
|
getLine(request.dtarr, response);
|
||||||
@@ -41,6 +41,7 @@ chrome.runtime.onMessage.addListener(function (request, sender, response) {
|
|||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const method = request.method ? request.method.toUpperCase() : "GET";
|
const method = request.method ? request.method.toUpperCase() : "GET";
|
||||||
xhr.open(method, request.url, true);
|
xhr.open(method, request.url, true);
|
||||||
|
console.log(request);
|
||||||
xhr.onload = () => response(xhr.responseText);
|
xhr.onload = () => response(xhr.responseText);
|
||||||
xhr.onerror = () => response(xhr.statusText);
|
xhr.onerror = () => response(xhr.statusText);
|
||||||
if (method == "POST") {
|
if (method == "POST") {
|
||||||
@@ -246,15 +247,18 @@ function updateTabs() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const UPDATE_INTERVAL = 1000 * 60 * 15 // 15 mins
|
const UPDATE_INTERVAL = 1000 * 60; // 1 mins
|
||||||
setInterval(updateStatus, UPDATE_INTERVAL);
|
setInterval(updateStatus, UPDATE_INTERVAL);
|
||||||
|
|
||||||
function updateStatus() {
|
function updateStatus(sendResponse) {
|
||||||
chrome.storage.sync.get('savedCourses', function (data) {
|
chrome.storage.sync.get('savedCourses', function (data) {
|
||||||
var courses = data.savedCourses;
|
var courses = data.savedCourses;
|
||||||
|
var nochange = true;
|
||||||
for (let i = 0; i < courses.length; i++) {
|
for (let i = 0; i < courses.length; i++) {
|
||||||
try {
|
try {
|
||||||
let c = courses[i];
|
let c = courses[i];
|
||||||
|
let oldstatus = c.status;
|
||||||
|
let oldlink = c.registerlink;
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", c.link, false);
|
xhr.open("GET", c.link, false);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
@@ -266,15 +270,25 @@ function updateStatus() {
|
|||||||
if (registerlink) {
|
if (registerlink) {
|
||||||
registerlink = registerlink.getAttribute('href');
|
registerlink = registerlink.getAttribute('href');
|
||||||
}
|
}
|
||||||
|
var haschanged = (newstatus == oldstatus && registerlink == oldlink);
|
||||||
|
if (!haschanged) {
|
||||||
|
console.log(c.unique + 'updated from ' + oldstatus + " to " + newstatus + " and " + oldlink + " to " + registerlink);
|
||||||
|
}
|
||||||
|
nochange &= haschanged;
|
||||||
c.registerlink = registerlink;
|
c.registerlink = registerlink;
|
||||||
c.status = newstatus;
|
c.status = newstatus;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Not logged into UT Coursebook. Could not update class statuses.');
|
console.log('Not logged into UT Coursebook. Could not update class statuses.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
chrome.storage.sync.set({
|
if (!nochange) {
|
||||||
savedCourses: courses
|
chrome.storage.sync.set({
|
||||||
});
|
savedCourses: courses
|
||||||
|
});
|
||||||
|
console.log('updated status');
|
||||||
|
} else {
|
||||||
|
console.log('no change');
|
||||||
|
}
|
||||||
// console.log("updated status' and registerlinks");
|
// console.log("updated status' and registerlinks");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
41
js/popup.js
41
js/popup.js
@@ -40,7 +40,12 @@ function setCourseList() {
|
|||||||
var listhtml = `<li id='${i}'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'>
|
var listhtml = `<li id='${i}'style='padding: 0px 5px 5px 5px; overflow-y: auto;max-height:400px;'>
|
||||||
<div class='card'>
|
<div class='card'>
|
||||||
<div class='container' style='background:${color}'>
|
<div class='container' style='background:${color}'>
|
||||||
<h4 class='truncate' style='color:white;margin:5px; display:inline-block;font-size:large;'>
|
<button class='copybut' id='copybut' value='${courses[i].unique}'>
|
||||||
|
<i style='color:white;float:left;text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.16);font-size:x-large;' id='copyicon' class="material-icons copy">
|
||||||
|
content_copy
|
||||||
|
</i>
|
||||||
|
</button>
|
||||||
|
<h4 class='truncate' style='color:white;margin:5px; display:inline-block;font-size:large;align-items:center;'>
|
||||||
<b>${department} ${course_nbr} <span style='font-size:medium'> with <span style='font-size:medium'>${profname} (${courses[i].unique})</span></b>
|
<b>${department} ${course_nbr} <span style='font-size:medium'> with <span style='font-size:medium'>${profname} (${courses[i].unique})</span></b>
|
||||||
</h4>
|
</h4>
|
||||||
<p id='arrow' style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;font-family: sans-serif'>►</p>
|
<p id='arrow' style='float:right;font-size:small;display:inline-block;margin-top:10px;color:white;font-family: sans-serif'>►</p>
|
||||||
@@ -114,6 +119,22 @@ function updateConflicts() {
|
|||||||
|
|
||||||
/* Handle the button clicks */
|
/* Handle the button clicks */
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$('.copybut').click(function (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
var temp = $("<input>");
|
||||||
|
$(this).find('i').text('check');
|
||||||
|
$(this).find('i').css('box-shadow', 'none');
|
||||||
|
$(this).find('i').delay(200).queue(function (n) {
|
||||||
|
$(this).text('content_copy');
|
||||||
|
n();
|
||||||
|
})
|
||||||
|
|
||||||
|
$("body").append(temp);
|
||||||
|
temp.val($(this).val()).select();
|
||||||
|
document.execCommand("copy");
|
||||||
|
temp.remove();
|
||||||
|
});
|
||||||
$("#courseList").on('click', 'li', function () {
|
$("#courseList").on('click', 'li', function () {
|
||||||
$(this).find("#listMoreInfo").click(function () {
|
$(this).find("#listMoreInfo").click(function () {
|
||||||
window.open(courses[$(this).closest("li").attr("id")].link);
|
window.open(courses[$(this).closest("li").attr("id")].link);
|
||||||
@@ -139,6 +160,7 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
|
/* clear the conflict messages, then remove the course and updateConflicts. update the tabs*/
|
||||||
$(this).find("#listRemove").click(function () {
|
$(this).find("#listRemove").click(function () {
|
||||||
var thisForm = this;
|
var thisForm = this;
|
||||||
@@ -286,6 +308,9 @@ $("#importOrig").change(function (e) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
setCourseList();
|
setCourseList();
|
||||||
|
chrome.runtime.sendMessage({
|
||||||
|
command: "updateStatus",
|
||||||
|
});
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
@@ -399,12 +424,7 @@ function clear() {
|
|||||||
|
|
||||||
function getSemesters() {
|
function getSemesters() {
|
||||||
var schedulelist = 'https://registrar.utexas.edu/schedules';
|
var schedulelist = 'https://registrar.utexas.edu/schedules';
|
||||||
chrome.runtime.sendMessage({
|
$.get(schedulelist, function (response) {
|
||||||
method: "GET",
|
|
||||||
action: "xhttp",
|
|
||||||
url: schedulelist,
|
|
||||||
data: ""
|
|
||||||
}, function (response) {
|
|
||||||
if (response) {
|
if (response) {
|
||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
object.find('.callout2>ul>li>a').each(function (index) {
|
object.find('.callout2>ul>li>a').each(function (index) {
|
||||||
@@ -412,12 +432,7 @@ function getSemesters() {
|
|||||||
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];
|
||||||
$("#semesters").append(`<option>${semname}</option>`);
|
$("#semesters").append(`<option>${semname}</option>`);
|
||||||
chrome.runtime.sendMessage({
|
$.get($(this).attr('href'), function (response) {
|
||||||
method: "GET",
|
|
||||||
action: "xhttp",
|
|
||||||
url: $(this).attr('href'),
|
|
||||||
data: ""
|
|
||||||
}, function (response) {
|
|
||||||
if (response) {
|
if (response) {
|
||||||
var object = $('<div/>').html(response).contents();
|
var object = $('<div/>').html(response).contents();
|
||||||
var name = object.find(".page-title").text();
|
var name = object.find(".page-title").text();
|
||||||
|
|||||||
Reference in New Issue
Block a user