mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2024-11-10 09:07:45 +01:00
add bindMediaKey to options
This commit is contained in:
parent
6d0d533fa7
commit
876b55dcc1
4 changed files with 25 additions and 2 deletions
|
@ -918,5 +918,11 @@
|
|||
},
|
||||
"youtubeKeybindWarning": {
|
||||
"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."
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,6 +263,20 @@
|
|||
|
||||
<div class="small-description">__MSG_audioNotificationDescription__</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 class="switch-container">
|
||||
|
|
|
@ -36,7 +36,8 @@ interface SBConfig {
|
|||
serverAddress: string,
|
||||
minDuration: number,
|
||||
skipNoticeDuration: number,
|
||||
audioNotificationOnSkip,
|
||||
audioNotificationOnSkip: boolean,
|
||||
bindMediaKey: boolean,
|
||||
checkForUnlistedVideos: boolean,
|
||||
testingServer: boolean,
|
||||
refetchWhenNotFound: boolean,
|
||||
|
@ -198,6 +199,7 @@ const Config: SBObject = {
|
|||
minDuration: 0,
|
||||
skipNoticeDuration: 4,
|
||||
audioNotificationOnSkip: false,
|
||||
bindMediaKey: false,
|
||||
checkForUnlistedVideos: false,
|
||||
testingServer: false,
|
||||
refetchWhenNotFound: true,
|
||||
|
|
|
@ -1273,7 +1273,8 @@ function skipToTime({v, skipTime, skippingSegments, openNotice, forceAutoSkip, u
|
|||
const beep = new Audio(chrome.runtime.getURL("icons/beep.ogg"));
|
||||
beep.volume = video.volume * 0.1;
|
||||
beep.play();
|
||||
window.addEventListener("keydown", mediaPauseListener);
|
||||
if (Config.config.audioNotificationOnSkip && Config.config.bindMediaKey)
|
||||
window.addEventListener("keydown", mediaPauseListener);
|
||||
}
|
||||
|
||||
if (!autoSkip
|
||||
|
|
Loading…
Reference in a new issue