Browse Source

Merge pull request #11171 from Chocobo1/webui

Conditionally disable port input field
adaptive-webui-19844
Mike Tzou 5 years ago committed by GitHub
parent
commit
18369f6c21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/webui/www/private/views/preferences.html

8
src/webui/www/private/views/preferences.html

@ -249,7 +249,7 @@
<label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="upnp_checkbox">QBT_TR(Use UPnP / NAT-PMP port forwarding from my router)QBT_TR[CONTEXT=OptionsDialog]</label>
</div> </div>
<div class="formRow"> <div class="formRow">
<input type="checkbox" id="random_port_checkbox" /> <input type="checkbox" id="random_port_checkbox" onclick="updatePortValueEnabled();" />
<label for="random_port_checkbox">QBT_TR(Use different port on each startup)QBT_TR[CONTEXT=OptionsDialog]</label> <label for="random_port_checkbox">QBT_TR(Use different port on each startup)QBT_TR[CONTEXT=OptionsDialog]</label>
</div> </div>
</fieldset> </fieldset>
@ -1201,6 +1201,11 @@
}; };
// Connection tab // Connection tab
this.updatePortValueEnabled = function() {
const checked = $('random_port_checkbox').getProperty('checked');
$('port_value').setProperty('disabled', checked);
};
this.updateMaxConnecEnabled = function() { this.updateMaxConnecEnabled = function() {
const isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked'); const isMaxConnecEnabled = $('max_connec_checkbox').getProperty('checked');
$('max_connec_value').setProperty('disabled', !isMaxConnecEnabled); $('max_connec_value').setProperty('disabled', !isMaxConnecEnabled);
@ -1485,6 +1490,7 @@
$('port_value').setProperty('value', pref.listen_port.toInt()); $('port_value').setProperty('value', pref.listen_port.toInt());
$('upnp_checkbox').setProperty('checked', pref.upnp); $('upnp_checkbox').setProperty('checked', pref.upnp);
$('random_port_checkbox').setProperty('checked', pref.random_port); $('random_port_checkbox').setProperty('checked', pref.random_port);
updatePortValueEnabled();
// Connections Limits // Connections Limits
const max_connec = pref.max_connec.toInt(); const max_connec = pref.max_connec.toInt();

Loading…
Cancel
Save