Skip to content

Commit

Permalink
WebUI: use native function when converting to numbers
Browse files Browse the repository at this point in the history
PR #22246.
  • Loading branch information
Chocobo1 authored Feb 8, 2025
1 parent 9392504 commit c65a682
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/webui/www/private/scripts/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ window.addEventListener("DOMContentLoaded", () => {
});
let prop_h = LocalPreferences.get("properties_height_rel");
if (prop_h !== null)
prop_h = prop_h.toFloat() * Window.getSize().y;
prop_h = Number(prop_h) * Window.getSize().y;
else
prop_h = Window.getSize().y / 2.0;
new MochaUI.Panel({
Expand Down
8 changes: 4 additions & 4 deletions src/webui/www/private/scripts/dynamicTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -1247,7 +1247,7 @@ window.qBittorrent.DynamicTable ??= (() => {
else {
if (progressColumnWidth < 0)
progressColumnWidth = td.offsetWidth;
td.append(new window.qBittorrent.ProgressBar.ProgressBar(progressFormatted.toFloat(), {
td.append(new window.qBittorrent.ProgressBar.ProgressBar(progressFormatted, {
width: progressColumnWidth - 5
}));
td.resized = false;
Expand Down Expand Up @@ -2598,17 +2598,17 @@ window.qBittorrent.DynamicTable ??= (() => {
// progress
this.columns["progress"].updateTd = function(td, row) {
const id = row.rowId;
const value = this.getRowValue(row);
const value = Number(this.getRowValue(row));

const progressBar = $(`pbf_${id}`);
if (progressBar === null) {
td.append(new window.qBittorrent.ProgressBar.ProgressBar(value.toFloat(), {
td.append(new window.qBittorrent.ProgressBar.ProgressBar(value, {
id: `pbf_${id}`,
width: 80
}));
}
else {
progressBar.setValue(value.toFloat());
progressBar.setValue(value);
}
};
this.columns["progress"].staticWidth = 100;
Expand Down
2 changes: 1 addition & 1 deletion src/webui/www/private/views/preferences.html
Original file line number Diff line number Diff line change
Expand Up @@ -2878,7 +2878,7 @@
// Share Ratio Limiting
let max_ratio = -1;
if ($("max_ratio_checkbox").checked) {
max_ratio = $("max_ratio_value").value.toFloat();
max_ratio = Number($("max_ratio_value").value);
if (isNaN(max_ratio) || (max_ratio < 0) || (max_ratio > 9998)) {
alert("QBT_TR(Share ratio limit must be between 0 and 9998.)QBT_TR[CONTEXT=HttpServer]");
return;
Expand Down

0 comments on commit c65a682

Please sign in to comment.