WebUI: don't auto infer radix parameter

This commit is contained in:
Chocobo1 2024-05-11 14:16:13 +08:00 committed by sledgehammer999
parent 1c5af96ad8
commit 4a36fe7278
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
7 changed files with 15 additions and 15 deletions

View file

@ -34,6 +34,7 @@ export default [
"operator-assignment": "error",
"prefer-arrow-callback": "error",
"prefer-const": "error",
"radix": "error",
"Stylistic/no-mixed-operators": [
"error",
{

View file

@ -28,7 +28,7 @@
menu: "multiRenameFilesMenu",
actions: {
ToggleSelection: function(element, ref) {
const rowId = parseInt(element.get("data-row-id"));
const rowId = parseInt(element.get("data-row-id"), 10);
const row = bulkRenameFilesTable.getNode(rowId);
const checkState = (row.checked === 1) ? 0 : 1;
bulkRenameFilesTable.toggleNodeTreeCheckbox(rowId, checkState);
@ -128,7 +128,7 @@
$("include_folders").checked = fileRenamer.includeFolders;
const multirename_fileEnumerationStart = LocalPreferences.get("multirename_fileEnumerationStart", 0);
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart);
fileRenamer.fileEnumerationStart = parseInt(multirename_fileEnumerationStart, 10);
$("file_counter").set("value", fileRenamer.fileEnumerationStart);
const multirename_replaceAll = LocalPreferences.get("multirename_replaceAll", false);

View file

@ -112,18 +112,18 @@ window.qBittorrent.Misc = (function() {
return "QBT_TR(< 1m)QBT_TR[CONTEXT=misc]";
let minutes = seconds / 60;
if (minutes < 60)
return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(minutes));
return "QBT_TR(%1m)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(minutes));
let hours = minutes / 60;
minutes %= 60;
if (hours < 24)
return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(hours)).replace("%2", parseInt(minutes));
return "QBT_TR(%1h %2m)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(hours)).replace("%2", Math.floor(minutes));
let days = hours / 24;
hours %= 24;
if (days < 365)
return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(days)).replace("%2", parseInt(hours));
return "QBT_TR(%1d %2h)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(days)).replace("%2", Math.floor(hours));
const years = days / 365;
days %= 365;
return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", parseInt(years)).replace("%2", parseInt(days));
return "QBT_TR(%1y %2d)QBT_TR[CONTEXT=misc]".replace("%1", Math.floor(years)).replace("%2", Math.floor(days));
};
const friendlyPercentage = function(value) {

View file

@ -127,7 +127,7 @@ window.qBittorrent.ProgressBar = (function() {
this.vals.dark.textContent = displayedValue;
this.vals.light.textContent = displayedValue;
const r = parseInt(this.vals.width * (value / 100));
const r = parseInt((this.vals.width * (value / 100)), 10);
this.vals.dark.setStyle("clip", `rect(0, ${r}px, ${this.vals.height}px, 0)`);
this.vals.light.setStyle("clip", `rect(0, ${this.vals.width}px, ${this.vals.height}px, ${r}px)`);
}

View file

@ -200,8 +200,7 @@ window.qBittorrent.PropFiles = (function() {
const updatePriorityCombo = function(id, selectedPriority) {
const combobox = $("comboPrio" + id);
if (parseInt(combobox.value) !== selectedPriority)
if (parseInt(combobox.value, 10) !== selectedPriority)
selectComboboxPriority(combobox, selectedPriority);
};
@ -209,7 +208,7 @@ window.qBittorrent.PropFiles = (function() {
const options = combobox.options;
for (let i = 0; i < options.length; ++i) {
const option = options[i];
if (parseInt(option.value) === priority)
if (parseInt(option.value, 10) === priority)
option.selected = true;
else
option.selected = false;

View file

@ -38,11 +38,11 @@
const values = {
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
seedingTimeLimit: parseInt(origValues[1]),
inactiveSeedingTimeLimit: parseInt(origValues[2]),
seedingTimeLimit: parseInt(origValues[1], 10),
inactiveSeedingTimeLimit: parseInt(origValues[2], 10),
maxRatio: window.qBittorrent.Misc.friendlyFloat(origValues[3], 2),
maxSeedingTime: parseInt(origValues[4]),
maxInactiveSeedingTime: parseInt(origValues[5])
maxSeedingTime: parseInt(origValues[4], 10),
maxInactiveSeedingTime: parseInt(origValues[5], 10)
};
// select default when orig values not passed. using double equals to compare string and int

View file

@ -582,7 +582,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
rulesList[rule].mustNotContain = $("mustNotContainText").value;
rulesList[rule].episodeFilter = $("episodeFilterText").value;
rulesList[rule].smartFilter = $("useSmartFilter").checked;
rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value);
rulesList[rule].ignoreDays = parseInt($("ignoreDaysValue").value, 10);
rulesList[rule].affectedFeeds = rssDownloaderFeedSelectionTable.rows.filter((row) => row.full_data.checked)
.map((row) => row.full_data.url)
.getValues();