diff --git a/inject.js b/inject.js
index 0b0e471..d6f387b 100644
--- a/inject.js
+++ b/inject.js
@@ -486,6 +486,10 @@
pauseSpeed(v, value);
} else if (action === 'muted') {
muted(v, value);
+ } else if (action === 'mark') {
+ setMark(v);
+ } else if (action === 'jump') {
+ jumpToMark(v);
}
}
});
@@ -520,6 +524,16 @@
v.muted = v.muted !== true;
}
+ function setMark(v) {
+ v.vsc.mark = v.currentTime;
+ }
+
+ function jumpToMark(v) {
+ if (v.vsc.mark && typeof v.vsc.mark === "number") {
+ v.currentTime = v.vsc.mark;
+ }
+ }
+
function handleDrag(video, controller, e) {
const shadowController = controller.shadowRoot.querySelector('#controller');
diff --git a/options.css b/options.css
index 22ad04e..eb47e18 100644
--- a/options.css
+++ b/options.css
@@ -100,4 +100,9 @@ select {
.customForce {
display: none;
+}
+
+.customKey {
+ color: transparent;
+ text-shadow: 0 0 0 #000000;
}
\ No newline at end of file
diff --git a/options.js b/options.js
index 474be69..6071d0a 100644
--- a/options.js
+++ b/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 = `
@@ -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;
}
})
});