diff --git a/src/webui/www/private/addtorrent.html b/src/webui/www/private/addtorrent.html
index 4a68d3999..eedf14cc0 100644
--- a/src/webui/www/private/addtorrent.html
+++ b/src/webui/www/private/addtorrent.html
@@ -7,8 +7,10 @@
+
+
@@ -118,6 +120,10 @@
}
}
+ #btn-group-tagsSelect button {
+ background-color: initial;
+ }
+
@@ -202,6 +208,17 @@
+
+
+
+ |
+
+
+
+
+
+ |
+
diff --git a/src/webui/www/private/scripts/addtorrent.js b/src/webui/www/private/scripts/addtorrent.js
index cadee8783..2d60a446c 100644
--- a/src/webui/www/private/scripts/addtorrent.js
+++ b/src/webui/www/private/scripts/addtorrent.js
@@ -52,6 +52,26 @@ window.qBittorrent.AddTorrent ??= (() => {
}
};
+ const getTags = () => {
+ const tagsSelect = document.getElementById("tagsSelect");
+ for (const tag of window.parent.qBittorrent.Client.tagMap.keys()) {
+ const option = document.createElement("option");
+ option.value = tag;
+ option.textContent = tag;
+ tagsSelect.appendChild(option);
+ }
+
+ new vanillaSelectBox("#tagsSelect", {
+ maxHeight: 200,
+ search: false,
+ disableSelectAll: true,
+ translations: {
+ all: (window.parent.qBittorrent.Client.tagMap.length === 0) ? "" : "QBT_TR(All)QBT_TR[CONTEXT=AddNewTorrentDialog]",
+ },
+ keepInlineStyles: false
+ });
+ };
+
const getPreferences = () => {
const pref = window.parent.qBittorrent.Cache.preferences.get();
@@ -137,6 +157,11 @@ window.qBittorrent.AddTorrent ??= (() => {
}
};
+ const changeTagsSelect = (element) => {
+ const tags = [...element.options].filter(opt => opt.selected).map(opt => opt.value);
+ document.getElementById("tags").value = tags.join(",");
+ };
+
const isAutoTMMEnabled = () => {
return document.getElementById("autoTMM").selectedIndex === 1;
};
@@ -285,10 +310,12 @@ window.qBittorrent.AddTorrent ??= (() => {
getPreferences();
getCategories();
+ getTags();
});
window.addEventListener("DOMContentLoaded", (event) => {
document.getElementById("useDownloadPath").addEventListener("change", (e) => changeUseDownloadPath(e.target.checked));
+ document.getElementById("tagsSelect").addEventListener("change", (e) => changeTagsSelect(e.target));
});
return exports();
|