Skip to content

Commit

Permalink
Fix shortcuts being bound even when subs aren't loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
killergerbah committed Feb 29, 2024
1 parent 4379635 commit ff3cebf
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions extension/src/services/key-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class KeyBindings {
context.pause();
}
},
() => false,
() => !context.synced,
true
);

Expand All @@ -72,7 +72,7 @@ export default class KeyBindings {

context.playMode = context.playMode === PlayMode.autoPause ? PlayMode.normal : PlayMode.autoPause;
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -83,7 +83,7 @@ export default class KeyBindings {

context.playMode = context.playMode === PlayMode.condensed ? PlayMode.normal : PlayMode.condensed;
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -97,7 +97,7 @@ export default class KeyBindings {
context.playMode = context.playMode === PlayMode.repeat ? PlayMode.normal : PlayMode.repeat;
}
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -108,7 +108,7 @@ export default class KeyBindings {

context.playMode = context.playMode === PlayMode.fastForward ? PlayMode.normal : PlayMode.fastForward;
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -118,7 +118,7 @@ export default class KeyBindings {
event.stopImmediatePropagation();
context.seek(subtitle.start / 1000);
},
() => false,
() => context.subtitleController.subtitles.length === 0,
() => context.video.currentTime * 1000,
() => context.subtitleController.subtitles,
true
Expand All @@ -135,7 +135,7 @@ export default class KeyBindings {
context.seek(Math.max(0, context.video.currentTime - 10));
}
},
() => false,
() => !context.synced,
true
);

Expand All @@ -146,7 +146,7 @@ export default class KeyBindings {
context.seek(subtitle.start / 1000);
if (context.alwaysPlayOnSubtitleRepeat) context.play();
},
() => false,
() => context.subtitleController.subtitles.length === 0,
() => context.video.currentTime * 1000,
() => context.subtitleController.subtitles,
true
Expand All @@ -167,7 +167,7 @@ export default class KeyBindings {

chrome.runtime.sendMessage(toggleSubtitlesCommand);
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -178,7 +178,7 @@ export default class KeyBindings {
context.subtitleController.disabledSubtitleTracks[track] =
!context.subtitleController.disabledSubtitleTracks[track];
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -196,7 +196,7 @@ export default class KeyBindings {
};
chrome.runtime.sendMessage(command);
},
() => !context.subtitleController.subtitles || context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -206,7 +206,7 @@ export default class KeyBindings {
event.stopImmediatePropagation();
context.subtitleController.offset(offset);
},
() => false,
() => context.subtitleController.subtitles.length === 0,
() => context.video.currentTime * 1000,
() => context.subtitleController.subtitles,
true
Expand All @@ -218,7 +218,7 @@ export default class KeyBindings {
event.stopImmediatePropagation();
context.subtitleController.offset(offset);
},
() => false,
() => context.subtitleController.subtitles.length === 0,
() => context.subtitleController.subtitles,
true
);
Expand All @@ -229,7 +229,7 @@ export default class KeyBindings {
event.stopImmediatePropagation();
context.subtitleController.offset(0);
},
() => false,
() => context.subtitleController.subtitles.length === 0,
true
);

Expand All @@ -244,7 +244,7 @@ export default class KeyBindings {
context.video.playbackRate = Math.max(0.1, Math.round(context.video.playbackRate * 10 - 1) / 10);
}
},
() => false,
() => !context.synced,
true
);

Expand Down

0 comments on commit ff3cebf

Please sign in to comment.