WebUI: enforce string quotes coding style

This commit is contained in:
Chocobo1
2024-05-27 22:50:17 +08:00
parent 6d073771ca
commit cb90b6769c
58 changed files with 3522 additions and 3514 deletions

View File

@@ -26,7 +26,7 @@
* exception statement from your version.
*/
'use strict';
"use strict";
if (window.qBittorrent === undefined) {
window.qBittorrent = {};
@@ -45,8 +45,8 @@ window.qBittorrent.PropPeers = (function() {
let show_flags = true;
const loadTorrentPeersData = function() {
if ($('prop_peers').hasClass('invisible')
|| $('propertiesPanel_collapseToggle').hasClass('panel-expand')) {
if ($("prop_peers").hasClass("invisible")
|| $("propertiesPanel_collapseToggle").hasClass("panel-expand")) {
syncTorrentPeersLastResponseId = 0;
torrentPeersTable.clear();
return;
@@ -59,45 +59,45 @@ window.qBittorrent.PropPeers = (function() {
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
return;
}
const url = new URI('api/v2/sync/torrentPeers');
url.setData('rid', syncTorrentPeersLastResponseId);
url.setData('hash', current_hash);
const url = new URI("api/v2/sync/torrentPeers");
url.setData("rid", syncTorrentPeersLastResponseId);
url.setData("hash", current_hash);
new Request.JSON({
url: url,
method: 'get',
method: "get",
noCache: true,
onComplete: function() {
clearTimeout(loadTorrentPeersTimer);
loadTorrentPeersTimer = loadTorrentPeersData.delay(window.qBittorrent.Client.getSyncMainDataInterval());
},
onSuccess: function(response) {
$('error_div').set('html', '');
$("error_div").set("html", "");
if (response) {
const full_update = (response['full_update'] === true);
const full_update = (response["full_update"] === true);
if (full_update)
torrentPeersTable.clear();
if (response['rid'])
syncTorrentPeersLastResponseId = response['rid'];
if (response['peers']) {
for (const key in response['peers']) {
response['peers'][key]['rowId'] = key;
if (response["rid"])
syncTorrentPeersLastResponseId = response["rid"];
if (response["peers"]) {
for (const key in response["peers"]) {
response["peers"][key]["rowId"] = key;
torrentPeersTable.updateRowData(response['peers'][key]);
torrentPeersTable.updateRowData(response["peers"][key]);
}
}
if (response['peers_removed']) {
response['peers_removed'].each(function(hash) {
if (response["peers_removed"]) {
response["peers_removed"].each(function(hash) {
torrentPeersTable.removeRow(hash);
});
}
torrentPeersTable.updateTable(full_update);
torrentPeersTable.altRow();
if (response['show_flags']) {
if (show_flags !== response['show_flags']) {
show_flags = response['show_flags'];
torrentPeersTable.columns['country'].force_hide = !show_flags;
torrentPeersTable.updateColumn('country');
if (response["show_flags"]) {
if (show_flags !== response["show_flags"]) {
show_flags = response["show_flags"];
torrentPeersTable.columns["country"].force_hide = !show_flags;
torrentPeersTable.updateColumn("country");
}
}
}
@@ -114,8 +114,8 @@ window.qBittorrent.PropPeers = (function() {
};
const torrentPeersContextMenu = new window.qBittorrent.ContextMenu.ContextMenu({
targets: '#torrentPeersTableDiv',
menu: 'torrentPeersMenu',
targets: "#torrentPeersTableDiv",
menu: "torrentPeersMenu",
actions: {
addPeer: function(element, ref) {
const hash = torrentsTable.getCurrentTorrentID();
@@ -123,10 +123,10 @@ window.qBittorrent.PropPeers = (function() {
return;
new MochaUI.Window({
id: 'addPeersPage',
id: "addPeersPage",
title: "QBT_TR(Add Peers)QBT_TR[CONTEXT=PeersAdditionDialog]",
loadMethod: 'iframe',
contentURL: 'addpeers.html?hash=' + hash,
loadMethod: "iframe",
contentURL: "addpeers.html?hash=" + hash,
scrollbars: false,
resizable: false,
maximizable: false,
@@ -141,13 +141,13 @@ window.qBittorrent.PropPeers = (function() {
if (selectedPeers.length === 0)
return;
if (confirm('QBT_TR(Are you sure you want to permanently ban the selected peers?)QBT_TR[CONTEXT=PeerListWidget]')) {
if (confirm("QBT_TR(Are you sure you want to permanently ban the selected peers?)QBT_TR[CONTEXT=PeerListWidget]")) {
new Request({
url: 'api/v2/transfer/banPeers',
method: 'post',
url: "api/v2/transfer/banPeers",
method: "post",
data: {
hash: torrentsTable.getCurrentTorrentID(),
peers: selectedPeers.join('|')
peers: selectedPeers.join("|")
}
}).send();
}
@@ -161,23 +161,23 @@ window.qBittorrent.PropPeers = (function() {
const selectedPeers = torrentPeersTable.selectedRowsIds();
if (selectedPeers.length >= 1) {
this.showItem('copyPeer');
this.showItem('banPeer');
this.showItem("copyPeer");
this.showItem("banPeer");
}
else {
this.hideItem('copyPeer');
this.hideItem('banPeer');
this.hideItem("copyPeer");
this.hideItem("banPeer");
}
}
});
new ClipboardJS('#CopyPeerInfo', {
new ClipboardJS("#CopyPeerInfo", {
text: function(trigger) {
return torrentPeersTable.selectedRowsIds().join("\n");
}
});
torrentPeersTable.setup('torrentPeersTableDiv', 'torrentPeersTableFixedHeaderDiv', torrentPeersContextMenu);
torrentPeersTable.setup("torrentPeersTableDiv", "torrentPeersTableFixedHeaderDiv", torrentPeersContextMenu);
return exports();
})();