mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-12 22:47:18 +03:00
Added option to disable the view count tracking.
This commit is contained in:
19
content.js
19
content.js
@@ -36,6 +36,17 @@ var showingStartSponsor = true;
|
|||||||
//should the video controls buttons be added
|
//should the video controls buttons be added
|
||||||
var hideVideoPlayerControls = false;
|
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
|
//if the notice should not be shown
|
||||||
//happens when the user click's the "Don't show notice again" button
|
//happens when the user click's the "Don't show notice again" button
|
||||||
var dontShowNotice = false;
|
var dontShowNotice = false;
|
||||||
@@ -86,6 +97,10 @@ chrome.runtime.onMessage.addListener( // Detect URL Changes
|
|||||||
|
|
||||||
updateVisibilityOfPlayerControlsButton();
|
updateVisibilityOfPlayerControlsButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.message == "trackViewCount") {
|
||||||
|
trackViewCount = request.value;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function videoIDChange(id) {
|
function videoIDChange(id) {
|
||||||
@@ -177,7 +192,9 @@ function sponsorCheck(sponsorTimes) { // Video skipping
|
|||||||
setTimeout(() => closeSkipNotice(currentUUID), 7000);
|
setTimeout(() => closeSkipNotice(currentUUID), 7000);
|
||||||
|
|
||||||
//send telemetry that a this sponsor was skipped happened
|
//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;
|
lastTime = v.currentTime;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SponsorBlock - YouTube Sponsorship Blocker",
|
"name": "SponsorBlock - YouTube Sponsorship Blocker",
|
||||||
"short_name": "SponsorBlock",
|
"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.",
|
"description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "SponsorBlock - YouTube Sponsorship Blocker",
|
"name": "SponsorBlock - YouTube Sponsorship Blocker",
|
||||||
"short_name": "SponsorBlock",
|
"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.",
|
"description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.",
|
||||||
"content_scripts": [
|
"content_scripts": [
|
||||||
{
|
{
|
||||||
|
|||||||
20
popup.html
20
popup.html
@@ -112,6 +112,26 @@
|
|||||||
|
|
||||||
<button id="hideVideoPlayerControls" class="warningButton">Hide Button On YouTube Player</button>
|
<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>
|
<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/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
45
popup.js
45
popup.js
@@ -5,6 +5,8 @@ document.getElementById("submitTimes").addEventListener("click", submitTimes);
|
|||||||
document.getElementById("showNoticeAgain").addEventListener("click", showNoticeAgain);
|
document.getElementById("showNoticeAgain").addEventListener("click", showNoticeAgain);
|
||||||
document.getElementById("hideVideoPlayerControls").addEventListener("click", hideVideoPlayerControls);
|
document.getElementById("hideVideoPlayerControls").addEventListener("click", hideVideoPlayerControls);
|
||||||
document.getElementById("showVideoPlayerControls").addEventListener("click", showVideoPlayerControls);
|
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("optionsButton").addEventListener("click", openOptions);
|
||||||
document.getElementById("reportAnIssue").addEventListener("click", reportAnIssue);
|
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
|
//get the amount of times this user has contributed and display it to thank them
|
||||||
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
|
chrome.storage.sync.get(["sponsorTimesContributed"], function(result) {
|
||||||
if (result.sponsorTimesContributed != undefined) {
|
if (result.sponsorTimesContributed != undefined) {
|
||||||
@@ -398,6 +409,40 @@ function showVideoPlayerControls() {
|
|||||||
document.getElementById("showVideoPlayerControls").style.display = "none";
|
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() {
|
function updateStartTimeChosen() {
|
||||||
//update startTimeChosen variable
|
//update startTimeChosen variable
|
||||||
if (!startTimeChosen) {
|
if (!startTimeChosen) {
|
||||||
|
|||||||
Reference in New Issue
Block a user