mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 04:27:15 +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) {
|
||||
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();
|
||||
|
||||
35
popup.html
35
popup.html
@@ -23,26 +23,35 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
<button id="sponsorStart">Sponsorship Starts</button>
|
||||
<button id="sponsorStart">Sponsorship Starts Now</button>
|
||||
</div>
|
||||
|
||||
<h3>Latest Sponsor Message Times Chosen</h3>
|
||||
<b>
|
||||
<div id="sponsorMessageTimes">
|
||||
<div id="submissionSection" style="display: none">
|
||||
<h3>Latest Sponsor Message Times Chosen</h3>
|
||||
<b>
|
||||
<div id="sponsorMessageTimes">
|
||||
|
||||
</div>
|
||||
</b>
|
||||
|
||||
</div>
|
||||
</b>
|
||||
|
||||
<button id="clearTimes">Clear Times</button>
|
||||
|
||||
<br/>
|
||||
|
||||
<button id="submitTimes">Submit Times</button>
|
||||
<button id="clearTimes">Clear Times</button>
|
||||
|
||||
<br/>
|
||||
|
||||
<button id="submitTimes">Submit Times</button>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
|
||||
|
||||
<button id="showNoticeAgain" style="display: none">Show Notice Again</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
15
popup.js
15
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() {
|
||||
|
||||
Reference in New Issue
Block a user