From e4c94aa5c5a289c7fe6ba2925f64bda6dec36813 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 16:29:20 -0400 Subject: Added more info the confirmation button. --- content.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content.js b/content.js index e41cefc8..73734513 100644 --- a/content.js +++ b/content.js @@ -706,7 +706,7 @@ function submitSponsorTimes() { if (sponsorTimes != undefined && sponsorTimes.length > 0) { let confirmMessage = "Are you sure you want to submit this?\n\n" + getSponsorTimesMessage(sponsorTimes); - confirmMessage += "\n\nTo see more information, open the popup by clicking the extensions icon in the top right corner." + confirmMessage += "\n\nTo edit or delete values, click the info button or open the extension popup by clicking the extension icon in the top right corner." if(!confirm(confirmMessage)) return; sendSubmitMessage(); -- cgit v1.2.3 From e0d2436372bbcb63fecd9d61d5c45d0d0e543fbf Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 16:35:30 -0400 Subject: Added support for old youtube theme --- content.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content.js b/content.js index 73734513..6233a922 100644 --- a/content.js +++ b/content.js @@ -427,6 +427,10 @@ function openInfoMenu() { popup.appendChild(popupFrame); let parentNode = document.getElementById("secondary"); + if (parentNode == null) { + //old youtube theme + parentNode = document.getElementById("watch7-sidebar-contents"); + } parentNode.prepend(popup); } -- cgit v1.2.3 From 1119adffb75de6ccab17f6f236f14763c339a2ec Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 20:54:10 -0400 Subject: Added clear button. --- content.js | 64 +++++++++++++++++++++++++- firefox_manifest.json | 4 +- icons/PlayerDeleteIconSponsorBlocker256px.png | Bin 0 -> 11626 bytes manifest.json | 1 + 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 icons/PlayerDeleteIconSponsorBlocker256px.png diff --git a/content.js b/content.js index 6233a922..c9262d99 100644 --- a/content.js +++ b/content.js @@ -160,8 +160,7 @@ function videoIDChange(id) { } else if (sponsorTimes != null && sponsorTimes.length > 0 && sponsorTimes[sponsorTimes.length - 1].length < 2) { changeStartSponsorButton(false, true); } else { - changeStartSponsorButton(true, true); - document.getElementById("submitButton").style.display = "none"; + changeStartSponsorButton(true, false); } } }); @@ -297,6 +296,7 @@ function removePlayerControlsButton() { function updateVisibilityOfPlayerControlsButton() { addPlayerControlsButton(); addInfoButton(); + addDeleteButton(); addSubmitButton(); if (hideVideoPlayerControls) { removePlayerControlsButton(); @@ -318,6 +318,13 @@ function startSponsorClicked() { } function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) { + //if it isn't visible, there is no data + if (uploadButtonVisible) { + document.getElementById("deleteButton").style.display = "unset"; + } else { + document.getElementById("deleteButton").style.display = "none"; + } + if (showStartSponsor) { showingStartSponsor = true; document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker256px.png"); @@ -369,6 +376,34 @@ function addInfoButton() { referenceNode.prepend(infoButton); } +//shows the delete button on the video player +function addDeleteButton() { + if (document.getElementById("deleteButton") != null) { + //it's already added + return; + } + + //make a submit button + let deleteButton = document.createElement("button"); + deleteButton.id = "deleteButton"; + deleteButton.className = "ytp-button playerButton"; + deleteButton.setAttribute("title", "Clear Sponsor Times"); + deleteButton.addEventListener("click", clearSponsorTimes); + //hide it at the start + deleteButton.style.display = "none"; + + let deleteImage = document.createElement("img"); + deleteImage.id = "deleteButtonImage"; + deleteImage.className = "playerButtonImage"; + deleteImage.src = chrome.extension.getURL("icons/PlayerDeleteIconSponsorBlocker256px.png"); + + //add the image to the button + deleteButton.appendChild(deleteImage); + + let referenceNode = document.getElementsByClassName("ytp-right-controls")[0]; + referenceNode.prepend(deleteButton); +} + //shows the submit button on the video player function addSubmitButton() { if (document.getElementById("submitButton") != null) { @@ -445,6 +480,31 @@ function closeInfoMenu() { } } +function clearSponsorTimes() { + //it can't update to this info yet + closeInfoMenu(); + + let currentVideoID = getYouTubeVideoID(document.URL); + + let sponsorTimeKey = 'sponsorTimes' + currentVideoID; + chrome.storage.sync.get([sponsorTimeKey], function(result) { + let sponsorTimes = result[sponsorTimeKey]; + + if (sponsorTimes != undefined && sponsorTimes.length > 0) { + let confirmMessage = "Are you sure you want to clear this?\n\n" + getSponsorTimesMessage(sponsorTimes); + confirmMessage += "\n\nTo edit or delete individual values, click the info button or open the extension popup by clicking the extension icon in the top right corner." + if(!confirm(confirmMessage)) return; + + //clear the sponsor times + let sponsorTimeKey = "sponsorTimes" + currentVideoID; + chrome.storage.sync.set({[sponsorTimeKey]: []}); + + //set buttons to be correct + changeStartSponsorButton(true, false); + } + }); +} + //Opens the notice that tells the user that a sponsor was just skipped function openSkipNotice(UUID){ if (dontShowNotice) { diff --git a/firefox_manifest.json b/firefox_manifest.json index 0fb7e834..d8e2296b 100644 --- a/firefox_manifest.json +++ b/firefox_manifest.json @@ -27,7 +27,9 @@ "icons/PlayerUploadFailedIconSponsorBlocker256px.png", "icons/upvote.png", "icons/downvote.png", - "icons/PlayerInfoIconSponsorBlocker256px.png" + "icons/PlayerInfoIconSponsorBlocker256px.png", + "icons/PlayerDeleteIconSponsorBlocker256px.png", + "popup.html" ], "permissions": [ "tabs", diff --git a/icons/PlayerDeleteIconSponsorBlocker256px.png b/icons/PlayerDeleteIconSponsorBlocker256px.png new file mode 100644 index 00000000..c44f383d Binary files /dev/null and b/icons/PlayerDeleteIconSponsorBlocker256px.png differ diff --git a/manifest.json b/manifest.json index c14a16aa..74a04979 100644 --- a/manifest.json +++ b/manifest.json @@ -28,6 +28,7 @@ "icons/upvote.png", "icons/downvote.png", "icons/PlayerInfoIconSponsorBlocker256px.png", + "icons/PlayerDeleteIconSponsorBlocker256px.png", "popup.html" ], "permissions": [ -- cgit v1.2.3 From 366fd43752248dae703e43f9a04189bcd9a47957 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 20:58:48 -0400 Subject: Added more specific error message for error 502 --- popup.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/popup.js b/popup.js index 98fb095d..f4f1c6f8 100644 --- a/popup.js +++ b/popup.js @@ -576,6 +576,9 @@ function submitTimes() { } else if(response.statusCode == 409) { document.getElementById("submitTimesInfoMessage").innerText = "This has already been submitted before"; document.getElementById("submitTimesInfoMessageContainer").style.display = "unset"; + } else if(response.statusCode == 502) { + document.getElementById("submitTimesInfoMessage").innerText = "It seems the server is down. Contact the dev to inform them. Error code " + response.statusCode; + document.getElementById("submitTimesInfoMessageContainer").style.display = "unset"; } else { document.getElementById("submitTimesInfoMessage").innerText = "There was an error submitting your sponsor times, please try again later. Error code " + response.statusCode; document.getElementById("submitTimesInfoMessageContainer").style.display = "unset"; -- cgit v1.2.3 From 0d0b91910695ba5a4fb144e986c6f39053e168ad Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 21:06:15 -0400 Subject: Added better error messages to voting. --- background.js | 6 ++++-- content.js | 9 +++++++-- popup.js | 8 ++++++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/background.js b/background.js index 446bf0bc..adb86553 100644 --- a/background.js +++ b/background.js @@ -100,12 +100,14 @@ function submitVote(type, UUID, callback) { } else if (xmlhttp.readyState == 4 && xmlhttp.status == 405) { //duplicate vote callback({ - successType: 0 + successType: 0, + statusCode: xmlhttp.status }); } else if (error) { //error while connect callback({ - successType: -1 + successType: -1, + statusCode: xmlhttp.status }); } }) diff --git a/content.js b/content.js index c9262d99..381a0932 100644 --- a/content.js +++ b/content.js @@ -710,8 +710,13 @@ function vote(type, UUID) { //failure: duplicate vote addLoadingInfo("It seems you've already voted before", UUID) } else if (response.successType == -1) { - //failure: duplicate vote - addLoadingInfo("A connection error has occured.", UUID) + if (response.statusCode == 502) { + addLoadingInfo("It seems the sever is down. Contact the dev immediately.", UUID) + } else { + //failure: unknown error + addLoadingInfo("A connection error has occured. Error code: " + response.statusCode, UUID) + } + } } }); diff --git a/popup.js b/popup.js index f4f1c6f8..37800636 100644 --- a/popup.js +++ b/popup.js @@ -750,8 +750,12 @@ function vote(type, UUID) { //failure: duplicate vote addVoteMessage("You have already voted this way before.", UUID) } else if (response.successType == -1) { - //failure: duplicate vote - addVoteMessage("A connection error has occured.", UUID) + if (response.statusCode == 502) { + addVoteMessage("It seems the sever is down. Contact the dev immediately.", UUID) + } else { + //failure: unknown error + addVoteMessage("A connection error has occured. Error code: " + response.statusCode, UUID) + } } } }); -- cgit v1.2.3 From d93d475c1fcdc78fc1ceb63f572c0d2a2f375208 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 21:09:10 -0400 Subject: Added error messages to video player submission. --- content.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/content.js b/content.js index 381a0932..b4f9fbdb 100644 --- a/content.js +++ b/content.js @@ -817,6 +817,18 @@ function sendSubmitMessage(){ //show that the upload failed document.getElementById("submitButton").style.animation = "unset"; document.getElementById("submitButtonImage").src = chrome.extension.getURL("icons/PlayerUploadFailedIconSponsorBlocker256px.png"); + + if(response.statusCode == 400) { + alert("Server said this request was invalid"); + } else if(response.statusCode == 429) { + alert("You have submitted too many sponsor times for this one video, are you sure there are this many?"); + } else if(response.statusCode == 409) { + alert("This has already been submitted before"); + } else if(response.statusCode == 502) { + alert("It seems the server is down. Contact the dev to inform them. Error code " + response.statusCode); + } else { + alert("There was an error submitting your sponsor times, please try again later. Error code " + response.statusCode); + } } } }); -- cgit v1.2.3 From ff6234bffe0469055048dbc7277b8c1c959dc0ed Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 21:19:29 -0400 Subject: Increased font size of sponsor time, edit and delete buttons. Also made clicking times trigger an edit. --- popup.css | 12 ++++++++++++ popup.js | 27 +++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/popup.css b/popup.css index d8053170..a33f408a 100644 --- a/popup.css +++ b/popup.css @@ -29,12 +29,24 @@ body { font-size: 12px; } +.sponsorTime { + font-size: 20px; +} + .smallLink { font-size: 10px; text-decoration: underline; cursor: pointer; } +.mediumLink { + font-size: 15px; + padding-left: 15px; + padding-right: 15px; + text-decoration: underline; + cursor: pointer; +} + .greenButton { background-color:#ec1c1c; -moz-border-radius:28px; diff --git a/popup.js b/popup.js index 37800636..567a49a0 100644 --- a/popup.js +++ b/popup.js @@ -353,12 +353,13 @@ function getSponsorTimesMessageDiv(sponsorTimes) { for (let i = 0; i < sponsorTimes.length; i++) { let currentSponsorTimeContainer = document.createElement("div"); currentSponsorTimeContainer.id = "sponsorTimeContainer" + i; + currentSponsorTimeContainer.className = "sponsorTime"; let currentSponsorTimeMessage = ""; let deleteButton = document.createElement("span"); deleteButton.id = "sponsorTimeDeleteButton" + i; deleteButton.innerText = "Delete"; - deleteButton.className = "smallLink"; + deleteButton.className = "mediumLink"; let index = i; deleteButton.addEventListener("click", () => deleteSponsorTime(index)); @@ -368,7 +369,7 @@ function getSponsorTimesMessageDiv(sponsorTimes) { let editButton = document.createElement("span"); editButton.id = "sponsorTimeEditButton" + i; editButton.innerText = "Edit"; - editButton.className = "smallLink"; + editButton.className = "mediumLink"; editButton.addEventListener("click", () => editSponsorTime(index)); for (let s = 0; s < sponsorTimes[i].length; s++) { @@ -385,12 +386,13 @@ function getSponsorTimesMessageDiv(sponsorTimes) { } currentSponsorTimeContainer.innerText = currentSponsorTimeMessage; + currentSponsorTimeContainer.addEventListener("click", () => editSponsorTime(index)); + sponsorTimesContainer.appendChild(currentSponsorTimeContainer); sponsorTimesContainer.appendChild(deleteButton); //only if it is a complete sponsor time if (sponsorTimes[i].length > 1) { - sponsorTimesContainer.appendChild(spacer); sponsorTimesContainer.appendChild(editButton); } } @@ -399,32 +401,41 @@ function getSponsorTimesMessageDiv(sponsorTimes) { } function editSponsorTime(index) { + if (document.getElementById("startTimeMinutes" + index) != null) { + //already open + return; + } + let sponsorTimeContainer = document.getElementById("sponsorTimeContainer" + index); //get sponsor time minutes and seconds boxes let startTimeMinutes = document.createElement("input"); startTimeMinutes.id = "startTimeMinutes" + index; + startTimeMinutes.className = "sponsorTime"; startTimeMinutes.type = "text"; startTimeMinutes.value = getTimeInMinutes(sponsorTimes[index][0]); - startTimeMinutes.style.width = "35"; + startTimeMinutes.style.width = "45"; let startTimeSeconds = document.createElement("input"); startTimeSeconds.id = "startTimeSeconds" + index; + startTimeSeconds.className = "sponsorTime"; startTimeSeconds.type = "text"; startTimeSeconds.value = getTimeInFormattedSeconds(sponsorTimes[index][0]); - startTimeSeconds.style.width = "42"; + startTimeSeconds.style.width = "60"; let endTimeMinutes = document.createElement("input"); endTimeMinutes.id = "endTimeMinutes" + index; + endTimeMinutes.className = "sponsorTime"; endTimeMinutes.type = "text"; endTimeMinutes.value = getTimeInMinutes(sponsorTimes[index][1]); - endTimeMinutes.style.width = "35"; + endTimeMinutes.style.width = "45"; let endTimeSeconds = document.createElement("input"); endTimeSeconds.id = "endTimeSeconds" + index; + endTimeSeconds.className = "sponsorTime"; endTimeSeconds.type = "text"; endTimeSeconds.value = getTimeInFormattedSeconds(sponsorTimes[index][1]); - endTimeSeconds.style.width = "42"; + endTimeSeconds.style.width = "60"; let colonText = document.createElement("span"); colonText.innerText = ":"; @@ -449,7 +460,7 @@ function editSponsorTime(index) { let saveButton = document.createElement("span"); saveButton.id = "sponsorTimeSaveButton" + index; saveButton.innerText = "Save"; - saveButton.className = "smallLink"; + saveButton.className = "mediumLink"; saveButton.addEventListener("click", () => saveSponsorTimeEdit(index)); let editButton = document.getElementById("sponsorTimeEditButton" + index); -- cgit v1.2.3 From e2054479688e3fc197c64e5b08d1a977dc03fce8 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 29 Jul 2019 21:40:13 -0400 Subject: Added ability to hide info and delete button. --- content.js | 37 +++++++++++++++++++++++-- popup.html | 26 ++++++++++++++++-- popup.js | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 148 insertions(+), 7 deletions(-) diff --git a/content.js b/content.js index b4f9fbdb..53347e07 100644 --- a/content.js +++ b/content.js @@ -31,6 +31,8 @@ var showingStartSponsor = true; //should the video controls buttons be added var hideVideoPlayerControls = false; +var hideInfoButtonPlayerControls = false; +var hideDeleteButtonPlayerControls = false; //becomes true when isInfoFound is called //this is used to close the popup on YouTube when the other popup opens @@ -102,6 +104,14 @@ chrome.runtime.onMessage.addListener( // Detect URL Changes if (request.message == "changeVideoPlayerControlsVisibility") { hideVideoPlayerControls = request.value; + updateVisibilityOfPlayerControlsButton(); + } else if (request.message == "changeInfoButtonPlayerControlsVisibility") { + hideInfoButtonPlayerControls = request.value; + + updateVisibilityOfPlayerControlsButton(); + } else if (request.message == "changeDeleteButtonPlayerControlsVisibility") { + hideDeleteButtonPlayerControls = request.value; + updateVisibilityOfPlayerControlsButton(); } @@ -165,7 +175,7 @@ function videoIDChange(id) { } }); - //see if video control buttons should be added + //see if video controls buttons should be added chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) { if (result.hideVideoPlayerControls != undefined) { hideVideoPlayerControls = result.hideVideoPlayerControls; @@ -173,6 +183,21 @@ function videoIDChange(id) { updateVisibilityOfPlayerControlsButton(); }); + chrome.storage.sync.get(["hideInfoButtonPlayerControls"], function(result) { + if (result.hideInfoButtonPlayerControls != undefined) { + hideInfoButtonPlayerControls = result.hideInfoButtonPlayerControls; + } + + updateVisibilityOfPlayerControlsButton(); + }); + chrome.storage.sync.get(["hideDeleteButtonPlayerControls"], function(result) { + if (result.hideDeleteButtonPlayerControls != undefined) { + hideDeleteButtonPlayerControls = result.hideDeleteButtonPlayerControls; + } + + updateVisibilityOfPlayerControlsButton(); + }); + } function sponsorsLookup(id) { @@ -301,6 +326,12 @@ function updateVisibilityOfPlayerControlsButton() { if (hideVideoPlayerControls) { removePlayerControlsButton(); } + if (hideInfoButtonPlayerControls) { + document.getElementById("infoButton").style.display = "none"; + } + if (hideDeleteButtonPlayerControls) { + document.getElementById("deleteButton").style.display = "none"; + } } function startSponsorClicked() { @@ -319,7 +350,7 @@ function startSponsorClicked() { function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) { //if it isn't visible, there is no data - if (uploadButtonVisible) { + if (uploadButtonVisible && !hideDeleteButtonPlayerControls) { document.getElementById("deleteButton").style.display = "unset"; } else { document.getElementById("deleteButton").style.display = "none"; @@ -330,7 +361,7 @@ function changeStartSponsorButton(showStartSponsor, uploadButtonVisible) { document.getElementById("startSponsorImage").src = chrome.extension.getURL("icons/PlayerStartIconSponsorBlocker256px.png"); document.getElementById("startSponsorButton").setAttribute("title", "Sponsor Starts Now"); - if (document.getElementById("startSponsorImage").style.display != "none" && uploadButtonVisible) { + if (document.getElementById("startSponsorImage").style.display != "none" && uploadButtonVisible && !hideInfoButtonPlayerControls) { document.getElementById("submitButton").style.display = "unset"; } else if (!uploadButtonVisible) { //disable submit button diff --git a/popup.html b/popup.html index b4e5c9b3..db0a1cdb 100644 --- a/popup.html +++ b/popup.html @@ -126,11 +126,11 @@

Options

- - + +
- This hides the button that appears on the YouTube player to submit sponsors. I can see this being annoying for some + This hides the buttons that appear 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. @@ -139,6 +139,26 @@

+ + +
+ + This is the button that opens up a popup in the YouTube page. + + +
+
+ + + +
+ + This is the button that allows you to clear all sponsors on the YouTube player. + + +
+
+
diff --git a/popup.js b/popup.js index 567a49a0..2e75f971 100644 --- a/popup.js +++ b/popup.js @@ -8,6 +8,10 @@ SB.submitTimes = document.getElementById("submitTimes"); SB.showNoticeAgain = document.getElementById("showNoticeAgain"); SB.hideVideoPlayerControls = document.getElementById("hideVideoPlayerControls"); SB.showVideoPlayerControls = document.getElementById("showVideoPlayerControls"); +SB.hideInfoButtonPlayerControls = document.getElementById("hideInfoButtonPlayerControls"); +SB.showInfoButtonPlayerControls = document.getElementById("showInfoButtonPlayerControls"); +SB.hideDeleteButtonPlayerControls = document.getElementById("hideDeleteButtonPlayerControls"); +SB.showDeleteButtonPlayerControls = document.getElementById("showDeleteButtonPlayerControls"); SB.disableSponsorViewTracking = document.getElementById("disableSponsorViewTracking"); SB.enableSponsorViewTracking = document.getElementById("enableSponsorViewTracking"); SB.optionsButton = document.getElementById("optionsButton"); @@ -31,6 +35,10 @@ SB.submitTimes.addEventListener("click", submitTimes); SB.showNoticeAgain.addEventListener("click", showNoticeAgain); SB.hideVideoPlayerControls.addEventListener("click", hideVideoPlayerControls); SB.showVideoPlayerControls.addEventListener("click", showVideoPlayerControls); +SB.hideInfoButtonPlayerControls.addEventListener("click", hideInfoButtonPlayerControls); +SB.showInfoButtonPlayerControls.addEventListener("click", showInfoButtonPlayerControls); +SB.hideDeleteButtonPlayerControls.addEventListener("click", hideDeleteButtonPlayerControls); +SB.showDeleteButtonPlayerControls.addEventListener("click", showDeleteButtonPlayerControls); SB.disableSponsorViewTracking.addEventListener("click", disableSponsorViewTracking); SB.enableSponsorViewTracking.addEventListener("click", enableSponsorViewTracking); SB.optionsButton.addEventListener("click", openOptions); @@ -79,7 +87,7 @@ chrome.storage.sync.get(["dontShowNoticeAgain"], function(result) { } }); -//show proper video player controls option +//show proper video player controls options chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) { let hideVideoPlayerControls = result.hideVideoPlayerControls; if (hideVideoPlayerControls != undefined && hideVideoPlayerControls) { @@ -87,6 +95,20 @@ chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) { SB.showVideoPlayerControls.style.display = "unset"; } }); +chrome.storage.sync.get(["hideInfoButtonPlayerControls"], function(result) { + let hideInfoButtonPlayerControls = result.hideInfoButtonPlayerControls; + if (hideInfoButtonPlayerControls != undefined && hideInfoButtonPlayerControls) { + SB.hideInfoButtonPlayerControls.style.display = "none"; + SB.showInfoButtonPlayerControls.style.display = "unset"; + } +}); +chrome.storage.sync.get(["hideDeleteButtonPlayerControls"], function(result) { + let hideDeleteButtonPlayerControls = result.hideDeleteButtonPlayerControls; + if (hideDeleteButtonPlayerControls != undefined && hideDeleteButtonPlayerControls) { + SB.hideDeleteButtonPlayerControls.style.display = "none"; + SB.showDeleteButtonPlayerControls.style.display = "unset"; + } +}); //show proper tracking option chrome.storage.sync.get(["trackViewCount"], function(result) { @@ -648,6 +670,74 @@ function showVideoPlayerControls() { SB.showVideoPlayerControls.style.display = "none"; } +function hideInfoButtonPlayerControls() { + chrome.storage.sync.set({"hideInfoButtonPlayerControls": true}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "changeInfoButtonPlayerControlsVisibility", + value: true + }); + }); + + SB.hideInfoButtonPlayerControls.style.display = "none"; + SB.showInfoButtonPlayerControls.style.display = "unset"; +} + +function showInfoButtonPlayerControls() { + chrome.storage.sync.set({"hideInfoButtonPlayerControls": false}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "changeVideoPlayerCochangeInfoButtonPlayerControlsVisibilityntrolsVisibility", + value: false + }); + }); + + SB.hideInfoButtonPlayerControls.style.display = "unset"; + SB.showInfoButtonPlayerControls.style.display = "none"; +} + +function hideDeleteButtonPlayerControls() { + chrome.storage.sync.set({"hideDeleteButtonPlayerControls": true}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "changeDeleteButtonPlayerControlsVisibility", + value: true + }); + }); + + SB.hideDeleteButtonPlayerControls.style.display = "none"; + SB.showDeleteButtonPlayerControls.style.display = "unset"; +} + +function showDeleteButtonPlayerControls() { + chrome.storage.sync.set({"hideDeleteButtonPlayerControls": false}); + + chrome.tabs.query({ + active: true, + currentWindow: true + }, function(tabs) { + chrome.tabs.sendMessage(tabs[0].id, { + message: "changeVideoPlayerCochangeDeleteButtonPlayerControlsVisibilityntrolsVisibility", + value: false + }); + }); + + SB.hideDeleteButtonPlayerControls.style.display = "unset"; + SB.showDeleteButtonPlayerControls.style.display = "none"; +} + function disableSponsorViewTracking() { chrome.storage.sync.set({"trackViewCount": false}); -- cgit v1.2.3 From 6ff461fa868306b014b766d35bce845ddb4a1e17 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Tue, 30 Jul 2019 00:09:11 -0400 Subject: Updated version number --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 74a04979..b683f4d7 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "SponsorBlock for YouTube - Skip Sponsorships", "short_name": "SponsorBlock", - "version": "1.0.15", + "version": "1.0.16", "description": "Skip over sponsorship on YouTube videos. Report sponsors on videos you watch to save the time of others.", "content_scripts": [ { -- cgit v1.2.3