mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
Add option to not auto-hide info button
This commit is contained in:
@@ -185,6 +185,9 @@
|
|||||||
"whatInfoButton": {
|
"whatInfoButton": {
|
||||||
"message": "This is the button that opens up a popup in the YouTube page."
|
"message": "This is the button that opens up a popup in the YouTube page."
|
||||||
},
|
},
|
||||||
|
"autoHideInfoButton": {
|
||||||
|
"message": "Auto-hide Info Button"
|
||||||
|
},
|
||||||
"hideDeleteButton": {
|
"hideDeleteButton": {
|
||||||
"message": "Hide Delete Button On YouTube Player"
|
"message": "Hide Delete Button On YouTube Player"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -198,6 +198,7 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
<div option-type="toggle" sync-option="forceChannelCheck">
|
<div option-type="toggle" sync-option="forceChannelCheck">
|
||||||
<label class="switch-container">
|
<label class="switch-container">
|
||||||
@@ -262,6 +263,24 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
|
<div option-type="toggle" toggle-type="reverse" sync-option="autoHideInfoButton" if-false="hideInfoButtonPlayerControls">
|
||||||
|
<label class="switch-container">
|
||||||
|
<label class="switch">
|
||||||
|
<input type="checkbox" checked>
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<div class="switch-label">
|
||||||
|
__MSG_autoHideInfoButton__
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div option-type="toggle" toggle-type="reverse" sync-option="hideDeleteButtonPlayerControls">
|
<div option-type="toggle" toggle-type="reverse" sync-option="hideDeleteButtonPlayerControls">
|
||||||
<label class="switch-container">
|
<label class="switch-container">
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ interface SBConfig {
|
|||||||
ytInfoPermissionGranted: boolean,
|
ytInfoPermissionGranted: boolean,
|
||||||
askAboutUnlistedVideos: boolean,
|
askAboutUnlistedVideos: boolean,
|
||||||
allowExpirements: boolean,
|
allowExpirements: boolean,
|
||||||
|
autoHideInfoButton: boolean,
|
||||||
|
|
||||||
// What categories should be skipped
|
// What categories should be skipped
|
||||||
categorySelections: CategorySelection[],
|
categorySelections: CategorySelection[],
|
||||||
@@ -180,6 +181,7 @@ const Config: SBObject = {
|
|||||||
ytInfoPermissionGranted: false,
|
ytInfoPermissionGranted: false,
|
||||||
askAboutUnlistedVideos: true,
|
askAboutUnlistedVideos: true,
|
||||||
allowExpirements: true,
|
allowExpirements: true,
|
||||||
|
autoHideInfoButton: true,
|
||||||
|
|
||||||
categorySelections: [{
|
categorySelections: [{
|
||||||
name: "sponsor",
|
name: "sponsor",
|
||||||
|
|||||||
@@ -1186,7 +1186,8 @@ async function createButtons(): Promise<void> {
|
|||||||
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg");
|
createButton("info", "openPopup", openInfoMenu, "PlayerInfoIconSponsorBlocker.svg");
|
||||||
|
|
||||||
const controlsContainer = getControls();
|
const controlsContainer = getControls();
|
||||||
if (!onInvidious && controlsContainer && playerButtons["info"]?.button && !controlsWithEventListeners.includes(controlsContainer)) {
|
if (Config.config.autoHideInfoButton && !onInvidious && controlsContainer
|
||||||
|
&& playerButtons["info"]?.button && !controlsWithEventListeners.includes(controlsContainer)) {
|
||||||
controlsWithEventListeners.push(controlsContainer);
|
controlsWithEventListeners.push(controlsContainer);
|
||||||
playerButtons["info"].button.classList.add("hidden");
|
playerButtons["info"].button.classList.add("hidden");
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ async function init() {
|
|||||||
|
|
||||||
for (let i = 0; i < optionsElements.length; i++) {
|
for (let i = 0; i < optionsElements.length; i++) {
|
||||||
if ((optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed()))
|
if ((optionsElements[i].getAttribute("private-mode-only") === "true" && !(await isIncognitoAllowed()))
|
||||||
|| (optionsElements[i].getAttribute("no-safari") === "true" && navigator.vendor === "Apple Computer, Inc.")) {
|
|| (optionsElements[i].getAttribute("no-safari") === "true" && navigator.vendor === "Apple Computer, Inc.")
|
||||||
|
|| (optionsElements[i].getAttribute("if-false") && Config.config[optionsElements[i].getAttribute("if-false")])) {
|
||||||
optionsElements[i].classList.add("hidden");
|
optionsElements[i].classList.add("hidden");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user