diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 6daa31b38..83db30de8 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -672,36 +672,6 @@ window.addEventListener("DOMContentLoaded", () => { tracker.classList.toggle("selectedFilter", (Number(tracker.id) === selectedTracker)); }; - const setupCopyEventHandler = (function() { - let clipboardEvent; - - return () => { - if (clipboardEvent) - clipboardEvent.destroy(); - - clipboardEvent = new ClipboardJS(".copyToClipboard", { - text: function(trigger) { - switch (trigger.id) { - case "copyName": - return copyNameFN(); - case "copyInfohash1": - return copyInfohashFN(1); - case "copyInfohash2": - return copyInfohashFN(2); - case "copyMagnetLink": - return copyMagnetLinkFN(); - case "copyID": - return copyIdFN(); - case "copyComment": - return copyCommentFN(); - default: - return ""; - } - } - }); - }; - })(); - let syncMainDataTimeoutID = -1; let syncRequestInProgress = false; const syncMainData = function() { @@ -824,7 +794,6 @@ window.addEventListener("DOMContentLoaded", () => { updateTrackers = true; } if (response["torrents"]) { - let updateTorrentList = false; for (const key in response["torrents"]) { if (!Object.hasOwn(response["torrents"], key)) continue; @@ -838,12 +807,7 @@ window.addEventListener("DOMContentLoaded", () => { update_categories = true; if (addTorrentToTagList(response["torrents"][key])) updateTags = true; - if (response["torrents"][key]["name"]) - updateTorrentList = true; } - - if (updateTorrentList) - setupCopyEventHandler(); } if (response["torrents_removed"]) { response["torrents_removed"].each((hash) => { @@ -1663,6 +1627,27 @@ window.addEventListener("DOMContentLoaded", () => { } } }).activate(); + + new ClipboardJS(".copyToClipboard", { + text: function(trigger) { + switch (trigger.id) { + case "copyName": + return copyNameFN(); + case "copyInfohash1": + return copyInfohashFN(1); + case "copyInfohash2": + return copyInfohashFN(2); + case "copyMagnetLink": + return copyMagnetLinkFN(); + case "copyID": + return copyIdFN(); + case "copyComment": + return copyCommentFN(); + default: + return ""; + } + } + }); }); window.addEventListener("load", () => {