Skip to content

Commit

Permalink
WebUI: inline redundant function
Browse files Browse the repository at this point in the history
This also fix share ratio dialog which had been broken in recent cleanup.

PR qbittorrent#22252.
  • Loading branch information
Chocobo1 authored Feb 9, 2025
1 parent c65a682 commit b052ad0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/webui/www/private/scripts/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ window.qBittorrent.Misc ??= (() => {
friendlyUnit: friendlyUnit,
friendlyDuration: friendlyDuration,
friendlyPercentage: friendlyPercentage,
friendlyFloat: friendlyFloat,
parseHtmlLinks: parseHtmlLinks,
parseVersion: parseVersion,
escapeHtml: escapeHtml,
Expand Down Expand Up @@ -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
*/
Expand Down
7 changes: 3 additions & 4 deletions src/webui/www/private/shareratio.html
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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])
};
Expand All @@ -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;
Expand Down

0 comments on commit b052ad0

Please sign in to comment.