Added small notice of how many submissions this user has made.

This commit is contained in:
Ajay Ramachandran
2019-07-22 19:08:21 -04:00
parent b7a35f0823
commit 1040868ebb
4 changed files with 35 additions and 1 deletions

View File

@@ -131,6 +131,18 @@ function submitTimes(videoID, callback) {
});
});
}
//add these to the storage log
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
let currentContributionAmount = 0;
if (result.sponsorTimesContributed != undefined) {
//current contribution amount is known
currentContributionAmount = result.sponsorTimesContributed;
}
//save the amount contributed
chrome.storage.sync.set({"sponsorTimesContributed": currentContributionAmount + sponsorTimes.length});
});
}
});
}

View File

@@ -12,6 +12,10 @@ body {
background-color: #ffd9d9;
}
.recordingSubtitle {
margin-bottom: 10px;
}
.voteButton {
height: 32px;
margin-right: 15px;

View File

@@ -39,7 +39,11 @@
</div>
<h2>Record the times of a sponsorship</h2>
<h2 class="recordingSubtitle">Record the times of a sponsorship</h2>
<p id="sponsorTimesContributionsDisplay" style="display: none">
So far, you've submitted no sponsor times.
</p>
<p>
Click the button below when the sponsorship starts and ends to record and

View File

@@ -38,6 +38,20 @@ chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) {
}
});
//get the amount of times this user has contributed and display it to thank them
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
if (result.sponsorTimesContributed != undefined) {
let sponsorTimesContributionsDisplay = document.getElementById("sponsorTimesContributionsDisplay");
if (result.sponsorTimesContributed > 1) {
sponsorTimesContributionsDisplay.innerText = "So far, you've submitted " + result.sponsorTimesContributed + " sponsor times.";
} else {
sponsorTimesContributionsDisplay.innerText = "So far, you've submitted " + result.sponsorTimesContributed + " sponsor time.";
}
sponsorTimesContributionsDisplay.style.display = "unset";
}
});
chrome.tabs.query({
active: true,
currentWindow: true