mirror of
https://github.com/ajayyy/SponsorBlock.git
synced 2025-12-10 13:37:04 +03:00
Change next chapter keybind to be same as YouTube and disable YouTube's one
Fix #1508
This commit is contained in:
@@ -219,8 +219,8 @@ const Config: SBObject = {
|
|||||||
skipKeybind: {key: "Enter"},
|
skipKeybind: {key: "Enter"},
|
||||||
startSponsorKeybind: {key: ";"},
|
startSponsorKeybind: {key: ";"},
|
||||||
submitKeybind: {key: "'"},
|
submitKeybind: {key: "'"},
|
||||||
nextChapterKeybind: {key: "]", ctrl: true},
|
nextChapterKeybind: {key: "ArrowRight", ctrl: true},
|
||||||
previousChapterKeybind: {key: "[", ctrl: true},
|
previousChapterKeybind: {key: "ArrowLeft", ctrl: true},
|
||||||
|
|
||||||
categorySelections: [{
|
categorySelections: [{
|
||||||
name: "sponsor" as Category,
|
name: "sponsor" as Category,
|
||||||
|
|||||||
@@ -2489,6 +2489,12 @@ function addPageListeners(): void {
|
|||||||
|
|
||||||
function addHotkeyListener(): void {
|
function addHotkeyListener(): void {
|
||||||
document.addEventListener("keydown", hotkeyListener);
|
document.addEventListener("keydown", hotkeyListener);
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
// Allow us to stop propagation to YouTube by being deeper
|
||||||
|
document.removeEventListener("keydown", hotkeyListener);
|
||||||
|
document.body.addEventListener("keydown", hotkeyListener);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function hotkeyListener(e: KeyboardEvent): void {
|
function hotkeyListener(e: KeyboardEvent): void {
|
||||||
@@ -2520,9 +2526,11 @@ function hotkeyListener(e: KeyboardEvent): void {
|
|||||||
submitSponsorTimes();
|
submitSponsorTimes();
|
||||||
return;
|
return;
|
||||||
} else if (keybindEquals(key, nextChapterKey)) {
|
} else if (keybindEquals(key, nextChapterKey)) {
|
||||||
|
if (sponsorTimes.length > 0) e.stopPropagation();
|
||||||
nextChapter();
|
nextChapter();
|
||||||
return;
|
return;
|
||||||
} else if (keybindEquals(key, previousChapterKey)) {
|
} else if (keybindEquals(key, previousChapterKey)) {
|
||||||
|
if (sponsorTimes.length > 0) e.stopPropagation();
|
||||||
previousChapter();
|
previousChapter();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user