From 1d6af228130de94633d84a95a9a64e7e08841a95 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 21:07:27 +0800 Subject: [PATCH 1/7] Add tools for js code formatting and linting Due to eslint couldn't correctly resolve the context for the variables, two eslint rules are disabled for now. --- src/webui/www/.eslintrc.json | 14 ++++++++++++++ src/webui/www/.jsbeautifyrc | 2 +- src/webui/www/package.json | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/webui/www/.eslintrc.json create mode 100644 src/webui/www/package.json diff --git a/src/webui/www/.eslintrc.json b/src/webui/www/.eslintrc.json new file mode 100644 index 000000000..c2cb0a275 --- /dev/null +++ b/src/webui/www/.eslintrc.json @@ -0,0 +1,14 @@ +{ + "env": { + "browser": true, + "es2020": true + }, + "extends": "eslint:recommended", + "plugins": [ + "html" + ], + "rules": { + "no-undef": "off", + "no-unused-vars": "off" + } +} diff --git a/src/webui/www/.jsbeautifyrc b/src/webui/www/.jsbeautifyrc index 63cfb7984..8aa593440 100644 --- a/src/webui/www/.jsbeautifyrc +++ b/src/webui/www/.jsbeautifyrc @@ -11,7 +11,7 @@ "space_in_empty_paren": false, "jslint_happy": false, "space_after_anon_function": false, - "brace_style": "end-expand", + "brace_style": "end-expand,preserve-inline", "unindent_chained_methods": false, "break_chained_methods": false, "keep_array_indentation": false, diff --git a/src/webui/www/package.json b/src/webui/www/package.json new file mode 100644 index 000000000..e94124882 --- /dev/null +++ b/src/webui/www/package.json @@ -0,0 +1,17 @@ +{ + "name": "webui", + "description": "qBittorrent WebUI", + "repository": { + "type": "git", + "url": "https://github.com/qbittorrent/qBittorrent.git" + }, + "scripts": { + "format": "js-beautify private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js", + "lint": "eslint private/*.html private/scripts/*.js private/views/*.html public/*.html public/scripts/*.js" + }, + "devDependencies": { + "eslint": "*", + "eslint-plugin-html": "*", + "js-beautify": "*" + } +} From c3bab70434f0b43bbac3b5f876134c2d9924e451 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 21:59:15 +0800 Subject: [PATCH 2/7] Remove extra semicolon --- src/webui/www/private/views/rss.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html index ad0ae50fe..233dbf843 100644 --- a/src/webui/www/private/views/rss.html +++ b/src/webui/www/private/views/rss.html @@ -179,7 +179,7 @@ }; let feedData = {}; - let pathByFeedId = new Map();; + let pathByFeedId = new Map(); let feedRefreshTimer; let rssFeedTable = new window.qBittorrent.DynamicTable.RssFeedTable(); let rssArticleTable = new window.qBittorrent.DynamicTable.RssArticleTable(); From 1f1cabd14457aeedb5587c1892cb62ee8b0ce79b Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 22:00:36 +0800 Subject: [PATCH 3/7] Remove unnecessary escape character --- src/webui/www/private/scripts/misc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js index f9fd8f9f8..8a219e216 100644 --- a/src/webui/www/private/scripts/misc.js +++ b/src/webui/www/private/scripts/misc.js @@ -162,7 +162,7 @@ window.qBittorrent.Misc = (function() { * JS counterpart of the function in src/misc.cpp */ const parseHtmlLinks = function(text) { - const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; + const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig; return text.replace(exp, "$1"); } From 5fe0e9395fa02f6dea67dee090c8840060f7ac5d Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 22:03:27 +0800 Subject: [PATCH 4/7] Don't use Object.prototypes builtins directly See: https://eslint.org/docs/rules/no-prototype-builtins --- src/webui/www/private/scripts/client.js | 4 ++-- src/webui/www/private/scripts/dynamicTable.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index 4600f40fa..f8e51015a 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -464,7 +464,7 @@ window.addEvent('load', function() { const torrentsCount = torrentsTable.getRowIds().length; let untagged = 0; for (const key in torrentsTable.rows) { - if (torrentsTable.rows.hasOwnProperty(key) && torrentsTable.rows[key]['full_data'].tags.length === 0) + if (Object.prototype.hasOwnProperty.call(torrentsTable.rows, key) && (torrentsTable.rows[key]['full_data'].tags.length === 0)) untagged += 1; } tagFilterList.appendChild(createLink(TAGS_ALL, 'QBT_TR(All)QBT_TR[CONTEXT=TagFilterModel]', torrentsCount)); @@ -519,7 +519,7 @@ window.addEvent('load', function() { trackerFilterList.appendChild(createLink(TRACKERS_ALL, 'QBT_TR(All (%1))QBT_TR[CONTEXT=TrackerFiltersList]', torrentsCount)); let trackerlessTorrentsCount = 0; for (const key in torrentsTable.rows) { - if (torrentsTable.rows.hasOwnProperty(key) && (torrentsTable.rows[key]['full_data'].trackers_count === 0)) + if (Object.prototype.hasOwnProperty.call(torrentsTable.rows, key) && (torrentsTable.rows[key]['full_data'].trackers_count === 0)) trackerlessTorrentsCount += 1; } trackerFilterList.appendChild(createLink(TRACKERS_TRACKERLESS, 'QBT_TR(Trackerless (%1))QBT_TR[CONTEXT=TrackerFiltersList]', trackerlessTorrentsCount)); diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 9b3649057..41e311501 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -778,7 +778,7 @@ window.qBittorrent.DynamicTable = (function() { const tds = tr.getElements('td'); for (let i = 0; i < this.columns.length; ++i) { - if (data.hasOwnProperty(this.columns[i].dataProperties[0])) + if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0])) this.columns[i].updateTd(tds[i], row); } row['data'] = {}; @@ -2058,7 +2058,7 @@ window.qBittorrent.DynamicTable = (function() { const tds = tr.getElements('td'); for (let i = 0; i < this.columns.length; ++i) { - if (data.hasOwnProperty(this.columns[i].dataProperties[0])) + if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0])) this.columns[i].updateTd(tds[i], row); } row['data'] = {}; @@ -2203,7 +2203,7 @@ window.qBittorrent.DynamicTable = (function() { const tds = tr.getElements('td'); for (let i = 0; i < this.columns.length; ++i) { - if (data.hasOwnProperty(this.columns[i].dataProperties[0])) + if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0])) this.columns[i].updateTd(tds[i], row); } row['data'] = {}; @@ -2484,7 +2484,7 @@ window.qBittorrent.DynamicTable = (function() { const tds = tr.getElements('td'); for (let i = 0; i < this.columns.length; ++i) { - if (data.hasOwnProperty(this.columns[i].dataProperties[0])) + if (Object.prototype.hasOwnProperty.call(data, this.columns[i].dataProperties[0])) this.columns[i].updateTd(tds[i], row); } row['data'] = {}; From af85a8a340d7384e38066e3c00c8f436cac1ac27 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 23:06:15 +0800 Subject: [PATCH 5/7] Add necessary curly brackets --- src/webui/www/private/scripts/dynamicTable.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 41e311501..9ed1addb6 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1287,13 +1287,15 @@ window.qBittorrent.DynamicTable = (function() { return false; break; // do nothing - default: + default: { let rowTags = row['full_data'].tags.split(', '); rowTags = rowTags.map(function(tag) { return genHash(tag); }); if (!rowTags.contains(tagHashInt)) return false; + break; + } } } @@ -1305,11 +1307,12 @@ window.qBittorrent.DynamicTable = (function() { if (row['full_data'].trackers_count !== 0) return false; break; - default: + default: { const tracker = trackerList.get(trackerHashInt); if (tracker && !tracker.torrents.includes(row['full_data'].rowId)) return false; break; + } } if ((filterTerms !== undefined) && (filterTerms !== null) From 45465e994e778d008312419a634725b1014e68a4 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Tue, 23 Mar 2021 22:20:37 +0800 Subject: [PATCH 6/7] Add WebUI checking to CI --- .github/workflows/webui_ci.yaml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/webui_ci.yaml diff --git a/.github/workflows/webui_ci.yaml b/.github/workflows/webui_ci.yaml new file mode 100644 index 000000000..aa836523d --- /dev/null +++ b/.github/workflows/webui_ci.yaml @@ -0,0 +1,31 @@ +name: WebUI CI + +on: [pull_request, push] + +jobs: + check_webui: + name: Check WebUI + runs-on: ubuntu-20.04 + defaults: + run: + working-directory: src/webui/www + + steps: + - name: checkout repository + uses: actions/checkout@v2 + + - name: setup nodejs + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: install tools + run: npm install + + - name: lint code + run: npm run lint + + - name: format code + run: | + npm run format + git diff --exit-code From 121ff2b7bec0a2263248f9666633565aa7e9edf5 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Wed, 24 Mar 2021 14:00:27 +0800 Subject: [PATCH 7/7] Apply code formatting --- src/webui/www/private/addpeers.html | 114 ++++++------ src/webui/www/private/addtrackers.html | 4 +- src/webui/www/private/confirmdeletion.html | 4 +- src/webui/www/private/download.html | 2 +- src/webui/www/private/edittracker.html | 4 +- src/webui/www/private/index.html | 170 +++++++++--------- src/webui/www/private/scripts/client.js | 17 +- src/webui/www/private/scripts/dynamicTable.js | 17 +- src/webui/www/private/scripts/misc.js | 16 +- src/webui/www/private/scripts/prop-files.js | 6 +- src/webui/www/private/scripts/speedslider.js | 8 +- src/webui/www/private/views/about.html | 9 +- src/webui/www/private/views/preferences.html | 21 +-- .../www/private/views/propertiesToolbar.html | 6 +- src/webui/www/private/views/rss.html | 33 ++-- .../www/private/views/rssDownloader.html | 55 +++--- src/webui/www/private/views/search.html | 21 ++- .../www/private/views/searchplugins.html | 4 +- src/webui/www/public/index.html | 6 +- 19 files changed, 264 insertions(+), 253 deletions(-) diff --git a/src/webui/www/private/addpeers.html b/src/webui/www/private/addpeers.html index fb19ae181..c2075f763 100644 --- a/src/webui/www/private/addpeers.html +++ b/src/webui/www/private/addpeers.html @@ -1,69 +1,71 @@ - - - QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog] - - - - + + - + }); + + - -
-

QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]

- -
- - -
+ +
+

QBT_TR(List of peers to add (one IP per line):)QBT_TR[CONTEXT=PeersAdditionDialog]

+ +
+ +
- +
+ + diff --git a/src/webui/www/private/addtrackers.html b/src/webui/www/private/addtrackers.html index e78a24091..7321d5a75 100644 --- a/src/webui/www/private/addtrackers.html +++ b/src/webui/www/private/addtrackers.html @@ -47,10 +47,10 @@
-
+

QBT_TR(List of trackers to add (one per line):)QBT_TR[CONTEXT=TrackersAdditionDialog]

-
+
diff --git a/src/webui/www/private/confirmdeletion.html b/src/webui/www/private/confirmdeletion.html index 60aa45f16..6ee9050de 100644 --- a/src/webui/www/private/confirmdeletion.html +++ b/src/webui/www/private/confirmdeletion.html @@ -42,10 +42,10 @@ -
+

  QBT_TR(Are you sure you want to delete the selected torrents from the transfer list?)QBT_TR[CONTEXT=HttpServer]

-     

+     

    
diff --git a/src/webui/www/private/download.html b/src/webui/www/private/download.html index b7a4a50a5..91cbba935 100644 --- a/src/webui/www/private/download.html +++ b/src/webui/www/private/download.html @@ -16,7 +16,7 @@
-
+

QBT_TR(Download Torrents from their URLs or Magnet links)QBT_TR[CONTEXT=HttpServer]

QBT_TR(Only one link per line)QBT_TR[CONTEXT=HttpServer]

diff --git a/src/webui/www/private/edittracker.html b/src/webui/www/private/edittracker.html index c4ffc1ac9..56420fd16 100644 --- a/src/webui/www/private/edittracker.html +++ b/src/webui/www/private/edittracker.html @@ -58,12 +58,12 @@
-
+

QBT_TR(Tracker URL:)QBT_TR[CONTEXT=TrackerListWidget]

-
+
diff --git a/src/webui/www/private/index.html b/src/webui/www/private/index.html index 948914d75..aa01441e5 100644 --- a/src/webui/www/private/index.html +++ b/src/webui/www/private/index.html @@ -46,69 +46,69 @@
  • QBT_TR(File)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Edit)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(View)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Tools)QBT_TR[CONTEXT=MainWindow]
  • QBT_TR(Help)QBT_TR[CONTEXT=MainWindow]
  •    - QBT_TR(Add Torrent Link...)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Add Torrent File...)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Delete)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Resume)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Pause)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Add Torrent Link...)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Add Torrent File...)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Delete)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Resume)QBT_TR[CONTEXT=TransferListWidget] + QBT_TR(Pause)QBT_TR[CONTEXT=TransferListWidget] - QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Top of Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Move Up Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Move Down Queue)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Bottom of Queue)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog] + QBT_TR(Options)QBT_TR[CONTEXT=OptionsDialog]
      -
    • QBT_TR(Rename...)QBT_TR[CONTEXT=PropertiesWidget] QBT_TR(Rename...)QBT_TR[CONTEXT=PropertiesWidget]
    • +
    • QBT_TR(Rename...)QBT_TR[CONTEXT=PropertiesWidget] QBT_TR(Rename...)QBT_TR[CONTEXT=PropertiesWidget]
    • QBT_TR(Priority)QBT_TR[CONTEXT=PropertiesWidget]
        @@ -227,7 +227,7 @@ QBT_TR(Connection status)QBT_TR[CONTEXT=MainWindow] - QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow] + QBT_TR(Alternative speed limits)QBT_TR[CONTEXT=MainWindow] QBT_TR(Download speed icon)QBT_TR[CONTEXT=MainWindow] diff --git a/src/webui/www/private/scripts/client.js b/src/webui/www/private/scripts/client.js index f8e51015a..5ee928af4 100644 --- a/src/webui/www/private/scripts/client.js +++ b/src/webui/www/private/scripts/client.js @@ -701,7 +701,7 @@ window.addEvent('load', function() { }; const syncData = function(delay) { - if (!syncRequestInProgress){ + if (!syncRequestInProgress) { clearTimeout(syncMainDataTimer); syncMainDataTimer = syncMainData.delay(delay); } @@ -744,21 +744,18 @@ window.addEvent('load', function() { } switch (serverState.connection_status) { - case 'connected': { + case 'connected': $('connectionStatus').src = 'icons/connected.svg'; $('connectionStatus').alt = 'QBT_TR(Connection status: Connected)QBT_TR[CONTEXT=MainWindow]'; - } - break; - case 'firewalled': { + break; + case 'firewalled': $('connectionStatus').src = 'icons/firewalled.svg'; $('connectionStatus').alt = 'QBT_TR(Connection status: Firewalled)QBT_TR[CONTEXT=MainWindow]'; - } - break; - default: { + break; + default: $('connectionStatus').src = 'icons/disconnected.svg'; $('connectionStatus').alt = 'QBT_TR(Connection status: Disconnected)QBT_TR[CONTEXT=MainWindow]'; - } - break; + break; } if (queueing_enabled != serverState.queueing) { diff --git a/src/webui/www/private/scripts/dynamicTable.js b/src/webui/www/private/scripts/dynamicTable.js index 9ed1addb6..31bcf62e3 100644 --- a/src/webui/www/private/scripts/dynamicTable.js +++ b/src/webui/www/private/scripts/dynamicTable.js @@ -1007,7 +1007,7 @@ window.qBittorrent.DynamicTable = (function() { this.columns['name'].compareRows = function(row1, row2) { const row1Val = this.getRowValue(row1); const row2Val = this.getRowValue(row2); - return row1Val.localeCompare(row2Val, undefined, {numeric: true, sensitivity: 'base'}); + return row1Val.localeCompare(row2Val, undefined, { numeric: true, sensitivity: 'base' }); }; this.columns['category'].compareRows = this.columns['name'].compareRows; this.columns['tags'].compareRows = this.columns['name'].compareRows; @@ -1264,11 +1264,11 @@ window.qBittorrent.DynamicTable = (function() { if (!isNaN(categoryHashInt)) { switch (categoryHashInt) { case CATEGORIES_ALL: - break; // do nothing + break; // do nothing case CATEGORIES_UNCATEGORIZED: if (row['full_data'].category.length !== 0) return false; - break; // do nothing + break; // do nothing default: if (categoryHashInt !== genHash(row['full_data'].category)) return false; @@ -1280,12 +1280,12 @@ window.qBittorrent.DynamicTable = (function() { if (isNumber) { switch (tagHashInt) { case TAGS_ALL: - break; // do nothing + break; // do nothing case TAGS_UNTAGGED: if (row['full_data'].tags.length !== 0) return false; - break; // do nothing + break; // do nothing default: { let rowTags = row['full_data'].tags.split(', '); @@ -1591,8 +1591,8 @@ window.qBittorrent.DynamicTable = (function() { for (let i = 0; i < rows.length; ++i) { const row = rows[i]; - if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms)) continue; - if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, filterTerms)) continue; + if (searchInTorrentName && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, searchTerms)) continue; + if ((filterTerms.length > 0) && !window.qBittorrent.Misc.containsAllTerms(row.full_data.fileName, filterTerms)) continue; if ((sizeFilters.min > 0.00) && (row.full_data.fileSize < sizeFilters.min)) continue; if ((sizeFilters.max > 0.00) && (row.full_data.fileSize > sizeFilters.max)) continue; if ((seedsFilters.min > 0) && (row.full_data.nbSeeders < seedsFilters.min)) continue; @@ -1912,7 +1912,7 @@ window.qBittorrent.DynamicTable = (function() { _filterNodes: function(node, filterTerms, filteredRows) { if (node.isFolder) { - const childAdded = node.children.reduce(function (acc, child) { + const childAdded = node.children.reduce(function(acc, child) { // we must execute the function before ORing w/ acc or we'll stop checking child nodes after the first successful match return (this._filterNodes(child, filterTerms, filteredRows) || acc); }.bind(this), false); @@ -2494,7 +2494,6 @@ window.qBittorrent.DynamicTable = (function() { } }); - return exports(); })(); diff --git a/src/webui/www/private/scripts/misc.js b/src/webui/www/private/scripts/misc.js index 8a219e216..1504f6663 100644 --- a/src/webui/www/private/scripts/misc.js +++ b/src/webui/www/private/scripts/misc.js @@ -49,8 +49,8 @@ window.qBittorrent.Misc = (function() { }; /* - * JS counterpart of the function in src/misc.cpp - */ + * JS counterpart of the function in src/misc.cpp + */ const friendlyUnit = function(value, isSpeed) { const units = [ "QBT_TR(B)QBT_TR[CONTEXT=misc]", @@ -93,8 +93,8 @@ window.qBittorrent.Misc = (function() { } /* - * JS counterpart of the function in src/misc.cpp - */ + * JS counterpart of the function in src/misc.cpp + */ const friendlyDuration = function(seconds, maxCap = -1) { if (seconds < 0 || ((seconds >= maxCap) && (maxCap >= 0))) return "∞"; @@ -132,8 +132,8 @@ window.qBittorrent.Misc = (function() { } /* - * From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString - */ + * From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString + */ if (!Date.prototype.toISOString) { (function() { @@ -159,8 +159,8 @@ window.qBittorrent.Misc = (function() { } /* - * JS counterpart of the function in src/misc.cpp - */ + * JS counterpart of the function in src/misc.cpp + */ const parseHtmlLinks = function(text) { const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig; return text.replace(exp, "$1"); diff --git a/src/webui/www/private/scripts/prop-files.js b/src/webui/www/private/scripts/prop-files.js index 45462e4d5..87577b096 100644 --- a/src/webui/www/private/scripts/prop-files.js +++ b/src/webui/www/private/scripts/prop-files.js @@ -444,8 +444,8 @@ window.qBittorrent.PropFiles = (function() { if (folderNode === null) { folderNode = new window.qBittorrent.FileTree.FolderNode(); folderNode.path = (parent.path === "") - ? folderName - : [parent.path, folderName].join(window.qBittorrent.Filesystem.PathSeparator); + ? folderName + : [parent.path, folderName].join(window.qBittorrent.Filesystem.PathSeparator); folderNode.name = folderName; folderNode.rowId = rowId; folderNode.root = parent; @@ -542,7 +542,7 @@ window.qBittorrent.PropFiles = (function() { title: "QBT_TR(Renaming)QBT_TR[CONTEXT=TorrentContentTreeView]", loadMethod: 'iframe', contentURL: 'rename_file.html?hash=' + hash + '&isFolder=' + node.isFolder - + '&path=' + encodeURIComponent(path), + + '&path=' + encodeURIComponent(path), scrollbars: false, resizable: false, maximizable: false, diff --git a/src/webui/www/private/scripts/speedslider.js b/src/webui/www/private/scripts/speedslider.js index 32797a83d..da71b62c2 100644 --- a/src/webui/www/private/scripts/speedslider.js +++ b/src/webui/www/private/scripts/speedslider.js @@ -84,7 +84,7 @@ MochaUI.extend({ else { new Request.JSON({ url: 'api/v2/torrents/uploadLimit', - noCache : true, + noCache: true, method: 'post', data: { hashes: hashes.join('|') @@ -92,7 +92,7 @@ MochaUI.extend({ onSuccess: function(data) { if (data) { let up_limit = data[hashes[0]]; - for(const key in data) + for (const key in data) if (up_limit != data[key]) { up_limit = 0; break; @@ -186,7 +186,7 @@ MochaUI.extend({ else { new Request.JSON({ url: 'api/v2/torrents/downloadLimit', - noCache : true, + noCache: true, method: 'post', data: { hashes: hashes.join('|') @@ -194,7 +194,7 @@ MochaUI.extend({ onSuccess: function(data) { if (data) { let dl_limit = data[hashes[0]]; - for(const key in data) + for (const key in data) if (dl_limit != data[key]) { dl_limit = 0; break; diff --git a/src/webui/www/private/views/about.html b/src/webui/www/private/views/about.html index 06572b5ea..fa9cea9a0 100644 --- a/src/webui/www/private/views/about.html +++ b/src/webui/www/private/views/about.html @@ -83,8 +83,8 @@
        - +
        @@ -803,7 +803,8 @@
        - + +
        @@ -1199,7 +1200,7 @@ - + (?) @@ -1207,31 +1208,31 @@ - - + +   % - - + +   % - - + +   s - +
    diff --git a/src/webui/www/private/views/propertiesToolbar.html b/src/webui/www/private/views/propertiesToolbar.html index 789dc320e..aa0c924ad 100644 --- a/src/webui/www/private/views/propertiesToolbar.html +++ b/src/webui/www/private/views/propertiesToolbar.html @@ -1,7 +1,7 @@
    - +
      diff --git a/src/webui/www/private/views/rss.html b/src/webui/www/private/views/rss.html index 233dbf843..dadd3ea57 100644 --- a/src/webui/www/private/views/rss.html +++ b/src/webui/www/private/views/rss.html @@ -11,7 +11,8 @@ vertical-align: top; } - #rssFeedFixedHeaderDiv .dynamicTableHeader, #rssArticleFixedHeaderDiv .dynamicTableHeader { + #rssFeedFixedHeaderDiv .dynamicTableHeader, + #rssArticleFixedHeaderDiv .dynamicTableHeader { cursor: default; } @@ -33,7 +34,9 @@ margin: 0 10px 0 10px; } - #leftRssColumn, #centerRssColumn, #rightRssColumn { + #leftRssColumn, + #centerRssColumn, + #rightRssColumn { float: left; /* should be 20 px but due to rounding differences some browsers don't render that properly */ width: calc(calc(100% - 21px) / 3); @@ -44,7 +47,8 @@ overflow: auto; } - #rssFeedTableDiv, #rssArticleTableDiv { + #rssFeedTableDiv, + #rssArticleTableDiv { height: calc(100vh - 180px); } @@ -172,7 +176,7 @@ refreshAllFeeds: refreshAllFeeds, moveItem: moveItem, addRSSFeed: addRSSFeed, - markSelectedAsRead : markSelectedAsRead, + markSelectedAsRead: markSelectedAsRead, openRssDownloader: openRssDownloader, rssFeedTable: rssFeedTable }; @@ -197,9 +201,9 @@ $('rssFetchingDisabled').removeClass('invisible'); // recalculate heights - let nonPageHeight = $('rssTopBar').getBoundingClientRect().height + - $('desktopHeader').getBoundingClientRect().height + - $('desktopFooterWrapper').getBoundingClientRect().height + 20; + let nonPageHeight = $('rssTopBar').getBoundingClientRect().height + + $('desktopHeader').getBoundingClientRect().height + + $('desktopFooterWrapper').getBoundingClientRect().height + 20; $('rssDetailsView').style.height = 'calc(100vh - ' + nonPageHeight + 'px)'; let nonTableHeight = nonPageHeight + $('rssFeedFixedHeaderDiv').getBoundingClientRect().height; @@ -274,7 +278,6 @@ }); rssFeedTable.setup('rssFeedTableDiv', 'rssFeedFixedHeaderDiv', rssFeedContextMenu); - const rssArticleContextMenu = new window.qBittorrent.ContextMenu.RssArticleContextMenu({ targets: '.rssArticleElement', menu: 'rssArticleMenu', @@ -435,8 +438,8 @@ //calculate height to fill screen document.getElementById('rssDescription').style.height = - "calc(100% - " + document.getElementById('rssTorrentDetailsName').offsetHeight + "px - " + - document.getElementById('rssTorrentDetailsDate').offsetHeight + "px - 5px)"; + "calc(100% - " + document.getElementById('rssTorrentDetailsName').offsetHeight + "px - " + + document.getElementById('rssTorrentDetailsDate').offsetHeight + "px - 5px)"; } }; @@ -479,8 +482,8 @@ if (rssFeedTable.rows.getLength() - 1 === flattenedResp.length) { match = true; for (let i = 0; i < flattenedResp.length; ++i) { - if ((flattenedResp[i].uid ? flattenedResp[i].uid : '') !== rssFeedTable.rows[i + 1].full_data.dataUid || - flattenedResp[i].fullName !== rssFeedTable.rows[i + 1].full_data.dataPath) { + if ((flattenedResp[i].uid ? flattenedResp[i].uid : '') !== rssFeedTable.rows[i + 1].full_data.dataUid + || flattenedResp[i].fullName !== rssFeedTable.rows[i + 1].full_data.dataPath) { match = false; break; } @@ -800,7 +803,7 @@ const markSelectedAsRead = () => { let selectedDatapaths = rssFeedTable.selectedRows - .map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath); + .map((sRow) => rssFeedTable.rows[sRow].full_data.dataPath); // filter children let reducedDatapaths = selectedDatapaths.filter((path) => selectedDatapaths.filter((innerPath) => path.slice(0, innerPath.length) === innerPath).length === 1 @@ -822,8 +825,8 @@ saveWindowSize(id); }, resizeLimit: { - 'x' :[800,2500], - 'y' :[500,2000] + 'x': [800, 2500], + 'y': [500, 2000] } }); }; diff --git a/src/webui/www/private/views/rssDownloader.html b/src/webui/www/private/views/rssDownloader.html index 273d5e228..c21622274 100644 --- a/src/webui/www/private/views/rssDownloader.html +++ b/src/webui/www/private/views/rssDownloader.html @@ -12,7 +12,8 @@ float: left; } - #rulesTable, #rssDownloaderArticlesTable { + #rulesTable, + #rssDownloaderArticlesTable { overflow: auto; width: 100%; height: 100%; @@ -68,7 +69,9 @@ margin-bottom: 10px; } - #rulesTable table, #rssDownloaderFeedsTable table, #rssDownloaderArticlesTable table { + #rulesTable table, + #rssDownloaderFeedsTable table, + #rssDownloaderArticlesTable table { width: 100%; } @@ -123,6 +126,7 @@ float: right; background-image: url('icons/list-remove.svg'); } +
      @@ -159,7 +163,7 @@
      QBT_TR(Rule Definition)QBT_TR[CONTEXT=AutomatedRssDownloader]
      - +
      @@ -366,8 +370,8 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also $('rulesTable').style.height = 'calc(100% - ' + $('rulesTableDesc').getBoundingClientRect().height + 'px)'; $('rssDownloaderArticlesTable').style.height = 'calc(100% - ' + $('articleTableDesc').getBoundingClientRect().height + 'px)'; - let centerRowNotTableHeight = $('saveButton').getBoundingClientRect().height + - $('ruleSettings').getBoundingClientRect().height + 15; + let centerRowNotTableHeight = $('saveButton').getBoundingClientRect().height + + $('ruleSettings').getBoundingClientRect().height + 15; $('rssDownloaderFeeds').style.height = 'calc(100% - ' + centerRowNotTableHeight + 'px)'; @@ -447,7 +451,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also let flatten = (root) => { for (let child in root) { if (root[child].uid !== undefined) - feedList.push({name: child, url: root[child].url}); + feedList.push({ name: child, url: root[child].url }); else flatten(root[child]); } @@ -759,37 +763,36 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also mainPart = 'QBT_TR(Regex mode: use Perl-compatible regular expressions)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'; } else { - mainPart = 'QBT_TR(Wildcard mode: you can use)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + - ' ● QBT_TR(? to match any single character)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(* to match zero or more of any characters)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Whitespaces count as AND operators (all words, any order))QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + - 'QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'; + mainPart = 'QBT_TR(Wildcard mode: you can use)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + + ' ● QBT_TR(? to match any single character)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(* to match zero or more of any characters)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Whitespaces count as AND operators (all words, any order))QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(| is used as OR operator)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + + 'QBT_TR(If word order is important use * instead of whitespace.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n'; } let secondPart = 'QBT_TR(An expression with an empty %1 clause (e.g. %2))QBT_TR[CONTEXT=AutomatedRssDownloader]' - .replace('%1', '|').replace('%2', 'expr|'); + .replace('%1', '|').replace('%2', 'expr|'); $('mustContainText').title = mainPart + secondPart + 'QBT_TR( will match all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]'; $('mustNotContainText').title = mainPart + secondPart + 'QBT_TR( will exclude all articles.)QBT_TR[CONTEXT=AutomatedRssDownloader]'; - let episodeFilterTitle = 'QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + - 'QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]' + - '1x2;8-15;5;30-;' + - 'QBT_TR( will match 2, 5, 8 through 15, 30 and onward episodes of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + - 'QBT_TR(Episode filter rules: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + - ' ● QBT_TR(Season number is a mandatory non-zero value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Episode number is a mandatory positive value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Filter must end with semicolon)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Three range types for episodes are supported: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Single number: 1x25; matches episode 25 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Normal range: 1x25-40; matches episodes 25 through 40 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + - ' ● QBT_TR(Infinite range: 1x25-; matches episodes 25 and upward of season one, and all episodes of later seasons)QBT_TR[CONTEXT=AutomatedRssDownloader]'; + let episodeFilterTitle = 'QBT_TR(Matches articles based on episode filter.)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + + 'QBT_TR(Example: )QBT_TR[CONTEXT=AutomatedRssDownloader]' + + '1x2;8-15;5;30-;' + + 'QBT_TR( will match 2, 5, 8 through 15, 30 and onward episodes of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + + 'QBT_TR(Episode filter rules: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n\n' + + ' ● QBT_TR(Season number is a mandatory non-zero value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Episode number is a mandatory positive value)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Filter must end with semicolon)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Three range types for episodes are supported: )QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Single number: 1x25; matches episode 25 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Normal range: 1x25-40; matches episodes 25 through 40 of season one)QBT_TR[CONTEXT=AutomatedRssDownloader]\n' + + ' ● QBT_TR(Infinite range: 1x25-; matches episodes 25 and upward of season one, and all episodes of later seasons)QBT_TR[CONTEXT=AutomatedRssDownloader]'; episodeFilterTitle = episodeFilterTitle.replace(//g, '').replace(/<\/b>/g, ''); $('episodeFilterText').title = episodeFilterTitle; } - initRssDownloader(); return exports(); })(); diff --git a/src/webui/www/private/views/search.html b/src/webui/www/private/views/search.html index 792df77d2..de0e31391 100644 --- a/src/webui/www/private/views/search.html +++ b/src/webui/www/private/views/search.html @@ -41,7 +41,10 @@ margin-right: 20px; } - #searchMinSeedsFilter, #searchMaxSeedsFilter, #searchMinSizeFilter, #searchMaxSizeFilter { + #searchMinSeedsFilter, + #searchMaxSeedsFilter, + #searchMinSizeFilter, + #searchMaxSizeFilter { width: 4em; } @@ -89,7 +92,7 @@ @@ -167,14 +170,14 @@ @@ -492,7 +495,7 @@ if (uniqueCategories[category.id] === undefined) { uniqueCategories[category.id] = category; } - } + } } // we must sort the ids to maintain consistent order. const categories = Object.keys(uniqueCategories).sort().map(id => uniqueCategories[id]); diff --git a/src/webui/www/private/views/searchplugins.html b/src/webui/www/private/views/searchplugins.html index 62e57e53f..f49ae2415 100644 --- a/src/webui/www/private/views/searchplugins.html +++ b/src/webui/www/private/views/searchplugins.html @@ -72,8 +72,8 @@
      - There aren't any search plugins installed.
      Click the "Search plugins..." button at the bottom right of the window to install some. + There aren't any search plugins installed.
      Click the "Search plugins..." button at the bottom right of the window to install some.