diff --git a/src/webui/www/private/views/preferences.html b/src/webui/www/private/views/preferences.html index 5a0689b34..8b2e7c0f9 100644 --- a/src/webui/www/private/views/preferences.html +++ b/src/webui/www/private/views/preferences.html @@ -1738,15 +1738,9 @@ // Share Limiting $('max_ratio_checkbox').setProperty('checked', pref.max_ratio_enabled); - if (pref.max_ratio_enabled) - $('max_ratio_value').setProperty('value', pref.max_ratio); - else - $('max_ratio_value').setProperty('value', 1); + $('max_ratio_value').setProperty('value', (pref.max_ratio_enabled ? pref.max_ratio : 1)); $('max_seeding_time_checkbox').setProperty('checked', pref.max_seeding_time_enabled); - if (pref.max_seeding_time_enabled) - $('max_seeding_time_value').setProperty('value', pref.max_seeding_time.toInt()); - else - $('max_seeding_time_value').setProperty('value', 1440); + $('max_seeding_time_value').setProperty('value', (pref.max_seeding_time_enabled ? pref.max_seeding_time.toInt() : 1440)); let maxRatioAct = 0; switch (pref.max_ratio_act.toInt()) { case 0: // Pause @@ -2108,7 +2102,7 @@ let max_ratio = -1; if ($('max_ratio_checkbox').getProperty('checked')) { max_ratio = $('max_ratio_value').getProperty('value'); - if (isNaN(max_ratio) || max_ratio < 0 || max_ratio > 9998) { + 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; } @@ -2119,7 +2113,7 @@ let max_seeding_time = -1; if ($('max_seeding_time_checkbox').getProperty('checked')) { max_seeding_time = $('max_seeding_time_value').getProperty('value').toInt(); - if (isNaN(max_seeding_time) || max_seeding_time < 0 || max_seeding_time > 525600) { + if (isNaN(max_seeding_time) || (max_seeding_time < 0) || (max_seeding_time > 525600)) { alert("QBT_TR(Seeding time limit must be between 0 and 525600 minutes.)QBT_TR[CONTEXT=HttpServer]"); return; }