diff --git a/background.js b/background.js
index 5ed8b396..1390b093 100644
--- a/background.js
+++ b/background.js
@@ -38,7 +38,7 @@ function submitTimes(videoID) {
chrome.storage.local.get([sponsorTimeKey], function(result) {
let sponsorTimes = result[sponsorTimeKey];
- if (sponsorTimes != undefined && sponsorTimes != []) {
+ if (sponsorTimes != undefined && sponsorTimes.length > 0) {
//submit these times
for (let i = 0; i < sponsorTimes.length; i++) {
let xmlhttp = new XMLHttpRequest();
diff --git a/popup.html b/popup.html
index bbcd41c3..bcbc111a 100644
--- a/popup.html
+++ b/popup.html
@@ -23,26 +23,35 @@
+
+
Record the times of a sponsorship
+
+
+ Click the button below when the sponsorship starts and ends to record and
+ submit it to the database.
+
-
+
- Latest Sponsor Message Times Chosen
-
-
-
+
diff --git a/popup.js b/popup.js
index 64af7d50..43ce1ce8 100644
--- a/popup.js
+++ b/popup.js
@@ -46,7 +46,7 @@ function loadTabData(tabs) {
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
chrome.storage.local.get([sponsorTimeKey], function(result) {
let sponsorTimesStorage = result[sponsorTimeKey];
- if (sponsorTimesStorage != undefined && sponsorTimesStorage != []) {
+ if (sponsorTimesStorage != undefined && sponsorTimesStorage.length > 0) {
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
startTimeChosen = true;
}
@@ -54,6 +54,9 @@ function loadTabData(tabs) {
sponsorTimes = sponsorTimesStorage;
displaySponsorTimes();
+
+ //show submission section
+ document.getElementById("submissionSection").style.display = "unset";
}
});
@@ -124,14 +127,17 @@ chrome.runtime.onMessage.addListener(function (request, sender, callback) {
//update startTimeChosen variable
if (!startTimeChosen) {
startTimeChosen = true;
- document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends";
+ document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends Now";
} else {
startTimeChosen = false;
- document.getElementById("sponsorStart").innerHTML = "Sponsorship Start";
+ document.getElementById("sponsorStart").innerHTML = "Sponsorship Starts Now";
}
//display video times on screen
displaySponsorTimes();
+
+ //show submission section
+ document.getElementById("submissionSection").style.display = "unset";
}
});
@@ -178,6 +184,9 @@ function clearTimes() {
chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
displaySponsorTimes();
+
+ //hide submission section
+ document.getElementById("submissionSection").style.display = "none";
}
function submitTimes() {