mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-09 13:07:05 +03:00
Made the submission process hidden until you record your first time
This commit is contained in:
@@ -38,7 +38,7 @@ function submitTimes(videoID) {
|
|||||||
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
||||||
let sponsorTimes = result[sponsorTimeKey];
|
let sponsorTimes = result[sponsorTimeKey];
|
||||||
|
|
||||||
if (sponsorTimes != undefined && sponsorTimes != []) {
|
if (sponsorTimes != undefined && sponsorTimes.length > 0) {
|
||||||
//submit these times
|
//submit these times
|
||||||
for (let i = 0; i < sponsorTimes.length; i++) {
|
for (let i = 0; i < sponsorTimes.length; i++) {
|
||||||
let xmlhttp = new XMLHttpRequest();
|
let xmlhttp = new XMLHttpRequest();
|
||||||
|
|||||||
35
popup.html
35
popup.html
@@ -23,26 +23,35 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<h2>Record the times of a sponsorship</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Click the button below when the sponsorship starts and ends to record and
|
||||||
|
submit it to the database.
|
||||||
|
</p>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button id="sponsorStart">Sponsorship Starts</button>
|
<button id="sponsorStart">Sponsorship Starts Now</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h3>Latest Sponsor Message Times Chosen</h3>
|
<div id="submissionSection" style="display: none">
|
||||||
<b>
|
<h3>Latest Sponsor Message Times Chosen</h3>
|
||||||
<div id="sponsorMessageTimes">
|
<b>
|
||||||
|
<div id="sponsorMessageTimes">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</b>
|
||||||
|
|
||||||
</div>
|
<button id="clearTimes">Clear Times</button>
|
||||||
</b>
|
|
||||||
|
<br/>
|
||||||
<button id="clearTimes">Clear Times</button>
|
|
||||||
|
<button id="submitTimes">Submit Times</button>
|
||||||
<br/>
|
</div>
|
||||||
|
|
||||||
<button id="submitTimes">Submit Times</button>
|
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
<button id="showNoticeAgain" style="display: none">Show Notice Again</button>
|
<button id="showNoticeAgain" style="display: none">Show Notice Again</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
15
popup.js
15
popup.js
@@ -46,7 +46,7 @@ function loadTabData(tabs) {
|
|||||||
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
|
let sponsorTimeKey = "sponsorTimes" + currentVideoID;
|
||||||
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
chrome.storage.local.get([sponsorTimeKey], function(result) {
|
||||||
let sponsorTimesStorage = result[sponsorTimeKey];
|
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) {
|
if (sponsorTimesStorage[sponsorTimesStorage.length - 1] != undefined && sponsorTimesStorage[sponsorTimesStorage.length - 1].length < 2) {
|
||||||
startTimeChosen = true;
|
startTimeChosen = true;
|
||||||
}
|
}
|
||||||
@@ -54,6 +54,9 @@ function loadTabData(tabs) {
|
|||||||
sponsorTimes = sponsorTimesStorage;
|
sponsorTimes = sponsorTimesStorage;
|
||||||
|
|
||||||
displaySponsorTimes();
|
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
|
//update startTimeChosen variable
|
||||||
if (!startTimeChosen) {
|
if (!startTimeChosen) {
|
||||||
startTimeChosen = true;
|
startTimeChosen = true;
|
||||||
document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends";
|
document.getElementById("sponsorStart").innerHTML = "Sponsorship Ends Now";
|
||||||
} else {
|
} else {
|
||||||
startTimeChosen = false;
|
startTimeChosen = false;
|
||||||
document.getElementById("sponsorStart").innerHTML = "Sponsorship Start";
|
document.getElementById("sponsorStart").innerHTML = "Sponsorship Starts Now";
|
||||||
}
|
}
|
||||||
|
|
||||||
//display video times on screen
|
//display video times on screen
|
||||||
displaySponsorTimes();
|
displaySponsorTimes();
|
||||||
|
|
||||||
|
//show submission section
|
||||||
|
document.getElementById("submissionSection").style.display = "unset";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -178,6 +184,9 @@ function clearTimes() {
|
|||||||
chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
|
chrome.storage.local.set({[sponsorTimeKey]: sponsorTimes});
|
||||||
|
|
||||||
displaySponsorTimes();
|
displaySponsorTimes();
|
||||||
|
|
||||||
|
//hide submission section
|
||||||
|
document.getElementById("submissionSection").style.display = "none";
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitTimes() {
|
function submitTimes() {
|
||||||
|
|||||||
Reference in New Issue
Block a user