diff options
author | Ajay Ramachandran <[email protected]> | 2019-07-23 21:06:36 -0400 |
---|---|---|
committer | Ajay Ramachandran <[email protected]> | 2019-07-23 21:06:36 -0400 |
commit | 0f561d4a5a18fbef1fbadb1559fced1786d47622 (patch) | |
tree | 9c580f306105d1de56c960432e704cdb1d29dc9b | |
parent | e8ff6171eb6f38e4d852ad73b015301ccbb9a769 (diff) | |
download | SponsorBlock-0f561d4a5a18fbef1fbadb1559fced1786d47622.tar.gz SponsorBlock-0f561d4a5a18fbef1fbadb1559fced1786d47622.zip |
Added option to disable the view count tracking.
-rw-r--r-- | content.js | 19 | ||||
-rw-r--r-- | firefox_manifest.json | 2 | ||||
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | popup.html | 22 | ||||
-rw-r--r-- | popup.js | 45 |
5 files changed, 86 insertions, 4 deletions
@@ -36,6 +36,17 @@ var showingStartSponsor = true; //should the video controls buttons be added var hideVideoPlayerControls = false; +//should view counts be tracked +var trackViewCount = false; +chrome.storage.sync.get(["trackViewCount"], function(result) { + let trackViewCountStorage = result.trackViewCount; + if (trackViewCountStorage != undefined) { + trackViewCount = trackViewCountStorage; + } else { + trackViewCount = true; + } +}); + //if the notice should not be shown //happens when the user click's the "Don't show notice again" button var dontShowNotice = false; @@ -86,6 +97,10 @@ chrome.runtime.onMessage.addListener( // Detect URL Changes updateVisibilityOfPlayerControlsButton(); } + + if (request.message == "trackViewCount") { + trackViewCount = request.value; + } }); function videoIDChange(id) { @@ -177,7 +192,9 @@ function sponsorCheck(sponsorTimes) { // Video skipping setTimeout(() => closeSkipNotice(currentUUID), 7000); //send telemetry that a this sponsor was skipped happened - sendRequestToServer("GET", "/api/viewedVideoSponsorTime?UUID=" + currentUUID); + if (trackViewCount) { + sendRequestToServer("GET", "/api/viewedVideoSponsorTime?UUID=" + currentUUID); + } } } lastTime = v.currentTime; diff --git a/firefox_manifest.json b/firefox_manifest.json index 642c4a3e..5c15bb4c 100644 --- a/firefox_manifest.json +++ b/firefox_manifest.json @@ -1,7 +1,7 @@ { "name": "SponsorBlock - YouTube Sponsorship Blocker", "short_name": "SponsorBlock", - "version": "1.0.1", + "version": "1.0.2", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "content_scripts": [ { diff --git a/manifest.json b/manifest.json index 25c1104f..f13e4b65 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "SponsorBlock - YouTube Sponsorship Blocker", "short_name": "SponsorBlock", - "version": "1.0.1", + "version": "1.0.2", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "content_scripts": [ { @@ -112,10 +112,30 @@ <button id="hideVideoPlayerControls" class="warningButton">Hide Button On YouTube Player</button> <button id="showVideoPlayerControls" style="display: none" class="warningButton">Show Button On YouTube Player</button> + <br/> + <sub> + This hides the button that appears on the YouTube player to submit sponsors. I can see this being annoying for some + people. Instead of using the button there, this popup can be used to submit sponsors. To hide the notice that appears, + use the button that appears on the notice saying "Don't show this again". You can always enable these settings again + later. + </sub> + + <br/> + <br/> + + <button id="disableSponsorViewTracking" class="warningButton">Disable Sponsor View Tracking</button> + <button id="enableSponsorViewTracking" style="display: none" class="warningButton">Enable Sponsor View Tracking</button> + <br/> + <sub> + This feature tracks which sponsors you have skipped to let users know how much their submission has helped others and + used as a metric along with upvotes to ensure that spam doesn't get into the database. The extension sends a message + to the server each time you skip a sponsor. Hopefully most people don't change this setting so that the view numbers + are accurate. :) + </sub> <br/> <br/> - + <button id="showNoticeAgain" style="display: none" class="dangerButton">Show Notice Again</button> </div> </div> @@ -5,6 +5,8 @@ document.getElementById("submitTimes").addEventListener("click", submitTimes); document.getElementById("showNoticeAgain").addEventListener("click", showNoticeAgain); document.getElementById("hideVideoPlayerControls").addEventListener("click", hideVideoPlayerControls); document.getElementById("showVideoPlayerControls").addEventListener("click", showVideoPlayerControls); +document.getElementById("disableSponsorViewTracking").addEventListener("click", disableSponsorViewTracking); +document.getElementById("enableSponsorViewTracking").addEventListener("click", enableSponsorViewTracking); document.getElementById("optionsButton").addEventListener("click", openOptions); document.getElementById("reportAnIssue").addEventListener("click", reportAnIssue); @@ -38,6 +40,15 @@ chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) { } }); +//show proper tracking option +chrome.storage.sync.get(["trackViewCount"], function(result) { + let trackViewCount = result.trackViewCount; + if (trackViewCount != undefined && !trackViewCount) { + document.getElementById("disableSponsorViewTracking").style.display = "none"; + document.getElementById("enableSponsorViewTracking").style.display = "unset"; + } +}); + //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) { @@ -398,6 +409,40 @@ function showVideoPlayerControls() { document.getElementById("showVideoPlayerControls").style.display = "none"; } +function disableSponsorViewTracking() { + chrome.storage.sync.set({"trackViewCount": false}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "trackViewCount", + value: false + }); + }); + + document.getElementById("disableSponsorViewTracking").style.display = "none"; + document.getElementById("enableSponsorViewTracking").style.display = "unset"; +} + +function enableSponsorViewTracking() { + chrome.storage.sync.set({"trackViewCount": true}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "trackViewCount", + value: true + }); + }); + + document.getElementById("enableSponsorViewTracking").style.display = "none"; + document.getElementById("disableSponsorViewTracking").style.display = "unset"; +} + function updateStartTimeChosen() { //update startTimeChosen variable if (!startTimeChosen) { |