diff --git a/private/css/cjratliff.css b/private/css/cjratliff.css index fe0212c..a5ef567 100644 --- a/private/css/cjratliff.css +++ b/private/css/cjratliff.css @@ -8,6 +8,7 @@ --darkmode-text: #c2c2c2; --darkmode-text-alt: #d3d3d3; --color-text-default: var(--darkmode-background); + --color-text-white: #fff; --darkmode-line-color: #2F3437; --highlight-color--darkred: #b83739; --highlight-color--red: #ce292c; diff --git a/private/css/dynamicTable.css b/private/css/dynamicTable.css index 3def131..09fc298 100644 --- a/private/css/dynamicTable.css +++ b/private/css/dynamicTable.css @@ -21,7 +21,7 @@ .dynamicTable tbody tr.selected, .dynamicTable tbody tr:hover { - background-color: var(--darkmode-background-light); + background-color: var(--darkmode-text-alt); color: var(--darkmode-background) } diff --git a/private/css/style.css b/private/css/style.css index 42bfc2d..6e3cf95 100644 --- a/private/css/style.css +++ b/private/css/style.css @@ -689,7 +689,7 @@ ul.filterList span.link { ul.filterList span.link:hover { background-color: var(--darkmode-primary); - color: var(--color-text-white); + color: var(--darkmode-background) !important; } span.link :last-child { @@ -705,7 +705,7 @@ span.link :is(img, button) { .selectedFilter > span.link { background-color: var(--color-background-blue); - color: var(--color-text-white); + color: var(--darkmode-background); } .subcategories, diff --git a/private/scripts/mocha-init.js b/private/scripts/mocha-init.js index 935db47..0d43fc4 100644 --- a/private/scripts/mocha-init.js +++ b/private/scripts/mocha-init.js @@ -140,6 +140,12 @@ let createTagFN = function() {}; let removeTagFN = function() {}; let deleteUnusedTagsFN = function() {}; + let startTorrentsByTagFN = function() {}; + let stopTorrentsByTagFN = function() {}; + let deleteTorrentsByTagFN = function() {}; + let startTorrentsByTrackerFN = function() {}; + let stopTorrentsByTrackerFN = function() {}; + let deleteTorrentsByTrackerFN = function() {}; let deleteTrackerFN = function() {}; let copyNameFN = function() {}; let copyInfohashFN = function(policy) {}; @@ -1009,6 +1015,203 @@ }).send(); setTagFilter(TAGS_ALL); }; + + startTorrentsByTagFN = function(tagHash) { + const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL); + if (hashes.length) { + new Request({ + url: "api/v2/torrents/start", + method: "post", + data: { + hashes: hashes.join("|") + } + }).send(); + updateMainData(); + } + }; + + stopTorrentsByTagFN = function(tagHash) { + const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL); + if (hashes.length) { + new Request({ + url: "api/v2/torrents/stop", + method: "post", + data: { + hashes: hashes.join("|") + } + }).send(); + updateMainData(); + } + }; + + deleteTorrentsByTagFN = function(tagHash) { + const hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, tagHash, TRACKERS_ALL); + if (hashes.length > 0) { + if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) { + new MochaUI.Modal({ + ...window.qBittorrent.Dialog.baseModalOptions, + id: "confirmDeletionPage", + title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]", + data: { hashes: hashes }, + contentURL: "views/confirmdeletion.html", + onContentLoaded: function(w) { + MochaUI.resizeWindow(w, { centered: true }); + MochaUI.centerWindow(w); + }, + onCloseComplete: function() { + // make sure overlay is properly hidden upon modal closing + document.getElementById("modalOverlay").style.display = "none"; + } + }); + } + else { + new Request({ + url: "api/v2/torrents/delete", + method: "post", + data: { + hashes: hashes.join("|"), + deleteFiles: false, + }, + onSuccess: function() { + torrentsTable.deselectAll(); + updateMainData(); + }, + onFailure: function() { + alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]"); + } + }).send(); + } + } + }; + + startTorrentsByTrackerFN = function(trackerHash) { + const trackerHashInt = Number.parseInt(trackerHash, 10); + let hashes = []; + switch (trackerHashInt) { + case TRACKERS_ALL: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL); + break; + case TRACKERS_TRACKERLESS: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS); + break; + default: { + const uniqueTorrents = new Set(); + for (const torrents of trackerList.get(trackerHashInt).trackerTorrentMap.values()) { + for (const torrent of torrents) + uniqueTorrents.add(torrent); + } + hashes = [...uniqueTorrents]; + break; + } + } + + if (hashes.length > 0) { + new Request({ + url: "api/v2/torrents/start", + method: "post", + data: { + hashes: hashes.join("|") + } + }).send(); + updateMainData(); + } + }; + + stopTorrentsByTrackerFN = function(trackerHash) { + const trackerHashInt = Number.parseInt(trackerHash, 10); + let hashes = []; + switch (trackerHashInt) { + case TRACKERS_ALL: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL); + break; + case TRACKERS_TRACKERLESS: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS); + break; + default: { + const uniqueTorrents = new Set(); + for (const torrents of trackerList.get(trackerHashInt).trackerTorrentMap.values()) { + for (const torrent of torrents) + uniqueTorrents.add(torrent); + } + hashes = [...uniqueTorrents]; + break; + } + } + + if (hashes.length) { + new Request({ + url: "api/v2/torrents/stop", + method: "post", + data: { + hashes: hashes.join("|") + } + }).send(); + updateMainData(); + } + }; + + deleteTorrentsByTrackerFN = function(trackerHash) { + const trackerHashInt = Number.parseInt(trackerHash, 10); + let hashes = []; + switch (trackerHashInt) { + case TRACKERS_ALL: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_ALL); + break; + case TRACKERS_TRACKERLESS: + hashes = torrentsTable.getFilteredTorrentsHashes("all", CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS); + break; + default: { + const uniqueTorrents = new Set(); + for (const torrents of trackerList.get(trackerHashInt).trackerTorrentMap.values()) { + for (const torrent of torrents) + uniqueTorrents.add(torrent); + } + hashes = [...uniqueTorrents]; + break; + } + } + + if (hashes.length > 0) { + if (window.qBittorrent.Cache.preferences.get().confirm_torrent_deletion) { + new MochaUI.Modal({ + ...window.qBittorrent.Dialog.baseModalOptions, + id: "confirmDeletionPage", + title: "QBT_TR(Remove torrent(s))QBT_TR[CONTEXT=confirmDeletionDlg]", + data: { + hashes: hashes, + filterList: "tracker" + }, + contentURL: "views/confirmdeletion.html", + onContentLoaded: function(w) { + MochaUI.resizeWindow(w, { centered: true }); + MochaUI.centerWindow(w); + }, + onCloseComplete: function() { + // make sure overlay is properly hidden upon modal closing + document.getElementById("modalOverlay").style.display = "none"; + } + }); + } + else { + new Request({ + url: "api/v2/torrents/delete", + method: "post", + data: { + hashes: hashes.join("|"), + deleteFiles: false, + }, + onSuccess: function() { + torrentsTable.deselectAll(); + setTrackerFilter(TRACKERS_ALL); + updateMainData(); + }, + onFailure: function() { + alert("QBT_TR(Unable to delete torrents.)QBT_TR[CONTEXT=HttpServer]"); + }, + }).send(); + } + } + }; deleteTrackerFN = function(trackerHash) { const trackerHashInt = Number.parseInt(trackerHash, 10); diff --git a/private/views/log.html b/private/views/log.html index 69f42e2..267c6a4 100644 --- a/private/views/log.html +++ b/private/views/log.html @@ -55,21 +55,21 @@ font-style: italic; } - .logTableRowlogNormal { - color: var(--color-text-default); + .dynamicTable tbody tr.logTableRowlogNormal { + color: var(--darkmode-text); } - .logTableRowlogInfo { - color: var(--color-text-blue); + .dynamicTable tbody tr.logTableRowlogInfo { + color: var(--highlight-color--blue); } - .logTableRowlogWarning { - color: var(--color-text-orange); + .dynamicTable tbody tr.logTableRowlogWarning { + color: var(--highlight-color--orange); } - .logTableRowlogCritical, - .logTableRowpeerBlocked { - color: var(--color-text-red); + .dynamicTable tbody tr.logTableRowlogCritical, + .dynamicTable tbody tr.logTableRowpeerBlocked { + color: var(--highlight-color--red); } .vsb-main>button {