WebUI: prefer arrow function in callbacks

This commit is contained in:
Chocobo1 2024-05-27 22:57:28 +08:00 committed by sledgehammer999
parent 1ef21bc2b7
commit a19d623ead
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
32 changed files with 215 additions and 214 deletions

View file

@ -30,6 +30,7 @@ export default [
"no-undef": "off",
"no-unused-vars": "off",
"no-var": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"Stylistic/no-mixed-operators": [
"error",

View file

@ -24,14 +24,14 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const hash = new URI().getData("hash");
if (!hash)
return false;
$("peers").focus();
$("addPeersOk").addEvent("click", function(e) {
$("addPeersOk").addEvent("click", (e) => {
new Event(e).stop();
const peers = $("peers").get("value").trim().split(/[\r\n]+/);

View file

@ -10,7 +10,7 @@
<script>
"use strict";
window.addEvent("domready", function() {
window.addEvent("domready", () => {
new Keyboard({
defaultEventType: "keydown",
events: {
@ -26,7 +26,7 @@
}).activate();
$("trackersUrls").focus();
$("addTrackersButton").addEvent("click", function(e) {
$("addTrackersButton").addEvent("click", (e) => {
new Event(e).stop();
const hash = new URI().getData("hash");
new Request({

View file

@ -21,7 +21,7 @@
icon.style.fill = "var(--color-border-default)";
}
window.addEvent("domready", function() {
window.addEvent("domready", () => {
new Request({
url: "images/object-locked.svg",
method: "get",
@ -41,12 +41,12 @@
let prefDeleteContentFiles = prefCache.delete_torrent_content_files;
$("deleteFromDiskCB").checked ||= prefDeleteContentFiles;
$("deleteFromDiskCB").addEvent("click", function(e) {
$("deleteFromDiskCB").addEvent("click", (e) => {
setRememberBtnEnabled($("deleteFromDiskCB").checked !== prefDeleteContentFiles);
});
// Set current "Delete files" choice as the default
$("rememberBtn").addEvent("click", function(e) {
$("rememberBtn").addEvent("click", (e) => {
window.parent.qBittorrent.Cache.preferences.set({
data: {
"delete_torrent_content_files": $("deleteFromDiskCB").checked
@ -60,11 +60,11 @@
const hashes = new URI().getData("hashes").split("|");
$("cancelBtn").focus();
$("cancelBtn").addEvent("click", function(e) {
$("cancelBtn").addEvent("click", (e) => {
new Event(e).stop();
window.parent.qBittorrent.Client.closeWindows();
});
$("confirmBtn").addEvent("click", function(e) {
$("confirmBtn").addEvent("click", (e) => {
parent.torrentsTable.deselectAll();
new Event(e).stop();
const cmd = "api/v2/torrents/delete";

View file

@ -167,7 +167,7 @@
const encodedUrls = new URI().getData("urls");
if (encodedUrls) {
const urls = encodedUrls.split("|").map(function(url) {
const urls = encodedUrls.split("|").map((url) => {
return decodeURIComponent(url);
});
@ -177,7 +177,7 @@
let submitted = false;
$("downloadForm").addEventListener("submit", function() {
$("downloadForm").addEventListener("submit", () => {
$("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
@ -187,7 +187,7 @@
submitted = true;
});
$("download_frame").addEventListener("load", function() {
$("download_frame").addEventListener("load", () => {
if (submitted)
window.parent.qBittorrent.Client.closeWindows();
});

View file

@ -10,7 +10,7 @@
<script>
"use strict";
window.addEvent("domready", function() {
window.addEvent("domready", () => {
new Keyboard({
defaultEventType: "keydown",
events: {
@ -36,7 +36,7 @@
$("trackerUrl").value = currentUrl;
$("trackerUrl").focus();
$("editTrackerButton").addEvent("click", function(e) {
$("editTrackerButton").addEvent("click", (e) => {
new Event(e).stop();
const hash = new URI().getData("hash");
new Request({

View file

@ -29,7 +29,7 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
const uriCategoryName = window.qBittorrent.Misc.safeTrim(new URI().getData("categoryName"));
@ -52,7 +52,7 @@
$("categoryName").focus();
}
$("categoryNameButton").addEvent("click", function(e) {
$("categoryNameButton").addEvent("click", (e) => {
new Event(e).stop();
const savePath = $("savePath").value.trim();

View file

@ -29,7 +29,7 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const uriAction = window.qBittorrent.Misc.safeTrim(new URI().getData("action"));
const uriHashes = window.qBittorrent.Misc.safeTrim(new URI().getData("hashes"));
@ -38,7 +38,7 @@
$("tagName").focus();
$("tagNameButton").addEvent("click", function(e) {
$("tagNameButton").addEvent("click", (e) => {
new Event(e).stop();
const tagName = $("tagName").value.trim();

View file

@ -29,14 +29,14 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const name = new URI().getData("name");
// set text field to current value
if (name)
$("rename").value = name;
$("rename").focus();
$("renameButton").addEvent("click", function(e) {
$("renameButton").addEvent("click", (e) => {
new Event(e).stop();
// check field
const name = $("rename").value.trim();

View file

@ -30,7 +30,7 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const hash = new URI().getData("hash");
const oldPath = new URI().getData("path");
const isFolder = ((new URI().getData("isFolder")) === "true");
@ -41,7 +41,7 @@
if (!isFolder)
$("rename").setSelectionRange(0, oldName.lastIndexOf("."));
$("renameButton").addEvent("click", function(e) {
$("renameButton").addEvent("click", (e) => {
new Event(e).stop();
// check field
const newName = $("rename").value.trim();

View file

@ -57,7 +57,7 @@
checkboxHeader = new Element("input");
checkboxHeader.set("type", "checkbox");
checkboxHeader.set("id", "rootMultiRename_cb");
checkboxHeader.addEvent("click", function(e) {
checkboxHeader.addEvent("click", (e) => {
bulkRenameFilesTable.toggleGlobalCheckbox();
fileRenamer.selectedFiles = bulkRenameFilesTable.getSelectedRows();
fileRenamer.update();
@ -145,7 +145,7 @@
};
// Setup Search Events that control renaming
$("multiRenameSearch").addEvent("input", function(e) {
$("multiRenameSearch").addEvent("input", (e) => {
const sanitized = e.target.value.replace(/\n/g, "");
$("multiRenameSearch").set("value", sanitized);
@ -154,17 +154,17 @@
LocalPreferences.set("multirename_search", sanitized);
fileRenamer.setSearch(sanitized);
});
$("use_regex_search").addEvent("change", function(e) {
$("use_regex_search").addEvent("change", (e) => {
fileRenamer.useRegex = e.target.checked;
LocalPreferences.set("multirename_useRegex", e.target.checked);
fileRenamer.update();
});
$("match_all_occurrences").addEvent("change", function(e) {
$("match_all_occurrences").addEvent("change", (e) => {
fileRenamer.matchAllOccurrences = e.target.checked;
LocalPreferences.set("multirename_matchAllOccurrences", e.target.checked);
fileRenamer.update();
});
$("case_sensitive").addEvent("change", function(e) {
$("case_sensitive").addEvent("change", (e) => {
fileRenamer.caseSensitive = e.target.checked;
LocalPreferences.set("multirename_caseSensitive", e.target.checked);
fileRenamer.update();
@ -177,7 +177,7 @@
// Clear renamed column
document
.querySelectorAll("span[id^='filesTablefileRenamed']")
.forEach(function(span) {
.forEach((span) => {
span.set("text", "");
});
@ -192,7 +192,7 @@
};
// Setup Replace Events that control renaming
$("multiRenameReplace").addEvent("input", function(e) {
$("multiRenameReplace").addEvent("input", (e) => {
const sanitized = e.target.value.replace(/\n/g, "");
$("multiRenameReplace").set("value", sanitized);
@ -201,22 +201,22 @@
LocalPreferences.set("multirename_replace", sanitized);
fileRenamer.setReplacement(sanitized);
});
$("applies_to_option").addEvent("change", function(e) {
$("applies_to_option").addEvent("change", (e) => {
fileRenamer.appliesTo = e.target.value;
LocalPreferences.set("multirename_appliesTo", e.target.value);
fileRenamer.update();
});
$("include_files").addEvent("change", function(e) {
$("include_files").addEvent("change", (e) => {
fileRenamer.includeFiles = e.target.checked;
LocalPreferences.set("multirename_includeFiles", e.target.checked);
fileRenamer.update();
});
$("include_folders").addEvent("change", function(e) {
$("include_folders").addEvent("change", (e) => {
fileRenamer.includeFolders = e.target.checked;
LocalPreferences.set("multirename_includeFolders", e.target.checked);
fileRenamer.update();
});
$("file_counter").addEvent("input", function(e) {
$("file_counter").addEvent("input", (e) => {
let value = e.target.valueAsNumber;
if (!value) { value = 0; }
if (value < 0) { value = 0; }
@ -228,7 +228,7 @@
});
// Setup Rename Operation Events
$("renameButton").addEvent("click", function(e) {
$("renameButton").addEvent("click", (e) => {
// Disable Search Options
$("multiRenameSearch").disabled = true;
$("use_regex_search").disabled = true;
@ -282,7 +282,7 @@
$("rename_error").set("text", `QBT_TR(Rename failed: file or folder already exists)QBT_TR[CONTEXT=PropertiesWidget] \`${row.renamed}\``);
}
};
$("renameOptions").addEvent("change", function(e) {
$("renameOptions").addEvent("change", (e) => {
const combobox = e.target;
const replaceOperation = combobox.value;
if (replaceOperation === "Replace") {
@ -297,7 +297,7 @@
LocalPreferences.set("multirename_replaceAll", fileRenamer.replaceAll);
$("renameButton").set("value", replaceOperation);
});
$("closeButton").addEvent("click", function() {
$("closeButton").addEvent("click", () => {
window.parent.qBittorrent.Client.closeWindows();
event.preventDefault();
});
@ -308,7 +308,7 @@
};
const handleTorrentFiles = function(files, selectedRows) {
const rows = files.map(function(file, index) {
const rows = files.map((file, index) => {
const row = {
fileId: index,
@ -330,12 +330,12 @@
const rootNode = new window.qBittorrent.FileTree.FolderNode();
rootNode.autoCheckFolders = false;
rows.forEach(function(row) {
rows.forEach((row) => {
const pathItems = row.path.split(window.qBittorrent.Filesystem.PathSeparator);
pathItems.pop(); // remove last item (i.e. file name)
let parent = rootNode;
pathItems.forEach(function(folderName) {
pathItems.forEach((folderName) => {
if (folderName === ".unwanted") {
return;
}

View file

@ -156,7 +156,7 @@ let selected_filter = LocalPreferences.get("selected_filter", "all");
let setFilter = function() {};
let toggleFilterDisplay = function() {};
window.addEventListener("DOMContentLoaded", function() {
window.addEventListener("DOMContentLoaded", () => {
let isSearchPanelLoaded = false;
let isLogPanelLoaded = false;
@ -167,7 +167,7 @@ window.addEventListener("DOMContentLoaded", function() {
LocalPreferences.set("properties_height_rel", properties_height_rel);
};
window.addEvent("resize", function() {
window.addEvent("resize", () => {
// only save sizes if the columns are visible
if (!$("mainColumn").hasClass("invisible"))
saveColumnSizes.delay(200); // Resizing might takes some time.
@ -771,7 +771,7 @@ window.addEventListener("DOMContentLoaded", function() {
update_categories = true;
}
if (response["categories_removed"]) {
response["categories_removed"].each(function(category) {
response["categories_removed"].each((category) => {
const categoryHash = window.qBittorrent.Client.genHash(category);
category_list.delete(categoryHash);
});
@ -842,7 +842,7 @@ window.addEventListener("DOMContentLoaded", function() {
setupCopyEventHandler();
}
if (response["torrents_removed"])
response["torrents_removed"].each(function(hash) {
response["torrents_removed"].each((hash) => {
torrentsTable.removeRow(hash);
removeTorrentFromCategoryList(hash);
update_categories = true; // Always to update All category
@ -1002,7 +1002,7 @@ window.addEventListener("DOMContentLoaded", function() {
}
};
$("alternativeSpeedLimits").addEvent("click", function() {
$("alternativeSpeedLimits").addEvent("click", () => {
// Change icon immediately to give some feedback
updateAltSpeedIcon(!alternativeSpeedLimits);
@ -1023,7 +1023,7 @@ window.addEventListener("DOMContentLoaded", function() {
$("DlInfos").addEvent("click", globalDownloadLimitFN);
$("UpInfos").addEvent("click", globalUploadLimitFN);
$("showTopToolbarLink").addEvent("click", function(e) {
$("showTopToolbarLink").addEvent("click", (e) => {
showTopToolbar = !showTopToolbar;
LocalPreferences.set("show_top_toolbar", showTopToolbar.toString());
if (showTopToolbar) {
@ -1037,7 +1037,7 @@ window.addEventListener("DOMContentLoaded", function() {
MochaUI.Desktop.setDesktopSize();
});
$("showStatusBarLink").addEvent("click", function(e) {
$("showStatusBarLink").addEvent("click", (e) => {
showStatusBar = !showStatusBar;
LocalPreferences.set("show_status_bar", showStatusBar.toString());
if (showStatusBar) {
@ -1071,11 +1071,11 @@ window.addEventListener("DOMContentLoaded", function() {
navigator.registerProtocolHandler("magnet", templateUrl,
"qBittorrent WebUI magnet handler");
};
$("registerMagnetHandlerLink").addEvent("click", function(e) {
$("registerMagnetHandlerLink").addEvent("click", (e) => {
registerMagnetHandler();
});
$("showFiltersSidebarLink").addEvent("click", function(e) {
$("showFiltersSidebarLink").addEvent("click", (e) => {
showFiltersSidebar = !showFiltersSidebar;
LocalPreferences.set("show_filters_sidebar", showFiltersSidebar.toString());
if (showFiltersSidebar) {
@ -1091,7 +1091,7 @@ window.addEventListener("DOMContentLoaded", function() {
MochaUI.Desktop.setDesktopSize();
});
$("speedInBrowserTitleBarLink").addEvent("click", function(e) {
$("speedInBrowserTitleBarLink").addEvent("click", (e) => {
speedInTitle = !speedInTitle;
LocalPreferences.set("speed_in_browser_title_bar", speedInTitle.toString());
if (speedInTitle)
@ -1101,19 +1101,19 @@ window.addEventListener("DOMContentLoaded", function() {
processServerState();
});
$("showSearchEngineLink").addEvent("click", function(e) {
$("showSearchEngineLink").addEvent("click", (e) => {
window.qBittorrent.Client.showSearchEngine(!window.qBittorrent.Client.isShowSearchEngine());
LocalPreferences.set("show_search_engine", window.qBittorrent.Client.isShowSearchEngine().toString());
updateTabDisplay();
});
$("showRssReaderLink").addEvent("click", function(e) {
$("showRssReaderLink").addEvent("click", (e) => {
window.qBittorrent.Client.showRssReader(!window.qBittorrent.Client.isShowRssReader());
LocalPreferences.set("show_rss_reader", window.qBittorrent.Client.isShowRssReader().toString());
updateTabDisplay();
});
$("showLogViewerLink").addEvent("click", function(e) {
$("showLogViewerLink").addEvent("click", (e) => {
window.qBittorrent.Client.showLogViewer(!window.qBittorrent.Client.isShowLogViewer());
LocalPreferences.set("show_log_viewer", window.qBittorrent.Client.isShowLogViewer().toString());
updateTabDisplay();
@ -1366,11 +1366,11 @@ window.addEventListener("DOMContentLoaded", function() {
tabsOnload: function() {
MochaUI.initializeTabs("panelTabs");
$("logMessageLink").addEvent("click", function(e) {
$("logMessageLink").addEvent("click", (e) => {
window.qBittorrent.Log.setCurrentTab("main");
});
$("logPeerLink").addEvent("click", function(e) {
$("logPeerLink").addEvent("click", (e) => {
window.qBittorrent.Log.setCurrentTab("peer");
});
},
@ -1500,7 +1500,7 @@ window.addEventListener("DOMContentLoaded", function() {
LocalPreferences.set("selected_tab", this.id);
});
$("propertiesPanel_collapseToggle").addEvent("click", function(e) {
$("propertiesPanel_collapseToggle").addEvent("click", (e) => {
updatePropertiesPanel();
});
},

View file

@ -161,19 +161,19 @@ window.qBittorrent.ContextMenu = (function() {
},
setupEventListeners: function(elem) {
elem.addEvent("contextmenu", function(e) {
elem.addEvent("contextmenu", (e) => {
this.triggerMenu(e, elem);
}.bind(this));
elem.addEvent("click", function(e) {
});
elem.addEvent("click", (e) => {
this.hide();
}.bind(this));
});
elem.addEvent("touchstart", function(e) {
elem.addEvent("touchstart", (e) => {
this.hide();
this.touchStartAt = performance.now();
this.touchStartEvent = e;
}.bind(this));
elem.addEvent("touchend", function(e) {
});
elem.addEvent("touchend", (e) => {
const now = performance.now();
const touchStartAt = this.touchStartAt;
const touchStartEvent = this.touchStartEvent;
@ -185,7 +185,7 @@ window.qBittorrent.ContextMenu = (function() {
if (((now - touchStartAt) >= this.options.touchTimer) && isTargetUnchanged) {
this.triggerMenu(touchStartEvent, elem);
}
}.bind(this));
});
},
addTarget: function(t) {
@ -215,25 +215,25 @@ window.qBittorrent.ContextMenu = (function() {
//get things started
startListener: function() {
/* all elements */
this.targets.each(function(el) {
this.targets.each((el) => {
this.setupEventListeners(el);
}.bind(this), this);
}, this);
/* menu items */
this.menu.getElements("a").each(function(item) {
item.addEvent("click", function(e) {
item.addEvent("click", (e) => {
e.preventDefault();
if (!item.hasClass("disabled")) {
this.execute(item.get("href").split("#")[1], $(this.options.element));
this.fireEvent("click", [item, e]);
}
}.bind(this));
});
}, this);
//hide on body click
$(document.body).addEvent("click", function() {
$(document.body).addEvent("click", () => {
this.hide();
}.bind(this));
});
},
updateMenuItems: function() {},

View file

@ -135,7 +135,7 @@ window.qBittorrent.Download = (function() {
}
};
$(window).addEventListener("load", function() {
$(window).addEventListener("load", () => {
getPreferences();
getCategories();
});

View file

@ -210,7 +210,7 @@ window.qBittorrent.DynamicTable = (function() {
resetElementBorderStyle(borderChangeElement, changeBorderSide === "right" ? "left" : "right");
borderChangeElement.getSiblings('[class=""]').each(function(el) {
borderChangeElement.getSiblings('[class=""]').each((el) => {
resetElementBorderStyle(el);
});
}
@ -272,7 +272,7 @@ window.qBittorrent.DynamicTable = (function() {
}
if (this.currentHeaderAction === "drag") {
resetElementBorderStyle(el);
el.getSiblings('[class=""]').each(function(el) {
el.getSiblings('[class=""]').each((el) => {
resetElementBorderStyle(el);
});
}
@ -431,10 +431,10 @@ window.qBittorrent.DynamicTable = (function() {
const val = LocalPreferences.get("columns_order_" + this.dynamicTableDivId);
if ((val === null) || (val === undefined))
return;
val.split(",").forEach(function(v) {
val.split(",").forEach((v) => {
if ((v in this.columns) && (!columnsOrder.contains(v)))
columnsOrder.push(v);
}.bind(this));
});
for (let i = 0; i < this.columns.length; ++i)
if (!columnsOrder.contains(this.columns[i].name))
@ -575,14 +575,14 @@ window.qBittorrent.DynamicTable = (function() {
return;
const trs = this.tableBody.getElements("tr");
trs.each(function(el, i) {
trs.each((el, i) => {
if (i % 2) {
el.addClass("alt");
}
else {
el.removeClass("alt");
}
}.bind(this));
});
},
selectAll: function() {
@ -622,7 +622,7 @@ window.qBittorrent.DynamicTable = (function() {
let select = false;
const that = this;
this.tableBody.getElements("tr").each(function(tr) {
this.tableBody.getElements("tr").each((tr) => {
if ((tr.rowId === rowId1) || (tr.rowId === rowId2)) {
select = !select;
that.selectedRows.push(tr.rowId);
@ -638,7 +638,7 @@ window.qBittorrent.DynamicTable = (function() {
reselectRows: function(rowIds) {
this.deselectAll();
this.selectedRows = rowIds.slice();
this.tableBody.getElements("tr").each(function(tr) {
this.tableBody.getElements("tr").each((tr) => {
if (rowIds.includes(tr.rowId))
tr.addClass("selected");
});
@ -646,7 +646,7 @@ window.qBittorrent.DynamicTable = (function() {
setRowClass: function() {
const that = this;
this.tableBody.getElements("tr").each(function(tr) {
this.tableBody.getElements("tr").each((tr) => {
if (that.isRowSelected(tr.rowId))
tr.addClass("selected");
else
@ -686,14 +686,14 @@ window.qBittorrent.DynamicTable = (function() {
filteredRows[rows[i].rowId] = rows[i];
}
filteredRows.sort(function(row1, row2) {
filteredRows.sort((row1, row2) => {
const column = this.columns[this.sortedColumn];
const res = column.compareRows(row1, row2);
if (this.reverseSort === "0")
return res;
else
return -res;
}.bind(this));
});
return filteredRows;
},
@ -1516,14 +1516,14 @@ window.qBittorrent.DynamicTable = (function() {
}
}
filteredRows.sort(function(row1, row2) {
filteredRows.sort((row1, row2) => {
const column = this.columns[this.sortedColumn];
const res = column.compareRows(row1, row2);
if (this.reverseSort === "0")
return res;
else
return -res;
}.bind(this));
});
return filteredRows;
},
@ -1780,14 +1780,14 @@ window.qBittorrent.DynamicTable = (function() {
filteredRows = rows;
}
filteredRows.sort(function(row1, row2) {
filteredRows.sort((row1, row2) => {
const column = this.columns[this.sortedColumn];
const res = column.compareRows(row1, row2);
if (this.reverseSort === "0")
return res;
else
return -res;
}.bind(this));
});
return filteredRows;
},
@ -1860,9 +1860,9 @@ window.qBittorrent.DynamicTable = (function() {
populateTable: function(root) {
this.fileTree.setRoot(root);
root.children.each(function(node) {
root.children.each((node) => {
this._addNodeToTable(node, 0);
}.bind(this));
});
},
_addNodeToTable: function(node, depth) {
@ -1888,9 +1888,9 @@ window.qBittorrent.DynamicTable = (function() {
this.updateRowData(node.data);
}
node.children.each(function(child) {
node.children.each((child) => {
this._addNodeToTable(child, depth + 1);
}.bind(this));
});
},
getRoot: function() {
@ -2021,7 +2021,7 @@ window.qBittorrent.DynamicTable = (function() {
checkbox.set("id", "cbRename" + id);
checkbox.set("data-id", id);
checkbox.set("class", "RenamingCB");
checkbox.addEvent("click", function(e) {
checkbox.addEvent("click", (e) => {
const node = that.getNode(id);
node.checked = e.target.checked ? 0 : 1;
node.full_data.checked = node.checked;
@ -2103,7 +2103,7 @@ window.qBittorrent.DynamicTable = (function() {
reselectRows: function(rowIds) {
const that = this;
this.deselectAll();
this.tableBody.getElements("tr").each(function(tr) {
this.tableBody.getElements("tr").each((tr) => {
if (rowIds.includes(tr.rowId)) {
const node = that.getNode(tr.rowId);
node.checked = 0;
@ -2122,7 +2122,7 @@ window.qBittorrent.DynamicTable = (function() {
altRow: function() {
let addClass = false;
const trs = this.tableBody.getElements("tr");
trs.each(function(tr) {
trs.each((tr) => {
if (tr.hasClass("invisible"))
return;
@ -2135,11 +2135,11 @@ window.qBittorrent.DynamicTable = (function() {
tr.addClass("nonAlt");
}
addClass = !addClass;
}.bind(this));
});
},
_sortNodesByColumn: function(nodes, column) {
nodes.sort(function(row1, row2) {
nodes.sort((row1, row2) => {
// list folders before files when sorting by name
if (column.name === "original") {
const node1 = this.getNode(row1.data.rowId);
@ -2152,20 +2152,20 @@ window.qBittorrent.DynamicTable = (function() {
const res = column.compareRows(row1, row2);
return (this.reverseSort === "0") ? res : -res;
}.bind(this));
});
nodes.each(function(node) {
nodes.each((node) => {
if (node.children.length > 0)
this._sortNodesByColumn(node.children, column);
}.bind(this));
});
},
_filterNodes: function(node, filterTerms, filteredRows) {
if (node.isFolder) {
const childAdded = node.children.reduce(function(acc, child) {
const childAdded = node.children.reduce((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);
}, false);
if (childAdded) {
const row = this.getRow(node);
@ -2196,7 +2196,7 @@ window.qBittorrent.DynamicTable = (function() {
return [];
const generateRowsSignature = function(rows) {
const rowsData = rows.map(function(row) {
const rowsData = rows.map((row) => {
return row.full_data;
});
return JSON.stringify(rowsData);
@ -2205,25 +2205,25 @@ window.qBittorrent.DynamicTable = (function() {
const getFilteredRows = function() {
if (this.filterTerms.length === 0) {
const nodeArray = this.fileTree.toArray();
const filteredRows = nodeArray.map(function(node) {
const filteredRows = nodeArray.map((node) => {
return this.getRow(node);
}.bind(this));
});
return filteredRows;
}
const filteredRows = [];
this.getRoot().children.each(function(child) {
this.getRoot().children.each((child) => {
this._filterNodes(child, this.filterTerms, filteredRows);
}.bind(this));
});
filteredRows.reverse();
return filteredRows;
}.bind(this);
const hasRowsChanged = function(rowsString, prevRowsStringString) {
const rowsChanged = (rowsString !== prevRowsStringString);
const isFilterTermsChanged = this.filterTerms.reduce(function(acc, term, index) {
const isFilterTermsChanged = this.filterTerms.reduce((acc, term, index) => {
return (acc || (term !== this.prevFilterTerms[index]));
}.bind(this), false);
}, false);
const isFilterChanged = ((this.filterTerms.length !== this.prevFilterTerms.length)
|| ((this.filterTerms.length > 0) && isFilterTermsChanged));
const isSortedColumnChanged = (this.prevSortedColumn !== this.sortedColumn);
@ -2285,9 +2285,9 @@ window.qBittorrent.DynamicTable = (function() {
populateTable: function(root) {
this.fileTree.setRoot(root);
root.children.each(function(node) {
root.children.each((node) => {
this._addNodeToTable(node, 0);
}.bind(this));
});
},
_addNodeToTable: function(node, depth) {
@ -2316,9 +2316,9 @@ window.qBittorrent.DynamicTable = (function() {
this.updateRowData(node.data);
}
node.children.each(function(child) {
node.children.each((child) => {
this._addNodeToTable(child, depth + 1);
}.bind(this));
});
},
getRoot: function() {
@ -2472,7 +2472,7 @@ window.qBittorrent.DynamicTable = (function() {
altRow: function() {
let addClass = false;
const trs = this.tableBody.getElements("tr");
trs.each(function(tr) {
trs.each((tr) => {
if (tr.hasClass("invisible"))
return;
@ -2485,11 +2485,11 @@ window.qBittorrent.DynamicTable = (function() {
tr.addClass("nonAlt");
}
addClass = !addClass;
}.bind(this));
});
},
_sortNodesByColumn: function(nodes, column) {
nodes.sort(function(row1, row2) {
nodes.sort((row1, row2) => {
// list folders before files when sorting by name
if (column.name === "name") {
const node1 = this.getNode(row1.data.rowId);
@ -2502,20 +2502,20 @@ window.qBittorrent.DynamicTable = (function() {
const res = column.compareRows(row1, row2);
return (this.reverseSort === "0") ? res : -res;
}.bind(this));
});
nodes.each(function(node) {
nodes.each((node) => {
if (node.children.length > 0)
this._sortNodesByColumn(node.children, column);
}.bind(this));
});
},
_filterNodes: function(node, filterTerms, filteredRows) {
if (node.isFolder) {
const childAdded = node.children.reduce(function(acc, child) {
const childAdded = node.children.reduce((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);
}, false);
if (childAdded) {
const row = this.getRow(node);
@ -2546,7 +2546,7 @@ window.qBittorrent.DynamicTable = (function() {
return [];
const generateRowsSignature = function(rows) {
const rowsData = rows.map(function(row) {
const rowsData = rows.map((row) => {
return row.full_data;
});
return JSON.stringify(rowsData);
@ -2555,25 +2555,25 @@ window.qBittorrent.DynamicTable = (function() {
const getFilteredRows = function() {
if (this.filterTerms.length === 0) {
const nodeArray = this.fileTree.toArray();
const filteredRows = nodeArray.map(function(node) {
const filteredRows = nodeArray.map((node) => {
return this.getRow(node);
}.bind(this));
});
return filteredRows;
}
const filteredRows = [];
this.getRoot().children.each(function(child) {
this.getRoot().children.each((child) => {
this._filterNodes(child, this.filterTerms, filteredRows);
}.bind(this));
});
filteredRows.reverse();
return filteredRows;
}.bind(this);
const hasRowsChanged = function(rowsString, prevRowsStringString) {
const rowsChanged = (rowsString !== prevRowsStringString);
const isFilterTermsChanged = this.filterTerms.reduce(function(acc, term, index) {
const isFilterTermsChanged = this.filterTerms.reduce((acc, term, index) => {
return (acc || (term !== this.prevFilterTerms[index]));
}.bind(this), false);
}, false);
const isFilterChanged = ((this.filterTerms.length !== this.prevFilterTerms.length)
|| ((this.filterTerms.length > 0) && isFilterTermsChanged));
const isSortedColumnChanged = (this.prevSortedColumn !== this.sortedColumn);
@ -3181,11 +3181,11 @@ window.qBittorrent.DynamicTable = (function() {
filteredRows = rows;
}
filteredRows.sort(function(row1, row2) {
filteredRows.sort((row1, row2) => {
const column = this.columns[this.sortedColumn];
const res = column.compareRows(row1, row2);
return (this.reverseSort === "0") ? res : -res;
}.bind(this));
});
return filteredRows;
},
@ -3244,11 +3244,11 @@ window.qBittorrent.DynamicTable = (function() {
filteredRows = rows;
}
filteredRows.sort(function(row1, row2) {
filteredRows.sort((row1, row2) => {
const column = this.columns[this.sortedColumn];
const res = column.compareRows(row1, row2);
return (this.reverseSort === "0") ? res : -res;
}.bind(this));
});
return filteredRows;
}

View file

@ -81,9 +81,9 @@ window.qBittorrent.FileTree = (function() {
this.nodeMap[node.rowId] = node;
}
node.children.each(function(child) {
node.children.each((child) => {
this.generateNodeMap(child);
}.bind(this));
});
},
getNode: function(rowId) {
@ -101,17 +101,17 @@ window.qBittorrent.FileTree = (function() {
*/
toArray: function() {
const nodes = [];
this.root.children.each(function(node) {
this.root.children.each((node) => {
this._getArrayOfNodes(node, nodes);
}.bind(this));
});
return nodes;
},
_getArrayOfNodes: function(node, array) {
array.push(node);
node.children.each(function(child) {
node.children.each((child) => {
this._getArrayOfNodes(child, array);
}.bind(this));
});
}
});
@ -161,7 +161,7 @@ window.qBittorrent.FileTree = (function() {
let isFirstFile = true;
this.children.each(function(node) {
this.children.each((node) => {
if (node.isFolder)
node.calculateSize();
@ -185,7 +185,7 @@ window.qBittorrent.FileTree = (function() {
progress += (node.progress * node.size);
availability += (node.availability * node.size);
}
}.bind(this));
});
this.size = size;
this.remaining = remaining;

View file

@ -206,7 +206,7 @@ window.qBittorrent.Misc = (function() {
*/
const containsAllTerms = function(text, terms) {
const textToSearch = text.toLowerCase();
return terms.every(function(term) {
return terms.every((term) => {
const isTermRequired = (term[0] === "+");
const isTermExcluded = (term[0] === "-");
if (isTermRequired || isTermExcluded) {

View file

@ -109,14 +109,14 @@ const initializeWindows = function() {
};
function addClickEvent(el, fn) {
["Link", "Button"].each(function(item) {
["Link", "Button"].each((item) => {
if ($(el + item)) {
$(el + item).addEvent("click", fn);
}
});
}
addClickEvent("download", function(e) {
addClickEvent("download", (e) => {
new Event(e).stop();
showDownloadPage();
});
@ -149,7 +149,7 @@ const initializeWindows = function() {
updateMainData();
};
addClickEvent("preferences", function(e) {
addClickEvent("preferences", (e) => {
new Event(e).stop();
const id = "preferencesPage";
new MochaUI.Window({
@ -174,7 +174,7 @@ const initializeWindows = function() {
});
});
addClickEvent("upload", function(e) {
addClickEvent("upload", (e) => {
new Event(e).stop();
const id = "uploadPage";
new MochaUI.Window({
@ -400,7 +400,7 @@ const initializeWindows = function() {
}
};
addClickEvent("delete", function(e) {
addClickEvent("delete", (e) => {
new Event(e).stop();
deleteFN();
});
@ -437,7 +437,7 @@ const initializeWindows = function() {
const hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
let enable = false;
hashes.each(function(hash, index) {
hashes.each((hash, index) => {
const row = torrentsTable.rows[hash];
if (!row.full_data.auto_tmm)
enable = true;
@ -1098,12 +1098,12 @@ const initializeWindows = function() {
}
});
["stop", "start", "recheck"].each(function(item) {
addClickEvent(item, function(e) {
["stop", "start", "recheck"].each((item) => {
addClickEvent(item, (e) => {
new Event(e).stop();
const hashes = torrentsTable.selectedRowsIds();
if (hashes.length) {
hashes.each(function(hash, index) {
hashes.each((hash, index) => {
new Request({
url: "api/v2/torrents/" + item,
method: "post",
@ -1117,8 +1117,8 @@ const initializeWindows = function() {
});
});
["decreasePrio", "increasePrio", "topPrio", "bottomPrio"].each(function(item) {
addClickEvent(item, function(e) {
["decreasePrio", "increasePrio", "topPrio", "bottomPrio"].each((item) => {
addClickEvent(item, (e) => {
new Event(e).stop();
setQueuePositionFN(item);
});
@ -1138,7 +1138,7 @@ const initializeWindows = function() {
}
};
addClickEvent("about", function(e) {
addClickEvent("about", (e) => {
new Event(e).stop();
const id = "aboutpage";
new MochaUI.Window({
@ -1160,7 +1160,7 @@ const initializeWindows = function() {
});
});
addClickEvent("logout", function(e) {
addClickEvent("logout", (e) => {
new Event(e).stop();
new Request({
url: "api/v2/auth/logout",
@ -1171,7 +1171,7 @@ const initializeWindows = function() {
}).send();
});
addClickEvent("shutdown", function(e) {
addClickEvent("shutdown", (e) => {
new Event(e).stop();
if (confirm("QBT_TR(Are you sure you want to quit qBittorrent?)QBT_TR[CONTEXT=MainWindow]")) {
new Request({
@ -1189,8 +1189,8 @@ const initializeWindows = function() {
});
// Deactivate menu header links
$$("a.returnFalse").each(function(el) {
el.addEvent("click", function(e) {
$$("a.returnFalse").each((el) => {
el.addEvent("click", (e) => {
new Event(e).stop();
});
});

View file

@ -266,7 +266,7 @@ window.qBittorrent.PiecesBar = (() => {
if (!obj)
return;
if (!obj.parentNode)
return setTimeout(function() { checkForParent(id); }, 1);
return setTimeout(() => { checkForParent(id); }, 1);
obj.refresh();
}

View file

@ -82,7 +82,7 @@ window.qBittorrent.PropFiles = (function() {
const getChildFiles = function(node) {
if (node.isFolder) {
node.children.each(function(child) {
node.children.each((child) => {
getChildFiles(child);
});
}
@ -92,7 +92,7 @@ window.qBittorrent.PropFiles = (function() {
}
};
node.children.each(function(child) {
node.children.each((child) => {
getChildFiles(child);
});
@ -229,7 +229,7 @@ window.qBittorrent.PropFiles = (function() {
if (checkbox.state === "checked") {
setCheckboxUnchecked(checkbox);
// set file priority for all checked to Ignored
torrentFilesTable.getFilteredAndSortedRows().forEach(function(row) {
torrentFilesTable.getFilteredAndSortedRows().forEach((row) => {
const rowId = row.rowId;
const fileId = row.full_data.fileId;
const isChecked = (row.full_data.checked === TriState.Checked);
@ -244,7 +244,7 @@ window.qBittorrent.PropFiles = (function() {
setCheckboxChecked(checkbox);
priority = FilePriority.Normal;
// set file priority for all unchecked to Normal
torrentFilesTable.getFilteredAndSortedRows().forEach(function(row) {
torrentFilesTable.getFilteredAndSortedRows().forEach((row) => {
const rowId = row.rowId;
const fileId = row.full_data.fileId;
const isUnchecked = (row.full_data.checked === TriState.Unchecked);
@ -324,7 +324,7 @@ window.qBittorrent.PropFiles = (function() {
}).send();
const ignore = (priority === FilePriority.Ignored);
ids.forEach(function(_id) {
ids.forEach((_id) => {
torrentFilesTable.setIgnored(_id, ignore);
const combobox = $("comboPrio" + _id);
@ -388,7 +388,7 @@ window.qBittorrent.PropFiles = (function() {
const handleNewTorrentFiles = function(files) {
is_seed = (files.length > 0) ? files[0].is_seed : true;
const rows = files.map(function(file, index) {
const rows = files.map((file, index) => {
let progress = (file.progress * 100).round(1);
if ((progress === 100) && (file.progress < 1))
progress = 99.9;
@ -421,12 +421,12 @@ window.qBittorrent.PropFiles = (function() {
const rootNode = new window.qBittorrent.FileTree.FolderNode();
rows.forEach(function(row) {
rows.forEach((row) => {
const pathItems = row.fileName.split(window.qBittorrent.Filesystem.PathSeparator);
pathItems.pop(); // remove last item (i.e. file name)
let parent = rootNode;
pathItems.forEach(function(folderName) {
pathItems.forEach((folderName) => {
if (folderName === ".unwanted")
return;
@ -474,7 +474,7 @@ window.qBittorrent.PropFiles = (function() {
parent.addChild(childNode);
++rowId;
}.bind(this));
});
torrentFilesTable.populateTable(rootNode);
torrentFilesTable.updateTable(false);
@ -516,7 +516,7 @@ window.qBittorrent.PropFiles = (function() {
const rowIds = [];
const fileIds = [];
selectedRows.forEach(function(rowId) {
selectedRows.forEach((rowId) => {
const elem = $("comboPrio" + rowId);
rowIds.push(rowId);
fileIds.push(elem.get("data-file-id"));
@ -526,10 +526,10 @@ window.qBittorrent.PropFiles = (function() {
const uniqueFileIds = {};
for (let i = 0; i < rowIds.length; ++i) {
const rows = getAllChildren(rowIds[i], fileIds[i]);
rows.rowIds.forEach(function(rowId) {
rows.rowIds.forEach((rowId) => {
uniqueRowIds[rowId] = true;
});
rows.fileIds.forEach(function(fileId) {
rows.fileIds.forEach((fileId) => {
uniqueFileIds[fileId] = true;
});
}
@ -721,8 +721,8 @@ window.qBittorrent.PropFiles = (function() {
const expandAllNodes = function() {
const root = torrentFilesTable.getRoot();
root.children.each(function(node) {
node.children.each(function(child) {
root.children.each((node) => {
node.children.each((child) => {
_collapseNode(child, false, true, false);
});
});
@ -731,8 +731,8 @@ window.qBittorrent.PropFiles = (function() {
const collapseAllNodes = function() {
const root = torrentFilesTable.getRoot();
root.children.each(function(node) {
node.children.each(function(child) {
root.children.each((node) => {
node.children.each((child) => {
_collapseNode(child, true, true, false);
});
});
@ -757,7 +757,7 @@ window.qBittorrent.PropFiles = (function() {
if (!isChildNode || applyToChildren || !canSkipNode)
_updateNodeState(node, shouldCollapse);
node.children.each(function(child) {
node.children.each((child) => {
_hideNode(child, shouldCollapse);
if (!child.isFolder)

View file

@ -86,7 +86,7 @@ window.qBittorrent.PropPeers = (function() {
}
}
if (response["peers_removed"]) {
response["peers_removed"].each(function(hash) {
response["peers_removed"].each((hash) => {
torrentPeersTable.removeRow(hash);
});
}

View file

@ -75,7 +75,7 @@ window.qBittorrent.PropTrackers = (function() {
torrentTrackersTable.clear();
if (trackers) {
trackers.each(function(tracker) {
trackers.each((tracker) => {
let status;
switch (tracker.status) {
case 0:
@ -147,7 +147,7 @@ window.qBittorrent.PropTrackers = (function() {
},
onShow: function() {
const selectedTrackers = torrentTrackersTable.selectedRowsIds();
const containsStaticTracker = selectedTrackers.some(function(tracker) {
const containsStaticTracker = selectedTrackers.some((tracker) => {
return (tracker.indexOf("** [") === 0);
});

View file

@ -58,9 +58,9 @@ window.qBittorrent.PropWebseeds = (function() {
},
removeAllRows: function() {
this.rows.each(function(tr, url) {
this.rows.each((tr, url) => {
this.removeRow(url);
}.bind(this));
});
},
updateRow: function(tr, row) {
@ -124,7 +124,7 @@ window.qBittorrent.PropWebseeds = (function() {
$("error_div").set("html", "");
if (webseeds) {
// Update WebSeeds data
webseeds.each(function(webseed) {
webseeds.each((webseed) => {
const row = [];
row.length = 1;
row[0] = webseed.url;

View file

@ -450,14 +450,14 @@ window.qBittorrent.Search = (function() {
};
const openSearchTorrentDescriptionUrl = function() {
searchResultsTable.selectedRowsIds().each(function(rowId) {
searchResultsTable.selectedRowsIds().each((rowId) => {
window.open(searchResultsTable.rows.get(rowId).full_data.descrLink, "_blank");
});
};
const copySearchTorrentName = function() {
const names = [];
searchResultsTable.selectedRowsIds().each(function(rowId) {
searchResultsTable.selectedRowsIds().each((rowId) => {
names.push(searchResultsTable.rows.get(rowId).full_data.fileName);
});
return names.join("\n");
@ -465,7 +465,7 @@ window.qBittorrent.Search = (function() {
const copySearchTorrentDownloadLink = function() {
const urls = [];
searchResultsTable.selectedRowsIds().each(function(rowId) {
searchResultsTable.selectedRowsIds().each((rowId) => {
urls.push(searchResultsTable.rows.get(rowId).full_data.fileUrl);
});
return urls.join("\n");
@ -473,7 +473,7 @@ window.qBittorrent.Search = (function() {
const copySearchTorrentDescriptionUrl = function() {
const urls = [];
searchResultsTable.selectedRowsIds().each(function(rowId) {
searchResultsTable.selectedRowsIds().each((rowId) => {
urls.push(searchResultsTable.rows.get(rowId).full_data.descrLink);
});
return urls.join("\n");
@ -481,7 +481,7 @@ window.qBittorrent.Search = (function() {
const downloadSearchTorrent = function() {
const urls = [];
searchResultsTable.selectedRowsIds().each(function(rowId) {
searchResultsTable.selectedRowsIds().each((rowId) => {
urls.push(searchResultsTable.rows.get(rowId).full_data.fileUrl);
});
@ -579,7 +579,7 @@ window.qBittorrent.Search = (function() {
const getSearchCategories = function() {
const populateCategorySelect = function(categories) {
const categoryHtml = [];
categories.each(function(category) {
categories.each((category) => {
const option = new Element("option");
option.set("value", category.id);
option.set("html", category.name);
@ -633,7 +633,7 @@ window.qBittorrent.Search = (function() {
if (response !== prevSearchPluginsResponse) {
prevSearchPluginsResponse = response;
searchPlugins.length = 0;
response.forEach(function(plugin) {
response.forEach((plugin) => {
searchPlugins.push(plugin);
});
@ -655,7 +655,7 @@ window.qBittorrent.Search = (function() {
return window.qBittorrent.Misc.naturalSortCollator.compare(leftName, rightName);
});
allPlugins.each(function(plugin) {
allPlugins.each((plugin) => {
if (plugin.enabled === true)
pluginsHtml.push("<option value='" + window.qBittorrent.Misc.escapeHtml(plugin.name) + "'>" + window.qBittorrent.Misc.escapeHtml(plugin.fullName) + "</option>");
});
@ -744,11 +744,11 @@ window.qBittorrent.Search = (function() {
const setupSearchTableEvents = function(enable) {
if (enable)
$$(".searchTableRow").each(function(target) {
$$(".searchTableRow").each((target) => {
target.addEventListener("dblclick", downloadSearchTorrent, false);
});
else
$$(".searchTableRow").each(function(target) {
$$(".searchTableRow").each((target) => {
target.removeEventListener("dblclick", downloadSearchTorrent, false);
});
};

View file

@ -29,7 +29,7 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const path = new URI().getData("path");
// set text field to current value
@ -37,7 +37,7 @@
$("setLocation").value = decodeURIComponent(path);
$("setLocation").focus();
$("setLocationButton").addEvent("click", function(e) {
$("setLocationButton").addEvent("click", (e) => {
new Event(e).stop();
// check field
const location = $("setLocation").value.trim();

View file

@ -32,7 +32,7 @@
}
}).activate();
window.addEvent("domready", function() {
window.addEvent("domready", () => {
const hashesList = new URI().getData("hashes").split("|");
const origValues = new URI().getData("orig").split("|");
@ -76,7 +76,7 @@
shareLimitChanged();
$("default").focus();
$("save").addEvent("click", function(e) {
$("save").addEvent("click", (e) => {
new Event(e).stop();
if (!isFormValid()) {

View file

@ -154,7 +154,7 @@
let submitted = false;
$("uploadForm").addEventListener("submit", function() {
$("uploadForm").addEventListener("submit", () => {
$("startTorrentHidden").value = $("startTorrent").checked ? "false" : "true";
$("dlLimitHidden").value = $("dlLimitText").value.toInt() * 1024;
@ -164,7 +164,7 @@
submitted = true;
});
$("upload_frame").addEventListener("load", function() {
$("upload_frame").addEventListener("load", () => {
if (submitted)
window.parent.qBittorrent.Client.closeWindows();
});

View file

@ -16,32 +16,32 @@
(function() {
MochaUI.initializeTabs("aboutTabs");
$("aboutAboutLink").addEvent("click", function() {
$("aboutAboutLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutAboutContent").removeClass("invisible");
});
$("aboutAuthorLink").addEvent("click", function() {
$("aboutAuthorLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutAuthorContent").removeClass("invisible");
});
$("aboutSpecialThanksLink").addEvent("click", function() {
$("aboutSpecialThanksLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutSpecialThanksContent").removeClass("invisible");
});
$("aboutTranslatorsLink").addEvent("click", function() {
$("aboutTranslatorsLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutTranslatorsContent").removeClass("invisible");
});
$("aboutLicenseLink").addEvent("click", function() {
$("aboutLicenseLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutLicenseContent").removeClass("invisible");
});
$("aboutSoftwareUsedLink").addEvent("click", function() {
$("aboutSoftwareUsedLink").addEvent("click", () => {
$$(".aboutTabContent").addClass("invisible");
$("aboutSoftwareUsedContent").removeClass("invisible");
});

View file

@ -217,7 +217,7 @@
menu: "logTableMenu",
actions: {
Clear: () => {
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach(function(rowId) {
tableInfo[currentSelectedTab].instance.selectedRowsIds().forEach((rowId) => {
tableInfo[currentSelectedTab].instance.removeRow(rowId);
});
@ -420,7 +420,7 @@
new ClipboardJS(".copyLogDataToClipboard", {
text: function() {
const msg = [];
tableInfo[currentSelectedTab].instance.selectedRowsIds().each(function(rowId) {
tableInfo[currentSelectedTab].instance.selectedRowsIds().each((rowId) => {
msg.push(tableInfo[currentSelectedTab].instance.rows.get(rowId).full_data[(currentSelectedTab === "main") ? "message" : "ip"]);
});

View file

@ -1935,7 +1935,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
ifaces.push({ name: default_iface_name || default_iface, value: default_iface });
$("networkInterface").options.add(new Option("QBT_TR(Any interface)QBT_TR[CONTEXT=OptionsDialog]", ""));
ifaces.forEach(function(item, index) {
ifaces.forEach((item, index) => {
$("networkInterface").options.add(new Option(item.name, item.value));
});
$("networkInterface").setProperty("value", default_iface);
@ -1963,7 +1963,7 @@ Use ';' to split multiple entries. Can use wildcard '*'.)QBT_TR[CONTEXT=OptionsD
$("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"));
$("optionalIPAddressToBind").options.add(new Option("QBT_TR(All IPv6 addresses)QBT_TR[CONTEXT=OptionDialog]", "::"));
addresses.forEach(function(item, index) {
addresses.forEach((item, index) => {
$("optionalIPAddressToBind").options.add(new Option(item, item));
});
$("optionalIPAddressToBind").setProperty("value", default_addr);

View file

@ -20,35 +20,35 @@
// Tabs
MochaUI.initializeTabs("preferencesTabs");
$("PrefBehaviorLink").addEvent("click", function(e) {
$("PrefBehaviorLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("BehaviorTab").removeClass("invisible");
});
$("PrefDownloadsLink").addEvent("click", function(e) {
$("PrefDownloadsLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("DownloadsTab").removeClass("invisible");
});
$("PrefConnectionLink").addEvent("click", function(e) {
$("PrefConnectionLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("ConnectionTab").removeClass("invisible");
});
$("PrefSpeedLink").addEvent("click", function(e) {
$("PrefSpeedLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("SpeedTab").removeClass("invisible");
});
$("PrefBittorrentLink").addEvent("click", function(e) {
$("PrefBittorrentLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("BittorrentTab").removeClass("invisible");
});
$("PrefRSSLink").addEvent("click", function(e) {
$("PrefRSSLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("RSSTab").removeClass("invisible");
});
$("PrefWebUILink").addEvent("click", function(e) {
$("PrefWebUILink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("WebUITab").removeClass("invisible");
});
$("PrefAdvancedLink").addEvent("click", function(e) {
$("PrefAdvancedLink").addEvent("click", (e) => {
$$(".PrefTab").addClass("invisible");
$("AdvancedTab").removeClass("invisible");
});

View file

@ -188,12 +188,12 @@
const setupSearchPluginTableEvents = function(enable) {
if (enable)
$$(".searchPluginsTableRow").each(function(target) {
$$(".searchPluginsTableRow").each((target) => {
target.addEventListener("dblclick", enablePlugin, false);
target.addEventListener("contextmenu", updateSearchPluginsTableContextMenuOffset, true);
});
else
$$(".searchPluginsTableRow").each(function(target) {
$$(".searchPluginsTableRow").each((target) => {
target.removeEventListener("dblclick", enablePlugin, false);
target.removeEventListener("contextmenu", updateSearchPluginsTableContextMenuOffset, true);
});