mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-06 11:37:02 +03:00
Removed options from popup.
This commit is contained in:
96
popup.html
96
popup.html
@@ -193,100 +193,12 @@
|
||||
<br/>
|
||||
|
||||
<button id="optionsButton" class="dangerButton popupElement">__MSG_Options__</button>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
</div>
|
||||
|
||||
<div id="options" class="popupElement" style="display: none">
|
||||
<br/>
|
||||
|
||||
<h3>__MSG_Options__</h3>
|
||||
|
||||
<button id="disableAutoSkip" class="warningButton popupElement">__MSG_disableAutoSkip__</button>
|
||||
<button id="enableAutoSkip" style="display: none" class="warningButton popupElement">__MSG_enableAutoSkip__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_autoSkipDescription__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<span id="keybindButtons">
|
||||
<button id="setStartSponsorKeybind" class="warningButton popupElement">__MSG_setStartSponsorShortcut__</button>
|
||||
<br/>
|
||||
<br/>
|
||||
<button id="setSubmitKeybind" class="warningButton popupElement">__MSG_setSubmitKeybind__</button>
|
||||
<br/>
|
||||
</span>
|
||||
|
||||
<h2 id="keybindDescription" style="display: none" class="popupElement">__MSG_keybindDescription__</h2>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="hideVideoPlayerControls" class="warningButton popupElement">__MSG_hideButtons__</button>
|
||||
<button id="showVideoPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showButtons__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_hideButtonsDescription__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="hideInfoButtonPlayerControls" class="warningButton popupElement">__MSG_hideInfoButton__</button>
|
||||
<button id="showInfoButtonPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showInfoButton__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_whatInfoButton__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="hideDeleteButtonPlayerControls" class="warningButton popupElement">__MSG_hideDeleteButton__</button>
|
||||
<button id="showDeleteButtonPlayerControls" style="display: none" class="warningButton popupElement">__MSG_showDeleteButton__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_whatDeleteButton__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
|
||||
<button id="changeUserIDButton" class="warningButton popupElement">__MSG_changeUserID__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_whatChangeUserID__
|
||||
</sub>
|
||||
|
||||
<div id="changeUserID" class="popupElement" style="display: none">
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<input id="userIDInput" hint="userID"></input>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="setUserID" class="warningButton popupElement">__MSG_setUserID__</button>
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="disableSponsorViewTracking" class="warningButton popupElement">__MSG_disableViewTracking__</button>
|
||||
<button id="enableSponsorViewTracking" style="display: none" class="warningButton popupElement">__MSG_enableViewTracking__</button>
|
||||
<br/>
|
||||
<sub class="popupElement">
|
||||
__MSG_whatViewTracking__
|
||||
</sub>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<button id="showNoticeAgain" style="display: none" class="dangerButton popupElement">__MSG_showNotice__</button>
|
||||
</div>
|
||||
<button id="showNoticeAgain" style="display: none" class="dangerButton popupElement">__MSG_showNotice__</button>
|
||||
</div>
|
||||
</center>
|
||||
</body>
|
||||
|
||||
291
popup.js
291
popup.js
@@ -31,22 +31,12 @@ function runThePopup() {
|
||||
"unwhitelistChannel",
|
||||
"disableSkipping",
|
||||
"enableSkipping",
|
||||
// Options
|
||||
"showNoticeAgain",
|
||||
"optionsButton",
|
||||
// More controls
|
||||
"clearTimes",
|
||||
"submitTimes",
|
||||
// options
|
||||
"showNoticeAgain",
|
||||
"disableAutoSkip",
|
||||
"enableAutoSkip",
|
||||
"hideVideoPlayerControls",
|
||||
"showVideoPlayerControls",
|
||||
"hideInfoButtonPlayerControls",
|
||||
"showInfoButtonPlayerControls",
|
||||
"hideDeleteButtonPlayerControls",
|
||||
"showDeleteButtonPlayerControls",
|
||||
"disableSponsorViewTracking",
|
||||
"enableSponsorViewTracking",
|
||||
"optionsButton",
|
||||
"reportAnIssue",
|
||||
// sponsorTimesContributions
|
||||
"sponsorTimesContributionsContainer",
|
||||
@@ -82,11 +72,6 @@ function runThePopup() {
|
||||
"setUsername",
|
||||
"usernameInput",
|
||||
"submitUsername",
|
||||
// UserID
|
||||
"changeUserID",
|
||||
"changeUserIDButton",
|
||||
"userIDInput",
|
||||
"setUserID",
|
||||
// More
|
||||
"submissionSection",
|
||||
"mainControls",
|
||||
@@ -94,10 +79,6 @@ function runThePopup() {
|
||||
"videoFound",
|
||||
"sponsorMessageTimes",
|
||||
"downloadedSponsorMessageTimes",
|
||||
// Keybinds
|
||||
"setStartSponsorKeybind",
|
||||
"setSubmitKeybind",
|
||||
"keybindDescription"
|
||||
].forEach(id => SB[id] = document.getElementById(id));
|
||||
|
||||
//setup click listeners
|
||||
@@ -109,22 +90,8 @@ function runThePopup() {
|
||||
SB.clearTimes.addEventListener("click", clearTimes);
|
||||
SB.submitTimes.addEventListener("click", submitTimes);
|
||||
SB.showNoticeAgain.addEventListener("click", showNoticeAgain);
|
||||
SB.disableAutoSkip.addEventListener("click", () => setAutoSkip(true));
|
||||
SB.enableAutoSkip.addEventListener("click", () => setAutoSkip(false));
|
||||
SB.setStartSponsorKeybind.addEventListener("click", () => setKeybind(true));
|
||||
SB.setSubmitKeybind.addEventListener("click", () => setKeybind(false));
|
||||
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.setUsernameButton.addEventListener("click", setUsernameButton);
|
||||
SB.submitUsername.addEventListener("click", submitUsername);
|
||||
SB.changeUserIDButton.addEventListener("click", changeUserIDButton);
|
||||
SB.setUserID.addEventListener("click", setUserID);
|
||||
SB.optionsButton.addEventListener("click", openOptions);
|
||||
SB.reportAnIssue.addEventListener("click", reportAnIssue);
|
||||
SB.hideDiscordButton.addEventListener("click", hideDiscordButton);
|
||||
@@ -138,12 +105,6 @@ function runThePopup() {
|
||||
//current video ID of this tab
|
||||
let currentVideoID = null;
|
||||
|
||||
//is this a YouTube tab?
|
||||
let isYouTubeTab = false;
|
||||
|
||||
// Is the start sponsor keybind currently being set
|
||||
let setStartSponsorKeybind = false;
|
||||
|
||||
//see if discord link can be shown
|
||||
chrome.storage.sync.get(["hideDiscordLink"], function(result) {
|
||||
let hideDiscordLink = result.hideDiscordLink;
|
||||
@@ -182,47 +143,6 @@ function runThePopup() {
|
||||
}
|
||||
});
|
||||
|
||||
//show proper auto skip option
|
||||
chrome.storage.sync.get(["disableAutoSkip"], function(result) {
|
||||
let disableAutoSkip = result.disableAutoSkip;
|
||||
if (disableAutoSkip != undefined && disableAutoSkip) {
|
||||
SB.disableAutoSkip.style.display = "none";
|
||||
SB.enableAutoSkip.style.display = "unset";
|
||||
}
|
||||
});
|
||||
|
||||
//show proper video player controls options
|
||||
chrome.storage.sync.get(["hideVideoPlayerControls"], function(result) {
|
||||
let hideVideoPlayerControls = result.hideVideoPlayerControls;
|
||||
if (hideVideoPlayerControls != undefined && hideVideoPlayerControls) {
|
||||
SB.hideVideoPlayerControls.style.display = "none";
|
||||
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) {
|
||||
let trackViewCount = result.trackViewCount;
|
||||
if (trackViewCount != undefined && !trackViewCount) {
|
||||
SB.disableSponsorViewTracking.style.display = "none";
|
||||
SB.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) {
|
||||
@@ -405,13 +325,6 @@ function runThePopup() {
|
||||
);
|
||||
}
|
||||
|
||||
function setVideoID(request) {
|
||||
//if request is undefined, then the page currently being browsed is not YouTube
|
||||
if (request != undefined) {
|
||||
videoID = request.videoID;
|
||||
}
|
||||
}
|
||||
|
||||
function sendSponsorStartMessage() {
|
||||
//the content script will get the message if a YouTube page is open
|
||||
chrome.tabs.query({
|
||||
@@ -927,157 +840,6 @@ function runThePopup() {
|
||||
SB.showNoticeAgain.style.display = "none";
|
||||
}
|
||||
|
||||
function setAutoSkip(value) {
|
||||
chrome.storage.sync.set({"disableAutoSkip": value});
|
||||
|
||||
if (value) {
|
||||
// If it isn't shown, they can't manually skip
|
||||
showNoticeAgain();
|
||||
|
||||
SB.disableAutoSkip.style.display = "none";
|
||||
SB.enableAutoSkip.style.display = "unset";
|
||||
} else {
|
||||
SB.enableAutoSkip.style.display = "none";
|
||||
SB.disableAutoSkip.style.display = "unset";
|
||||
}
|
||||
}
|
||||
|
||||
function hideVideoPlayerControls() {
|
||||
chrome.storage.sync.set({"hideVideoPlayerControls": true});
|
||||
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function(tabs) {
|
||||
chrome.tabs.sendMessage(tabs[0].id, {
|
||||
message: "changeVideoPlayerControlsVisibility",
|
||||
value: true
|
||||
});
|
||||
});
|
||||
|
||||
SB.hideVideoPlayerControls.style.display = "none";
|
||||
SB.showVideoPlayerControls.style.display = "unset";
|
||||
}
|
||||
|
||||
function showVideoPlayerControls() {
|
||||
chrome.storage.sync.set({"hideVideoPlayerControls": false});
|
||||
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function(tabs) {
|
||||
chrome.tabs.sendMessage(tabs[0].id, {
|
||||
message: "changeVideoPlayerControlsVisibility",
|
||||
value: false
|
||||
});
|
||||
});
|
||||
|
||||
SB.hideVideoPlayerControls.style.display = "unset";
|
||||
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});
|
||||
|
||||
chrome.tabs.query({
|
||||
active: true,
|
||||
currentWindow: true
|
||||
}, function(tabs) {
|
||||
chrome.tabs.sendMessage(tabs[0].id, {
|
||||
message: "trackViewCount",
|
||||
value: false
|
||||
});
|
||||
});
|
||||
|
||||
SB.disableSponsorViewTracking.style.display = "none";
|
||||
SB.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
|
||||
});
|
||||
});
|
||||
|
||||
SB.enableSponsorViewTracking.style.display = "none";
|
||||
SB.disableSponsorViewTracking.style.display = "unset";
|
||||
}
|
||||
|
||||
function updateStartTimeChosen() {
|
||||
//update startTimeChosen letiable
|
||||
if (!startTimeChosen) {
|
||||
@@ -1108,8 +870,7 @@ function runThePopup() {
|
||||
|
||||
//make the options div visible
|
||||
function openOptions() {
|
||||
document.getElementById("optionsButtonContainer").style.display = "none";
|
||||
document.getElementById("options").style.display = "unset";
|
||||
chrome.runtime.openOptionsPage();
|
||||
}
|
||||
|
||||
//make the options username setting option visible
|
||||
@@ -1166,22 +927,6 @@ function runThePopup() {
|
||||
SB.setUsername.style.display = "unset";
|
||||
}
|
||||
|
||||
function changeUserIDButton() {
|
||||
//get the user ID
|
||||
chrome.storage.sync.get(["userID"], function(result) {
|
||||
SB.userIDInput.value = result.userID;
|
||||
SB.setUserID.style.display = "unset";
|
||||
SB.userIDInput.style.display = "unset";
|
||||
SB.changeUserID.style.display = "unset";
|
||||
});
|
||||
}
|
||||
|
||||
function setUserID() {
|
||||
if (!confirm(chrome.i18n.getMessage("userIDChangeWarning"))) return;
|
||||
|
||||
chrome.storage.sync.set({"userID": SB.userIDInput.value});
|
||||
}
|
||||
|
||||
//this is not a YouTube video page
|
||||
function displayNoVideo() {
|
||||
document.getElementById("loadingIndicator").innerText = chrome.i18n.getMessage("noVideoID");
|
||||
@@ -1369,34 +1114,6 @@ function runThePopup() {
|
||||
hiddenButton.style.display = "none";
|
||||
}
|
||||
|
||||
function setKeybind(startSponsorKeybind) {
|
||||
document.getElementById("keybindButtons").style.display = "none";
|
||||
|
||||
document.getElementById("keybindDescription").style.display = "initial";
|
||||
document.getElementById("keybindDescription").innerText = chrome.i18n.getMessage("keybindDescription");
|
||||
|
||||
setStartSponsorKeybind = startSponsorKeybind;
|
||||
|
||||
document.addEventListener("keydown", onKeybindSet)
|
||||
}
|
||||
|
||||
function onKeybindSet(e) {
|
||||
e = e || window.event;
|
||||
var key = e.key;
|
||||
|
||||
if (setStartSponsorKeybind) {
|
||||
chrome.storage.sync.set({"startSponsorKeybind": key});
|
||||
} else {
|
||||
chrome.storage.sync.set({"submitKeybind": key});
|
||||
}
|
||||
|
||||
document.removeEventListener("keydown", onKeybindSet);
|
||||
|
||||
document.getElementById("keybindDescription").innerText = chrome.i18n.getMessage("keybindDescriptionComplete") + " " + key;
|
||||
|
||||
document.getElementById("keybindButtons").style.display = "unset";
|
||||
}
|
||||
|
||||
//converts time in seconds to minutes
|
||||
function getTimeInMinutes(seconds) {
|
||||
let minutes = Math.floor(seconds / 60);
|
||||
|
||||
Reference in New Issue
Block a user