mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 18:08:46 -04:00
Add feature to jump to marker (#471)
* Add options for setting marker and jumping to marker * Correct "mute" to "muted"
This commit is contained in:

committed by
Ilya Grigorik

parent
e91b4c9cdb
commit
d8965f644c
20
options.js
20
options.js
@@ -102,6 +102,9 @@ function updateCustomShortcutInputText(inputItem, keyCode) {
|
||||
inputItem.keyCode = keyCode;
|
||||
}
|
||||
|
||||
// List of custom actions for which customValue should be disabled
|
||||
var customActionsNoValues=["pause","muted","mark","jump"];
|
||||
|
||||
function add_shortcut() {
|
||||
var html = `<select class="customDo">
|
||||
<option value="slower">Decrease speed</option>
|
||||
@@ -112,6 +115,8 @@ function add_shortcut() {
|
||||
<option value="fast">Preferred speed</option>
|
||||
<option value="muted">Mute</option>
|
||||
<option value="pause">Pause</option>
|
||||
<option value="mark">Set marker</option>
|
||||
<option value="jump">Jump to marker</option>
|
||||
</select>
|
||||
<input class="customKey" type="text" placeholder="press a key"/>
|
||||
<input class="customValue" type="text" placeholder="value (0.10)"/>
|
||||
@@ -192,7 +197,7 @@ function restore_options() {
|
||||
const dom = document.querySelector(".customs:last-of-type")
|
||||
dom.querySelector(".customDo").value = item["action"];
|
||||
|
||||
if (item["action"] === "pause" || item["action"] === "muted")
|
||||
if (customActionsNoValues.includes(item["action"]))
|
||||
dom.querySelector(".customValue").disabled = true;
|
||||
|
||||
updateCustomShortcutInputText(dom.querySelector(".customKey"), item["key"]);
|
||||
@@ -262,14 +267,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
document.addEventListener('change', (event) => {
|
||||
eventCaller(event, "customDo", function () {
|
||||
switch (event.target.value) {
|
||||
case "muted":
|
||||
case "pause":
|
||||
event.target.nextElementSibling.nextElementSibling.disabled = true;
|
||||
event.target.nextElementSibling.nextElementSibling.value = 0;
|
||||
break;
|
||||
default:
|
||||
event.target.nextElementSibling.nextElementSibling.disabled = false;
|
||||
if (customActionsNoValues.includes(event.target.value)) {
|
||||
event.target.nextElementSibling.nextElementSibling.disabled = true;
|
||||
event.target.nextElementSibling.nextElementSibling.value = 0;
|
||||
} else {
|
||||
event.target.nextElementSibling.nextElementSibling.disabled = false;
|
||||
}
|
||||
})
|
||||
});
|
||||
|
Reference in New Issue
Block a user