WebUI: enforce coding style

Actually, not all of them but some that can be enforced by eslint.
The changes are made by eslint with minor manual tweaking.

PR #17046.
This commit is contained in:
Chocobo1 2022-05-18 11:37:05 +08:00 committed by GitHub
parent 5af96943e3
commit dbfd6a2368
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 155 additions and 98 deletions

View file

@ -9,6 +9,8 @@
],
"rules": {
"no-undef": "off",
"no-unused-vars": "off"
"no-unused-vars": "off",
"nonblock-statement-body-position": ["error", "below"],
"semi": "error"
}
}

View file

@ -36,7 +36,7 @@
const peers = $('peers').get('value').trim().split(/[\r\n]+/);
if (peers.length === 0)
return
return;
new Request({
url: 'api/v2/torrents/addPeers',

View file

@ -53,7 +53,7 @@
}
}).send();
}
}
};
</script>
<input type="button" id="applyButton" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setDlLimit()" />
</div>

View file

@ -91,7 +91,7 @@ const getShowFiltersSidebar = function() {
// Show Filters Sidebar is enabled by default
const show = LocalPreferences.get('show_filters_sidebar');
return (show === null) || (show === 'true');
}
};
function genHash(string) {
// origins:
@ -112,7 +112,8 @@ const fetchQbtVersion = function() {
url: 'api/v2/app/version',
method: 'get',
onSuccess: function(info) {
if (!info) return;
if (!info)
return;
sessionStorage.setItem('qbtVersion', info);
}
}).send();
@ -245,7 +246,7 @@ window.addEvent('load', function() {
toggleFilterDisplay = function(filter) {
const element = filter + "FilterList";
LocalPreferences.set('filter_' + filter + "_collapsed", !$(element).hasClass("invisible"));
$(element).toggleClass("invisible")
$(element).toggleClass("invisible");
const parent = $(element).getParent(".filterWrapper");
const toggleIcon = $(parent).getChildren(".filterTitle img");
if (toggleIcon)

View file

@ -605,6 +605,7 @@ window.qBittorrent.ContextMenu = (function() {
this.hideItem('newFolder');
this.hideItem('updateAll');
this.showItem('copyFeedURL');
break;
}
}
});
@ -661,6 +662,7 @@ window.qBittorrent.ContextMenu = (function() {
this.showItem('deleteRule');
this.hideItem('renameRule');
this.showItem('clearDownloadedEpisodes');
break;
}
}
});

View file

@ -241,7 +241,8 @@ window.qBittorrent.DynamicTable = (function() {
const val = LocalPreferences.get('columns_order_' + this.dynamicTableDivId).split(',');
val.erase(el.columnName);
let pos = val.indexOf(this.lastHoverTh.columnName);
if (this.dropSide === 'right') ++pos;
if (this.dropSide === 'right')
++pos;
val.splice(pos, 0, el.columnName);
LocalPreferences.set('columns_order_' + this.dynamicTableDivId, val.join(','));
this.loadColumnsOrder();
@ -383,10 +384,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};
@ -401,7 +403,8 @@ window.qBittorrent.DynamicTable = (function() {
loadColumnsOrder: function() {
const columnsOrder = [];
const val = LocalPreferences.get('columns_order_' + this.dynamicTableDivId);
if (val === null || val === undefined) return;
if (val === null || val === undefined)
return;
val.split(',').forEach(function(v) {
if ((v in this.columns) && (!columnsOrder.contains(v)))
columnsOrder.push(v);
@ -989,7 +992,8 @@ window.qBittorrent.DynamicTable = (function() {
// status
this.columns['status'].updateTd = function(td, row) {
const state = this.getRowValue(row);
if (!state) return;
if (!state)
return;
let status;
switch (state) {
@ -1071,7 +1075,8 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (row1_val > row2_val)
return 1;
else return 0;
else
return 0;
};
// name, category, tags
@ -1155,7 +1160,8 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (num_seeds1 > num_seeds2)
return 1;
else return 0;
else
return 0;
};
// num_leechs
@ -1402,7 +1408,8 @@ window.qBittorrent.DynamicTable = (function() {
const rows = this.rows.getValues();
for (let i = 0; i < rows.length; ++i)
if (this.applyFilter(rows[i], filterName, categoryHash, tagHash, trackerHash, null)) ++cnt;
if (this.applyFilter(rows[i], filterName, categoryHash, tagHash, trackerHash, null))
++cnt;
return cnt;
},
@ -1608,13 +1615,13 @@ window.qBittorrent.DynamicTable = (function() {
const size = window.qBittorrent.Misc.friendlyUnit(this.getRowValue(row), false);
td.set('text', size);
td.set('title', size);
}
};
const displayNum = function(td, row) {
const value = this.getRowValue(row);
const formattedValue = (value === "-1") ? "Unknown" : value;
td.set('text', formattedValue);
td.set('title', formattedValue);
}
};
this.columns['fileSize'].updateTd = displaySize;
this.columns['nbSeeders'].updateTd = displayNum;
@ -1635,7 +1642,7 @@ window.qBittorrent.DynamicTable = (function() {
return {
min: minSize,
max: maxSize
}
};
};
const getSeedsFilters = function() {
@ -1651,7 +1658,7 @@ window.qBittorrent.DynamicTable = (function() {
return {
min: minSeeds,
max: maxSeeds
}
};
};
let filteredRows = [];
@ -1666,12 +1673,18 @@ 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 ((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;
if ((seedsFilters.max > 0) && (row.full_data.nbSeeders > seedsFilters.max)) 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;
if ((seedsFilters.max > 0) && (row.full_data.nbSeeders > seedsFilters.max))
continue;
filteredRows.push(row);
}
@ -2226,10 +2239,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};
@ -2322,10 +2336,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};
@ -2408,10 +2423,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};
@ -2495,10 +2511,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};
@ -2545,10 +2562,11 @@ window.qBittorrent.DynamicTable = (function() {
return -1;
else if (this.getRowValue(row1) > this.getRowValue(row2))
return 1;
else return 0;
else
return 0;
};
column['updateTd'] = function(td, row) {
const value = this.getRowValue(row)
const value = this.getRowValue(row);
td.set('text', value);
td.set('title', value);
};

View file

@ -72,9 +72,12 @@ window.qBittorrent.Misc = (function() {
}
function friendlyUnitPrecision(sizeUnit) {
if (sizeUnit <= 2) return 1; // KiB, MiB
else if (sizeUnit === 3) return 2; // GiB
else return 3; // TiB, PiB, EiB
if (sizeUnit <= 2) // KiB, MiB
return 1;
else if (sizeUnit === 3) // GiB
return 2;
else // TiB, PiB, EiB
return 3;
}
let ret;
@ -90,7 +93,7 @@ window.qBittorrent.Misc = (function() {
if (isSpeed)
ret += "QBT_TR(/s)QBT_TR[CONTEXT=misc]";
return ret;
}
};
/*
* JS counterpart of the function in src/misc.cpp
@ -116,7 +119,7 @@ window.qBittorrent.Misc = (function() {
const years = days / 365;
days = days % 365;
return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(years)).replace("%2", parseInt(days));
}
};
const friendlyPercentage = function(value) {
let percentage = (value * 100).round(1);
@ -125,11 +128,11 @@ window.qBittorrent.Misc = (function() {
if (percentage > 100)
percentage = 100;
return percentage.toFixed(1) + "%";
}
};
const friendlyFloat = function(value, precision) {
return parseFloat(value).toFixed(precision);
}
};
/*
* From: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
@ -164,7 +167,7 @@ window.qBittorrent.Misc = (function() {
const parseHtmlLinks = function(text) {
const exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#/%?=~_|!:,.;]*[-A-Z0-9+&@#/%=~_|])/ig;
return text.replace(exp, "<a target='_blank' rel='noopener noreferrer' href='$1'>$1</a>");
}
};
const escapeHtml = function(str) {
const div = document.createElement('div');
@ -172,7 +175,7 @@ window.qBittorrent.Misc = (function() {
const escapedString = div.innerHTML;
div.remove();
return escapedString;
}
};
const safeTrim = function(value) {
try {
@ -183,13 +186,13 @@ window.qBittorrent.Misc = (function() {
return "";
throw e;
}
}
};
const toFixedPointString = function(number, digits) {
// Do not round up number
const power = Math.pow(10, digits);
return (Math.floor(power * number) / power).toFixed(digits);
}
};
/**
*
@ -199,7 +202,7 @@ window.qBittorrent.Misc = (function() {
*/
const containsAllTerms = function(text, terms) {
const textToSearch = text.toLowerCase();
return terms.every((function(term) {
return terms.every(function(term) {
const isTermRequired = (term[0] === '+');
const isTermExcluded = (term[0] === '-');
if (isTermRequired || isTermExcluded) {
@ -212,8 +215,8 @@ window.qBittorrent.Misc = (function() {
const textContainsTerm = (textToSearch.indexOf(term) !== -1);
return isTermExcluded ? !textContainsTerm : textContainsTerm;
}));
}
});
};
return exports();
})();

View file

@ -879,7 +879,7 @@ const initializeWindows = function() {
hashes = torrentsTable.getFilteredTorrentsHashes('all', CATEGORIES_ALL, TAGS_ALL, TRACKERS_TRACKERLESS);
break;
default:
hashes = trackerList.get(trackerHashInt).torrents
hashes = trackerList.get(trackerHashInt).torrents;
break;
}
@ -962,7 +962,8 @@ const initializeWindows = function() {
const hashes = torrentsTable.selectedRowsIds();
for (const hash of hashes) {
const row = torrentsTable.rows.get(hash);
if (!row) return
if (!row)
return;
const name = row.full_data.name;
const url = new URI("api/v2/torrents/export");

View file

@ -55,7 +55,7 @@ window.qBittorrent.LocalPreferences = (function() {
console.error(err);
}
}
})
});
return exports();
})();

View file

@ -52,8 +52,10 @@ window.qBittorrent.ProgressBar = (function() {
'lightbg': '#fff',
'lightfg': '#000'
};
if (parameters && $type(parameters) == 'object') $extend(vals, parameters);
if (vals.height < 12) vals.height = 12;
if (parameters && $type(parameters) == 'object')
$extend(vals, parameters);
if (vals.height < 12)
vals.height = 12;
const obj = new Element('div', {
'id': vals.id,
'class': 'progressbar_wrapper',
@ -102,8 +104,10 @@ window.qBittorrent.ProgressBar = (function() {
obj.getValue = ProgressBar_getValue;
obj.setValue = ProgressBar_setValue;
obj.setWidth = ProgressBar_setWidth;
if (vals.width) obj.setValue(vals.value);
else setTimeout('ProgressBar_checkForParent("' + obj.id + '")', 1);
if (vals.width)
obj.setValue(vals.value);
else
setTimeout('ProgressBar_checkForParent("' + obj.id + '")', 1);
return obj;
}
});
@ -114,9 +118,12 @@ window.qBittorrent.ProgressBar = (function() {
function ProgressBar_setValue(value) {
value = parseFloat(value);
if (isNaN(value)) value = 0;
if (value > 100) value = 100;
if (value < 0) value = 0;
if (isNaN(value))
value = 0;
if (value > 100)
value = 100;
if (value < 0)
value = 0;
this.vals.value = value;
this.vals.dark.empty();
this.vals.light.empty();
@ -139,8 +146,10 @@ window.qBittorrent.ProgressBar = (function() {
function ProgressBar_checkForParent(id) {
const obj = $(id);
if (!obj) return;
if (!obj.parentNode) return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
if (!obj)
return;
if (!obj.parentNode)
return setTimeout('ProgressBar_checkForParent("' + id + '")', 1);
obj.setStyle('width', '100%');
const w = obj.offsetWidth;
obj.vals.dark.setStyle('width', w);

View file

@ -310,7 +310,8 @@ window.qBittorrent.PropFiles = (function() {
};
const setFilePriority = function(ids, fileIds, priority) {
if (current_hash === "") return;
if (current_hash === "")
return;
clearTimeout(loadTorrentFilesDataTimer);
new Request({
@ -513,7 +514,8 @@ window.qBittorrent.PropFiles = (function() {
const filesPriorityMenuClicked = function(priority) {
const selectedRows = torrentFilesTable.selectedRowsIds();
if (selectedRows.length === 0) return;
if (selectedRows.length === 0)
return;
const rowIds = [];
const fileIds = [];
@ -544,11 +546,14 @@ window.qBittorrent.PropFiles = (function() {
actions: {
Rename: function(element, ref) {
const hash = torrentsTable.getCurrentTorrentID();
if (!hash) return;
if (!hash)
return;
const rowId = torrentFilesTable.selectedRowsIds()[0];
if (rowId === undefined) return;
if (rowId === undefined)
return;
const row = torrentFilesTable.rows[rowId];
if (!row) return;
if (!row)
return;
const node = torrentFilesTable.getNode(rowId);
const path = node.path;
@ -621,7 +626,8 @@ window.qBittorrent.PropFiles = (function() {
torrentFilesTable.setFilter(value);
clearTimeout(torrentFilesFilterInputTimer);
torrentFilesFilterInputTimer = setTimeout(function() {
if (current_hash === "") return;
if (current_hash === "")
return;
torrentFilesTable.updateTable(false);
if (value.trim() === "")

View file

@ -36,7 +36,7 @@ window.qBittorrent.PropPeers = (function() {
const exports = function() {
return {
updateData: updateData
}
};
};
const torrentPeersTable = new window.qBittorrent.DynamicTable.TorrentPeersTable();

View file

@ -165,7 +165,8 @@ window.qBittorrent.PropTrackers = (function() {
});
const addTrackerFN = function() {
if (current_hash.length === 0) return;
if (current_hash.length === 0)
return;
new MochaUI.Window({
id: 'trackersPage',
title: "QBT_TR(Trackers addition dialog)QBT_TR[CONTEXT=TrackersAdditionDialog]",
@ -186,7 +187,8 @@ window.qBittorrent.PropTrackers = (function() {
};
const editTrackerFN = function(element) {
if (current_hash.length === 0) return;
if (current_hash.length === 0)
return;
const trackerUrl = encodeURIComponent(element.childNodes[1].innerText);
new MochaUI.Window({
@ -209,7 +211,8 @@ window.qBittorrent.PropTrackers = (function() {
};
const removeTrackerFN = function(element) {
if (current_hash.length === 0) return;
if (current_hash.length === 0)
return;
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
new Request({

View file

@ -54,7 +54,8 @@ MochaUI.extend({
// And create slider
if (hashes[0] == 'global') {
let up_limit = maximum;
if (up_limit < 0) up_limit = 0;
if (up_limit < 0)
up_limit = 0;
maximum = 10000;
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
steps: maximum,
@ -97,7 +98,8 @@ MochaUI.extend({
up_limit = 0;
break;
}
if (up_limit < 0) up_limit = 0;
if (up_limit < 0)
up_limit = 0;
new Slider($('uplimitSliderarea'), $('uplimitSliderknob'), {
steps: maximum,
offset: 0,
@ -156,7 +158,8 @@ MochaUI.extend({
// And create slider
if (hashes[0] == 'global') {
let dl_limit = maximum;
if (dl_limit < 0) dl_limit = 0;
if (dl_limit < 0)
dl_limit = 0;
maximum = 10000;
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
steps: maximum,
@ -199,7 +202,8 @@ MochaUI.extend({
dl_limit = 0;
break;
}
if (dl_limit < 0) dl_limit = 0;
if (dl_limit < 0)
dl_limit = 0;
new Slider($('dllimitSliderarea'), $('dllimitSliderknob'), {
steps: maximum,
offset: 0,

View file

@ -53,7 +53,7 @@
}
}).send();
}
}
};
</script>
<input type="button" id="applyButton" value="QBT_TR(Apply)QBT_TR[CONTEXT=HttpServer]" onclick="setUpLimit()" />
</div>

View file

@ -679,7 +679,8 @@
method: 'get',
noCache: true,
onSuccess: function(info) {
if (!info) return;
if (!info)
return;
$('qtVersion').textContent = info.qt;
$('libtorrentVersion').textContent = info.libtorrent;

View file

@ -1619,7 +1619,8 @@
alert("Could not contact qBittorrent");
},
onSuccess: function(ifaces) {
if (!ifaces) return;
if (!ifaces)
return;
$('networkInterface').options.add(new Option('QBT_TR(Any interface)QBT_TR[CONTEXT=OptionsDialog]', ''));
ifaces.forEach(function(item, index) {
@ -1644,7 +1645,8 @@
alert("Could not contact qBittorrent");
},
onSuccess: function(addresses) {
if (!addresses) return;
if (!addresses)
return;
$('optionalIPAddressToBind').options.add(new Option('QBT_TR(All addresses)QBT_TR[CONTEXT=OptionDialog]', ''));
$('optionalIPAddressToBind').options.add(new Option('QBT_TR(All IPv4 addresses)QBT_TR[CONTEXT=OptionDialog]', '0.0.0.0'));

View file

@ -227,7 +227,7 @@
.filter((row) => row.full_data.dataUid !== '')
.each((row) => feedsToUpdate.add(row));
});
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid))
feedsToUpdate.forEach((feed) => refreshFeed(feed.full_data.dataUid));
},
markRead: markSelectedAsRead,
rename: (el) => {
@ -307,11 +307,11 @@
const unload = () => {
clearInterval(feedRefreshTimer);
}
};
const load = () => {
feedRefreshTimer = setInterval(updateRssFeedList, serverSyncRssDataInterval);
}
};
const addRSSFeed = () => {
let path = '';
@ -365,7 +365,7 @@
width: 350,
height: 100
});
}
};
const showRssFeed = (path) => {
rssArticleTable.clear();

View file

@ -414,14 +414,14 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
$('rulesTable').addEventListener('click', (e) => {
rssDownloaderRulesTable.deselectAll();
rssDownloaderRulesTable.deselectRow();
showRule('')
showRule('');
});
$('rulesTable').addEventListener('contextmenu', (e) => {
if (e.toElement.nodeName === 'DIV') {
rssDownloaderRulesTable.deselectAll();
rssDownloaderRulesTable.deselectRow();
rssDownloaderRuleContextMenu.updateMenuItems();
showRule('')
showRule('');
}
});
// get all categories and add to combobox
@ -455,7 +455,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
else
flatten(root[child]);
}
}
};
flatten(response);
}
}).send();
@ -485,7 +485,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
rulesList = response;
}
}).send();
}
};
const modifyRuleState = (rule, setting, newState, callback = () => {}) => {
rulesList[rule][setting] = newState;
@ -501,7 +501,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
callback();
}
}).send();
}
};
const addRule = () => {
new MochaUI.Window({
@ -566,7 +566,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
width: 350,
height: 85
});
}
};
const saveSettings = () => {
let lastSelectedRow = rssDownloaderRulesTable.selectedRows[rssDownloaderRulesTable.selectedRows.length - 1];
@ -624,7 +624,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
updateMatchingArticles(rule);
}
}).send();
}
};
const updateMatchingArticles = (ruleName) => {
new Request.JSON({
@ -654,7 +654,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
rssDownloaderArticlesTable.updateTable(false);
}
}).send();
}
};
const showRule = (ruleName) => {
if (ruleName === '') {
@ -755,7 +755,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
rssDownloaderFeedSelectionTable.updateTable(false);
updateMatchingArticles(ruleName);
}
}
};
const setElementTitles = () => {
let mainPart;
@ -791,7 +791,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
episodeFilterTitle = episodeFilterTitle.replace(/<b>/g, '').replace(/<\/b>/g, '');
$('episodeFilterText').title = episodeFilterTitle;
}
};
initRssDownloader();
return exports();

View file

@ -341,7 +341,8 @@
let category = $('categorySelect').getProperty('value');
const plugins = $('pluginsSelect').getProperty('value');
if (!pattern || !category || !plugins) return;
if (!pattern || !category || !plugins)
return;
resetFilters();
@ -390,7 +391,8 @@
});
// only proceed if at least 1 row was selected
if (!urls.length) return;
if (!urls.length)
return;
showDownloadPage(urls);
};
@ -490,7 +492,8 @@
if ((selectedPlugin === "all") || (selectedPlugin === "enabled")) {
const uniqueCategories = {};
for (const plugin of searchPlugins) {
if ((selectedPlugin === "enabled") && !plugin.enabled) continue
if ((selectedPlugin === "enabled") && !plugin.enabled)
continue;
for (const category of plugin.supportedCategories) {
if (uniqueCategories[category.id] === undefined) {
uniqueCategories[category.id] = category;
@ -503,7 +506,7 @@
}
else {
const plugin = getPlugin(selectedPlugin);
const plugins = (plugin === null) ? [] : plugin.supportedCategories
const plugins = (plugin === null) ? [] : plugin.supportedCategories;
populateCategorySelect(plugins);
}
@ -542,8 +545,10 @@
const allPlugins = searchPlugins.sort(function(pluginA, pluginB) {
const a = pluginA.fullName.toLowerCase();
const b = pluginB.fullName.toLowerCase();
if (a < b) return -1;
if (a > b) return 1;
if (a < b)
return -1;
if (a > b)
return 1;
return 0;
});