moved reconfiguration of dropdown display directly to the onchange function of the dropdown box as the code is not used elsewhere

This commit is contained in:
Daniel Steglich 2015-03-10 00:31:30 +01:00
parent dfe35c9c97
commit 66a4083891

View File

@ -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();