From 66a4083891a1de196538ef4b12bcc38c3ee79d2a Mon Sep 17 00:00:00 2001 From: Daniel Steglich Date: Tue, 10 Mar 2015 00:31:30 +0100 Subject: [PATCH] moved reconfiguration of dropdown display directly to the onchange function of the dropdown box as the code is not used elsewhere --- .../templates/dynamicdns_configure.html | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/plinth/modules/dynamicdns/templates/dynamicdns_configure.html b/plinth/modules/dynamicdns/templates/dynamicdns_configure.html index d84c64db8..0b08a4d78 100644 --- a/plinth/modules/dynamicdns/templates/dynamicdns_configure.html +++ b/plinth/modules/dynamicdns/templates/dynamicdns_configure.html @@ -78,7 +78,26 @@ }); $('#id_dynamicdns-service_type').change(function() { - configure_dropdown(); + if ($("#id_dynamicdns-service_type option:selected").text() == "GnuDIP") { + set_gnudip_mode() + }else{ + set_update_url_mode(); + if ($("#id_dynamicdns-service_type option:selected").text() == "noip.com") { + $('#id_dynamicdns-dynamicdns_update_url').val(NOIP); + $('#id_dynamicdns-use_http_basic_auth').prop('checked', true); + }else{ + $('#id_dynamicdns-use_http_basic_auth').prop('checked', false); + } + if ($("#id_dynamicdns-service_type option:selected").text() == "selfhost.bz") { + $('#id_dynamicdns-dynamicdns_update_url').val(SELFHOST); + } + if ($("#id_dynamicdns-service_type option:selected").text() == "freedns.afraid.org") { + $('#id_dynamicdns-dynamicdns_update_url').val(FREEDNS); + } + if ($("#id_dynamicdns-service_type option:selected").text() == "other update URL") { + $('#id_dynamicdns-dynamicdns_update_url').val(''); + } + } }); $('#id_dynamicdns-showpw').change(function() { @@ -114,30 +133,6 @@ } } - function configure_dropdown() - { - if ($("#id_dynamicdns-service_type option:selected").text() == "GnuDIP") { - set_gnudip_mode() - }else{ - set_update_url_mode(); - if ($("#id_dynamicdns-service_type option:selected").text() == "noip.com") { - $('#id_dynamicdns-dynamicdns_update_url').val(NOIP); - $('#id_dynamicdns-use_http_basic_auth').prop('checked', true); - }else{ - $('#id_dynamicdns-use_http_basic_auth').prop('checked', false); - } - if ($("#id_dynamicdns-service_type option:selected").text() == "selfhost.bz") { - $('#id_dynamicdns-dynamicdns_update_url').val(SELFHOST); - } - if ($("#id_dynamicdns-service_type option:selected").text() == "freedns.afraid.org") { - $('#id_dynamicdns-dynamicdns_update_url').val(FREEDNS); - } - if ($("#id_dynamicdns-service_type option:selected").text() == "other update URL") { - $('#id_dynamicdns-dynamicdns_update_url').val(''); - } - } - } - function set_gnudip_mode() { $('#id_dynamicdns-dynamicdns_update_url').closest('.form-group').hide();