From 0f561d4a5a18fbef1fbadb1559fced1786d47622 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 23 Jul 2019 21:06:36 -0400 Subject: Added option to disable the view count tracking. --- content.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'content.js') diff --git a/content.js b/content.js index 970ab199..238f6f19 100644 --- a/content.js +++ b/content.js @@ -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; -- cgit v1.2.3