mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-08 20:47:11 +03:00
add bindMediaKey to options
This commit is contained in:
@@ -918,5 +918,11 @@
|
|||||||
},
|
},
|
||||||
"youtubeKeybindWarning": {
|
"youtubeKeybindWarning": {
|
||||||
"message": "This is a built-in YouTube shortcut. Are you sure you want to use it?"
|
"message": "This is a built-in YouTube shortcut. Are you sure you want to use it?"
|
||||||
|
},
|
||||||
|
"bindMediaKey": {
|
||||||
|
"message": "Play/Pause Current Video with Media Keys"
|
||||||
|
},
|
||||||
|
"bindMediaKeyDescription": {
|
||||||
|
"message": "Enable this if your media keys stop working after the audio notification is played."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,6 +264,20 @@
|
|||||||
<div class="small-description">__MSG_audioNotificationDescription__</div>
|
<div class="small-description">__MSG_audioNotificationDescription__</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div data-type="toggle" data-sync="bindMediaKey" data-dependent-on="audioNotificationOnSkip">
|
||||||
|
<div class="switch-container">
|
||||||
|
<label class="switch">
|
||||||
|
<input id="bindMediaKey" type="checkbox" checked>
|
||||||
|
<span class="slider round"></span>
|
||||||
|
</label>
|
||||||
|
<label class="switch-label" for="bindMediaKey">
|
||||||
|
__MSG_bindMediaKey__
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="small-description">__MSG_bindMediaKeyDescription__</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div data-type="toggle" data-sync="showTimeWithSkips">
|
<div data-type="toggle" data-sync="showTimeWithSkips">
|
||||||
<div class="switch-container">
|
<div class="switch-container">
|
||||||
<label class="switch">
|
<label class="switch">
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ interface SBConfig {
|
|||||||
serverAddress: string,
|
serverAddress: string,
|
||||||
minDuration: number,
|
minDuration: number,
|
||||||
skipNoticeDuration: number,
|
skipNoticeDuration: number,
|
||||||
audioNotificationOnSkip,
|
audioNotificationOnSkip: boolean,
|
||||||
|
bindMediaKey: boolean,
|
||||||
checkForUnlistedVideos: boolean,
|
checkForUnlistedVideos: boolean,
|
||||||
testingServer: boolean,
|
testingServer: boolean,
|
||||||
refetchWhenNotFound: boolean,
|
refetchWhenNotFound: boolean,
|
||||||
@@ -198,6 +199,7 @@ const Config: SBObject = {
|
|||||||
minDuration: 0,
|
minDuration: 0,
|
||||||
skipNoticeDuration: 4,
|
skipNoticeDuration: 4,
|
||||||
audioNotificationOnSkip: false,
|
audioNotificationOnSkip: false,
|
||||||
|
bindMediaKey: false,
|
||||||
checkForUnlistedVideos: false,
|
checkForUnlistedVideos: false,
|
||||||
testingServer: false,
|
testingServer: false,
|
||||||
refetchWhenNotFound: true,
|
refetchWhenNotFound: true,
|
||||||
|
|||||||
@@ -1273,6 +1273,7 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
|||||||
const beep = new Audio(chrome.runtime.getURL("icons/beep.ogg"));
|
const beep = new Audio(chrome.runtime.getURL("icons/beep.ogg"));
|
||||||
beep.volume = video.volume * 0.1;
|
beep.volume = video.volume * 0.1;
|
||||||
beep.play();
|
beep.play();
|
||||||
|
if (Config.config.audioNotificationOnSkip && Config.config.bindMediaKey)
|
||||||
window.addEventListener("keydown", mediaPauseListener);
|
window.addEventListener("keydown", mediaPauseListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user