WebUI: inline redundant function

This also fix share ratio dialog which had been broken in recent cleanup.

PR #22252.
This commit is contained in:
Chocobo1 2025-02-09 16:03:01 +08:00 committed by GitHub
commit b052ad0923
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 9 deletions

View file

@ -37,7 +37,6 @@ window.qBittorrent.Misc ??= (() => {
friendlyUnit: friendlyUnit,
friendlyDuration: friendlyDuration,
friendlyPercentage: friendlyPercentage,
friendlyFloat: friendlyFloat,
parseHtmlLinks: parseHtmlLinks,
parseVersion: parseVersion,
escapeHtml: escapeHtml,
@ -172,10 +171,6 @@ window.qBittorrent.Misc ??= (() => {
return `${percentage.toFixed(1)}%`;
};
const friendlyFloat = (value, precision) => {
return parseFloat(value).toFixed(precision);
};
/*
* JS counterpart of the function in src/misc.cpp
*/

View file

@ -9,7 +9,6 @@
<script src="scripts/lib/MooTools-More-1.6.0-compat-compressed.js"></script>
<script src="scripts/localpreferences.js?v=${CACHEID}"></script>
<script src="scripts/color-scheme.js?v=${CACHEID}"></script>
<script src="scripts/misc.js?locale=${LANG}&v=${CACHEID}"></script>
<script>
"use strict";
@ -34,10 +33,10 @@
const origValues = searchParams.get("orig").split("|");
const values = {
ratioLimit: window.qBittorrent.Misc.friendlyFloat(origValues[0], 2),
ratioLimit: Number(origValues[0]),
seedingTimeLimit: Number(origValues[1]),
inactiveSeedingTimeLimit: Number(origValues[2]),
maxRatio: window.qBittorrent.Misc.friendlyFloat(origValues[3], 2),
maxRatio: Number(origValues[3]),
maxSeedingTime: Number(origValues[4]),
maxInactiveSeedingTime: Number(origValues[5])
};
@ -58,7 +57,7 @@
setSelectedRadioValue("shareLimit", "custom");
if (values.ratioLimit >= 0) {
$("setRatio").checked = true;
$("ratio").value = values.ratioLimit;
$("ratio").value = values.ratioLimit.toFixed(2);
}
if (values.seedingTimeLimit >= 0) {
$("setTotalMinutes").checked = true;