Apply code formatting

This commit is contained in:
Chocobo1
2021-03-24 14:00:27 +08:00
parent 45465e994e
commit 121ff2b7be
19 changed files with 264 additions and 253 deletions

View File

@@ -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) {

View File

@@ -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();
})();

View File

@@ -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, "<a target='_blank' href='$1'>$1</a>");

View File

@@ -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,

View File

@@ -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;