Browse Source

ref!: remove "clear queue" button

Sv443 8 months ago
parent
commit
d70606a43b
5 changed files with 13 additions and 34 deletions
  1. 2 0
      assets/style/aboveQueueBtns.css
  2. 9 4
      src/config.ts
  3. 0 6
      src/features/index.ts
  4. 2 22
      src/features/layout.ts
  5. 0 2
      src/types.ts

+ 2 - 0
assets/style/aboveQueueBtns.css

@@ -7,6 +7,8 @@
   margin: unset;
   background-color: var(--bytm-themed-bg);
   border-bottom: 1px solid var(--ytmusic-divider);
+  /* fallback for when the ThemeSong bg color is a gradient function instead of a color value */
+  backdrop-filter: blur(8px);
 }
 
 #side-panel ytmusic-tab-renderer ytmusic-queue-header-renderer.hidden {

+ 9 - 4
src/config.ts

@@ -94,10 +94,15 @@ export const migrations: DataMigrationsDict = {
   // TODO(v2.2): set autoLikeChannels to true on migration once feature is fully implemented
 
   // 6 -> 7 (v2.2)
-  7: (oldData: FeatureConfig) => useDefaultConfig(oldData, [
-    "showToastOnGenericError", "sponsorBlockIntegration",
-    "themeSongIntegration", "themeSongLightness",
-  ]),
+  7: (oldData: FeatureConfig) => {
+    const newData = useDefaultConfig(oldData, [
+      "showToastOnGenericError", "sponsorBlockIntegration",
+      "themeSongIntegration", "themeSongLightness",
+    ]);
+    if("clearQueueBtn" in newData)
+      delete newData.clearQueueBtn;
+    return newData;
+  },
 } as const satisfies DataMigrationsDict;
 
 /** Uses the default config as the base, then overwrites all values with the passed {@linkcode baseData}, then sets all passed {@linkcode resetKeys} to their default values */

+ 0 - 6
src/features/index.ts

@@ -380,12 +380,6 @@ export const featInfo = {
     default: true,
     textAdornment: adornments.reloadRequired,
   },
-  clearQueueBtn: {
-    type: "toggle",
-    category: "songLists",
-    default: true,
-    textAdornment: adornments.reloadRequired,
-  },
 
   //#region behavior
   disableBeforeUnloadPopup: {

+ 2 - 22
src/features/layout.ts

@@ -2,7 +2,7 @@ import { addParent, autoPlural, debounce, fetchAdvanced, pauseFor } from "@sv443
 import { getFeature, getFeatures } from "../config.js";
 import { siteEvents } from "../siteEvents.js";
 import { addSelectorListener } from "../observers.js";
-import { error, getResourceUrl, log, warn, t, onInteraction, openInTab, getBestThumbnailUrl, getDomain, currentMediaType, domLoaded, waitVideoElementReady, getVideoTime, addStyleFromResource, fetchVideoVotes, getWatchId, getLocale, tp } from "../utils/index.js";
+import { error, getResourceUrl, log, warn, t, onInteraction, openInTab, getBestThumbnailUrl, getDomain, currentMediaType, domLoaded, waitVideoElementReady, addStyleFromResource, fetchVideoVotes, getWatchId, getLocale, tp } from "../utils/index.js";
 import { mode, scriptInfo } from "../constants.js";
 import { openCfgMenu } from "../menu/menu_old.js";
 import { createCircularBtn, createRipple } from "../components/index.js";
@@ -365,7 +365,7 @@ export async function fixSpacing() {
 //#region ab.queue btns
 
 export async function initAboveQueueBtns() {
-  const { scrollToActiveSongBtn, clearQueueBtn } = getFeatures();
+  const { scrollToActiveSongBtn } = getFeatures();
 
   const contBtns = [
     {
@@ -385,26 +385,6 @@ export async function initAboveQueueBtns() {
         });
       },
     },
-    {
-      condition: clearQueueBtn,
-      id: "clear-queue",
-      resourceName: "icon-clear_list",
-      titleKey: "clear_list",
-      async interaction(evt: KeyboardEvent | MouseEvent) {
-        try {
-          // TODO: better confirmation dialog?
-          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);
-        }
-      },
-    },
   ];
 
   if(!contBtns.some(b => Boolean(b.condition)))

+ 0 - 2
src/types.ts

@@ -511,8 +511,6 @@ export interface FeatureConfig {
   listButtonsPlacement: "queueOnly" | "everywhere";
   /** Add a button above the queue to scroll to the currently playing song */
   scrollToActiveSongBtn: boolean;
-  /** Add a button above the queue to clear it */
-  clearQueueBtn: boolean;
 
   //#region behavior
   /** Whether to completely disable the popup that sometimes appears before leaving the site */