WebUI: disallow unnecessary quotes in property name

Those two forms are the same and from now on we enforce to one style.

PR #22051.
This commit is contained in:
Chocobo1
2024-12-24 22:25:18 +08:00
committed by GitHub
parent bbc3c2832f
commit 7487cd7e6d
41 changed files with 144 additions and 143 deletions

View File

@@ -121,7 +121,7 @@ window.qBittorrent.Cache ??= (() => {
fetch("api/v2/app/setPreferences", {
method: "POST",
body: new URLSearchParams({
"json": JSON.stringify(obj.data)
json: JSON.stringify(obj.data)
})
})
.then(async (response) => {

View File

@@ -724,25 +724,25 @@ window.addEventListener("DOMContentLoaded", () => {
};
const statusSortOrder = Object.freeze({
"unknown": -1,
"forcedDL": 0,
"downloading": 1,
"forcedMetaDL": 2,
"metaDL": 3,
"stalledDL": 4,
"forcedUP": 5,
"uploading": 6,
"stalledUP": 7,
"checkingResumeData": 8,
"queuedDL": 9,
"queuedUP": 10,
"checkingUP": 11,
"checkingDL": 12,
"stoppedDL": 13,
"stoppedUP": 14,
"moving": 15,
"missingFiles": 16,
"error": 17
unknown: -1,
forcedDL: 0,
downloading: 1,
forcedMetaDL: 2,
metaDL: 3,
stalledDL: 4,
forcedUP: 5,
uploading: 6,
stalledUP: 7,
checkingResumeData: 8,
queuedDL: 9,
queuedUP: 10,
checkingUP: 11,
checkingDL: 12,
stoppedDL: 13,
stoppedUP: 14,
moving: 15,
missingFiles: 16,
error: 17
});
let syncMainDataTimeoutID = -1;

View File

@@ -64,7 +64,7 @@ window.qBittorrent.DynamicTable ??= (() => {
};
let DynamicTableHeaderContextMenuClass = null;
let ProgressColumnWidth = -1;
let progressColumnWidth = -1;
const DynamicTable = new Class({
@@ -772,8 +772,8 @@ window.qBittorrent.DynamicTable ??= (() => {
if (!this.rows.has(rowId)) {
row = {
"full_data": {},
"rowId": rowId
full_data: {},
rowId: rowId
};
this.rows.set(rowId, row);
}
@@ -1231,16 +1231,16 @@ window.qBittorrent.DynamicTable ??= (() => {
const div = td.getChildren("div")[0];
if (td.resized) {
td.resized = false;
div.setWidth(ProgressColumnWidth - 5);
div.setWidth(progressColumnWidth - 5);
}
if (div.getValue() !== progressFormatted)
div.setValue(progressFormatted);
}
else {
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
if (progressColumnWidth < 0)
progressColumnWidth = td.offsetWidth;
td.append(new window.qBittorrent.ProgressBar.ProgressBar(progressFormatted.toFloat(), {
"width": ProgressColumnWidth - 5
width: progressColumnWidth - 5
}));
td.resized = false;
}
@@ -1249,11 +1249,11 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns["progress"].onResize = function(columnName) {
const pos = this.getColumnPos(columnName);
const trs = this.tableBody.getElements("tr");
ProgressColumnWidth = -1;
progressColumnWidth = -1;
for (let i = 0; i < trs.length; ++i) {
const td = trs[i].getElements("td")[pos];
if (ProgressColumnWidth < 0)
ProgressColumnWidth = td.offsetWidth;
if (progressColumnWidth < 0)
progressColumnWidth = td.offsetWidth;
td.resized = true;
this.columns[columnName].updateTd(td, this.rows.get(trs[i].rowId));
}
@@ -3265,7 +3265,7 @@ window.qBittorrent.DynamicTable ??= (() => {
initColumnsFunctions: function() {
this.columns["timestamp"].updateTd = function(td, row) {
const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
td.set({ "text": date, "title": date });
td.set({ text: date, title: date });
};
this.columns["type"].updateTd = function(td, row) {
@@ -3293,7 +3293,7 @@ window.qBittorrent.DynamicTable ??= (() => {
addClass = "logUnknown";
break;
}
td.set({ "text": logLevel, "title": logLevel });
td.set({ text: logLevel, title: logLevel });
td.closest("tr").className = `logTableRow${addClass}`;
};
},
@@ -3340,7 +3340,7 @@ window.qBittorrent.DynamicTable ??= (() => {
this.columns["timestamp"].updateTd = function(td, row) {
const date = new Date(this.getRowValue(row) * 1000).toLocaleString();
td.set({ "text": date, "title": date });
td.set({ text: date, title: date });
};
this.columns["blocked"].updateTd = function(td, row) {
@@ -3353,7 +3353,7 @@ window.qBittorrent.DynamicTable ??= (() => {
status = "QBT_TR(Banned)QBT_TR[CONTEXT=ExecutionLogWidget]";
addClass = "peerBanned";
}
td.set({ "text": status, "title": status });
td.set({ text: status, title: status });
td.closest("tr").className = `logTableRow${addClass}`;
};
},

View File

@@ -41,18 +41,18 @@ window.qBittorrent.FileTree ??= (() => {
};
const FilePriority = {
"Ignored": 0,
"Normal": 1,
"High": 6,
"Maximum": 7,
"Mixed": -1
Ignored: 0,
Normal: 1,
High: 6,
Maximum: 7,
Mixed: -1
};
Object.freeze(FilePriority);
const TriState = {
"Unchecked": 0,
"Checked": 1,
"Partial": 2
Unchecked: 0,
Checked: 1,
Partial: 2
};
Object.freeze(TriState);

View File

@@ -600,7 +600,7 @@ const initializeWindows = () => {
url: "api/v2/torrents/recheck",
method: "post",
data: {
"hashes": hashes.join("|"),
hashes: hashes.join("|"),
},
onSuccess: () => {
updateMainData();
@@ -694,7 +694,7 @@ const initializeWindows = () => {
paddingHorizontal: 0,
width: 800,
height: 420,
resizeLimit: { "x": [800], "y": [420] }
resizeLimit: { x: [800], y: [420] }
});
}
}

View File

@@ -48,13 +48,13 @@ window.qBittorrent.PiecesBar ??= (() => {
const PiecesBar = new Class({
initialize: (pieces, parameters) => {
const vals = {
"id": "piecesbar_" + (piecesBarUniqueId++),
"width": 0,
"height": 0,
"downloadingColor": "hsl(110deg 94% 27%)", // @TODO palette vars not supported for this value, apply average
"haveColor": "hsl(210deg 55% 55%)", // @TODO palette vars not supported for this value, apply average
"borderSize": 1,
"borderColor": "var(--color-border-default)"
id: "piecesbar_" + (piecesBarUniqueId++),
width: 0,
height: 0,
downloadingColor: "hsl(110deg 94% 27%)", // @TODO palette vars not supported for this value, apply average
haveColor: "hsl(210deg 55% 55%)", // @TODO palette vars not supported for this value, apply average
borderSize: 1,
borderColor: "var(--color-border-default)"
};
if (parameters && (typeOf(parameters) === "object"))

View File

@@ -36,18 +36,18 @@ window.qBittorrent.ProgressBar ??= (() => {
};
};
let ProgressBars = 0;
let progressBars = 0;
const ProgressBar = new Class({
initialize: (value, parameters) => {
const vals = {
"id": "progressbar_" + (ProgressBars++),
"value": [value, 0].pick(),
"width": 0,
"height": 0,
"darkbg": "var(--color-background-blue)",
"darkfg": "var(--color-text-white)",
"lightbg": "var(--color-background-default)",
"lightfg": "var(--color-text-default)"
id: "progressbar_" + (progressBars++),
value: [value, 0].pick(),
width: 0,
height: 0,
darkbg: "var(--color-background-blue)",
darkfg: "var(--color-text-white)",
lightbg: "var(--color-background-default)",
lightfg: "var(--color-text-default)"
};
if (parameters && (typeOf(parameters) === "object"))
Object.append(vals, parameters);

View File

@@ -311,9 +311,9 @@ window.qBittorrent.PropFiles ??= (() => {
fetch("api/v2/torrents/filePrio", {
method: "POST",
body: new URLSearchParams({
"hash": current_hash,
"id": fileIds.join("|"),
"priority": priority
hash: current_hash,
id: fileIds.join("|"),
priority: priority
})
})
.then((response) => {
@@ -580,7 +580,7 @@ window.qBittorrent.PropFiles ??= (() => {
paddingHorizontal: 0,
width: 800,
height: 420,
resizeLimit: { "x": [800], "y": [420] }
resizeLimit: { x: [800], y: [420] }
});
};

View File

@@ -154,8 +154,8 @@ window.qBittorrent.PropPeers ??= (() => {
fetch("api/v2/transfer/banPeers", {
method: "POST",
body: new URLSearchParams({
"hash": torrentsTable.getCurrentTorrentID(),
"peers": selectedPeers.join("|")
hash: torrentsTable.getCurrentTorrentID(),
peers: selectedPeers.join("|")
})
});
}

View File

@@ -10,9 +10,9 @@ window.qBittorrent.MultiRename ??= (() => {
};
const AppliesTo = {
"FilenameExtension": "FilenameExtension",
"Filename": "Filename",
"Extension": "Extension"
FilenameExtension: "FilenameExtension",
Filename: "Filename",
Extension: "Extension"
};
const RenameFiles = new Class({

View File

@@ -90,7 +90,7 @@ MochaUI.extend({
fetch("api/v2/torrents/uploadLimit", {
method: "POST",
body: new URLSearchParams({
"hashes": hashes.join("|")
hashes: hashes.join("|")
})
})
.then(async (response) => {
@@ -199,7 +199,7 @@ MochaUI.extend({
fetch("api/v2/torrents/downloadLimit", {
method: "POST",
body: new URLSearchParams({
"hashes": hashes.join("|")
hashes: hashes.join("|")
})
})
.then(async (response) => {