diff --git a/.vscode/settings.json b/.vscode/settings.json index 62236a5..610d7ee 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -30,6 +30,7 @@ "insta", "letterboxed", "manjaro", + "mdicon", "mdijs", "minification", "mitigations", diff --git a/src/csui/src/PlayerUiPanels/VideoSettings.vue b/src/csui/src/PlayerUiPanels/VideoSettings.vue index 10060a8..e276a65 100644 --- a/src/csui/src/PlayerUiPanels/VideoSettings.vue +++ b/src/csui/src/PlayerUiPanels/VideoSettings.vue @@ -44,13 +44,21 @@ :key="index" :label="command.label" :shortcut="getKeyboardShortcutLabel(command)" - @click="editMode ? editAction(command, 'crop') : execAction(command)" + @click="editMode ? editAction(command, index, 'crop') : execAction(command)" > -
+
+
+ Click a button to edit +
+
+
Editing options for: {{editModeOptions?.crop?.selected?.label}} @@ -101,6 +109,19 @@
+
+
+ Delete +
+
+
Cancel
+
Save
+
+
@@ -175,6 +196,8 @@ + +
Extension default
@@ -411,7 +434,6 @@ export default { BrowserDetect.runtime.openOptionsPage(); }, - toggleZoomAr() { this.zoomAspectRatioLocked = !this.zoomAspectRatioLocked; }, @@ -523,12 +545,13 @@ export default { this.editMode = false; }, - editAction(command, actionType) { + editAction(command, index, actionType) { try { if (!this.editModeOptions[actionType]) { - this.editModeOptions[actionType] = {selected: command} + this.editModeOptions[actionType] = {selected: command, selectedIndex: index} } else { this.editModeOptions[actionType].selected = command; + this.editModeOptions[actionType].selectedIndex = index; } } catch (e) { console.error(`[Ultrawidify] there's a problem with VideoSettings.vue::editAction():`, e); @@ -546,6 +569,36 @@ export default { console.error(`[Ultrawidify] there's a problem with VideoSettings.vue::updateShortcut():`, e); } }, + + cancelEdit(actionType) { + try { + if (!this.editModeOptions[actionType]) { + return; + } else { + this.editModeOptions[actionType] = undefined;; + } + } catch (e) { + console.error(`[Ultrawidify] there's a problem with VideoSettings.vue::cancelEdit():`, e); + } + }, + + saveShortcut(actionType) { + if (!this.editModeOptions[actionType]?.selectedIndex) { + this.settings.active.commands[actionType].push(this.editModeOptions[actionType].selected); + } + this.settings.active.commands[actionType][this.editModeOptions[actionType].selectedIndex] = this.editModeOptions[actionType]?.selected; + this.settings.saveWithoutReload(); + + this.editModeOptions[actionType] = undefined; + }, + + deleteAction(actionType) { + this.settings.active.commands[actionType].splice(this.editModeOptions[actionType].selectedIndex, 1); + this.cancelEdit(); + + this.editModeOptions[actionType] = undefined; + }, + //#endregion //#region comms and bus