home · contact · privacy
Add informative label to auto-injection checkbox in /downloads. master
authorPlom Heller <plom@plomlompom.com>
Thu, 19 Mar 2026 23:22:36 +0000 (00:22 +0100)
committerPlom Heller <plom@plomlompom.com>
Thu, 19 Mar 2026 23:22:36 +0000 (00:22 +0100)
src/templates/downloads.js

index d59dd7c6087ec9caa9166e8214bdf2b9db9fd658..3686e3c8f1a7698b45bd6a0f89b823dbf52b87e7 100644 (file)
@@ -50,10 +50,10 @@ import {
     SYMBOL_UP,
     addATdTo,
     addButtonTo,
-    addChildTo,
     addCheckboxTo,
     addPlayerBtnTo,
     addTdTo,
+    addTextTo,
     drawTable,
     eventHandlers,
     subscribeEvents,
@@ -82,17 +82,31 @@ eventHandlers.downloads = (data) => {
                 command
             )
         ),
-        addInjectionCheckbox = (
-            td,
-            item
-        ) => addCheckboxTo(
-            td,
-            item.to_inject,
-            () => wrappedCommand(
-                PATH_DOWNLOADS_JSON,
-                `${item.to_inject ? "un" : "in"}ject_${item.yt_id}`
-            )
-        ),
+        addDownloadControls = (
+            tr,
+            item,
+            removeCommand
+        ) => {
+            const td = addTdTo(tr);
+            addCheckboxTo(
+                td,
+                item.to_inject,
+                () => wrappedCommand(
+                    PATH_DOWNLOADS_JSON,
+                    `${item.to_inject ? "un" : "in"}ject_${item.yt_id}`
+                )
+            );
+            addTextTo(
+                td,
+                " (auto-inject) "
+            );
+            addCommandButtonTo(
+                td,
+                SYMBOL_RM,
+                false,
+                removeCommand
+            );
+        },
         drawDownloadTable = (
             items,
             populateRow,
@@ -139,15 +153,9 @@ eventHandlers.downloads = (data) => {
             tr,
             downloading
         ) => {
-            const tdEntryControl = addTdTo(tr);  // col 1
-            addInjectionCheckbox(
-                tdEntryControl,
-                data.downloading
-            );
-            addCommandButtonTo(
-                tdEntryControl,
-                SYMBOL_RM,
-                false,
+            addDownloadControls(  // col 1
+                tr,
+                downloading,
                 CMD_RM
             );
             addTdTo(  // col 2
@@ -170,17 +178,12 @@ eventHandlers.downloads = (data) => {
             idx,
             arr
         ) => {
-            addCommandButtonTo(  // col 1
+            addDownloadControls(  // col 1
                 tr,
-                SYMBOL_RM,
-                false,
+                toDownload,
                 `${CMD_RM}_${idx}`
             );
-            const tdEntryControl = addTdTo(tr);  // col 2
-            addInjectionCheckbox(
-                tdEntryControl,
-                toDownload
-            );
+            const tdCol1 = addTdTo(tr);  // col 2
             for (
                 const [
                     symbol,
@@ -193,7 +196,7 @@ eventHandlers.downloads = (data) => {
                     ((idx + IDX_INC) === arr.length &&
                       symbol === SYMBOL_DOWN);
                 addCommandButtonTo(
-                    tdEntryControl,
+                    tdCol1,
                     symbol,
                     disabled,
                     `${prefix}_${idx}`