diff --git a/background.js b/background.js index 1c1c3ad6..07743435 100644 --- a/background.js +++ b/background.js @@ -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}); + }); } }); } diff --git a/popup.css b/popup.css index 36e2fb25..ec2f1d59 100644 --- a/popup.css +++ b/popup.css @@ -12,6 +12,10 @@ body { background-color: #ffd9d9; } +.recordingSubtitle { + margin-bottom: 10px; +} + .voteButton { height: 32px; margin-right: 15px; diff --git a/popup.html b/popup.html index f77a6a02..b180d788 100644 --- a/popup.html +++ b/popup.html @@ -39,7 +39,11 @@ -
Click the button below when the sponsorship starts and ends to record and diff --git a/popup.js b/popup.js index 6445a3bf..36f6e2d2 100644 --- a/popup.js +++ b/popup.js @@ -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