瀏覽代碼

feat: special shift and ctrl modifiers for above queue btns

Sv443 10 月之前
父節點
當前提交
f888fa9382
共有 2 個文件被更改,包括 13 次插入10 次删除
  1. 3 0
      changelog.md
  2. 10 10
      src/features/layout.ts

+ 3 - 0
changelog.md

@@ -5,6 +5,7 @@
 - **Features:**
   - Auto-like videos and songs of channels where this feature was enabled
     - Added an auto-like toggle button to the channel pages on YT and YTM
+  - Show the amount of likes and dislikes on the currently playing song
 - **Changes / Fixes:**
   - Now the welcome menu is shown on YT too
   - Changed default settings for these features:
@@ -16,6 +17,8 @@
     - Disable Dark Reader sites
     - Remove share tracking parameter sites
     - Placement of list/queue buttons
+  - Added Shift and Ctrl modifier keys to the above-queue buttons that can skip prompts or customize the behavior
+  - Arrow key and number key skipping works more reliably and also in the config menu now
 
 <details><summary>Click to expand internal and plugin changes</summary>
 

+ 10 - 10
src/features/layout.ts

@@ -393,14 +393,14 @@ export async function initAboveQueueBtns() {
       id: "scroll-to-active",
       resourceName: "icon-skip_to",
       titleKey: "scroll_to_playing",
-      async interaction() {
+      async interaction(evt: KeyboardEvent | MouseEvent) {
         const activeItem = document.querySelector<HTMLElement>("#side-panel .ytmusic-player-queue ytmusic-player-queue-item[play-button-state=\"loading\"], #side-panel .ytmusic-player-queue ytmusic-player-queue-item[play-button-state=\"playing\"], #side-panel .ytmusic-player-queue ytmusic-player-queue-item[play-button-state=\"paused\"]");
         if(!activeItem)
           return;
 
         activeItem.scrollIntoView({
-          behavior: "smooth",
-          block: "center",
+          behavior: evt.shiftKey ? "instant" : "smooth",
+          block: evt.ctrlKey ? "end" : "center",
           inline: "center",
         });
       },
@@ -410,15 +410,15 @@ export async function initAboveQueueBtns() {
       id: "clear-queue",
       resourceName: "icon-clear_list",
       titleKey: "clear_list",
-      async interaction() {
+      async interaction(evt: KeyboardEvent | MouseEvent) {
         try {
           // TODO: better confirmation dialog?
-          if(!confirm(t("clear_list_confirm")))
-            return;
-          const url = new URL(location.href);
-          url.searchParams.delete("list");
-          url.searchParams.set("time_continue", String(await getVideoTime(0)));
-          location.assign(url);
+          if(evt.shiftKey || confirm(t("clear_list_confirm"))) {
+            const url = new URL(location.href);
+            url.searchParams.delete("list");
+            url.searchParams.set("time_continue", String(await getVideoTime(0)));
+            location.assign(url);
+          }
         }
         catch(err) {
           error("Couldn't clear queue due to an error:", err);