From c775744db5a795cd35664b1ef4f92d75e6430229 Mon Sep 17 00:00:00 2001 From: glaszig Date: Mon, 19 Aug 2019 02:06:09 +0100 Subject: [PATCH] improved password toggle --- js/custom.js | 20 ++++++++++++++++++++ templates/configure_client.php | 11 ----------- templates/wifi_stations.php | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/js/custom.js b/js/custom.js index 958658b2..b938556d 100644 --- a/js/custom.js +++ b/js/custom.js @@ -193,6 +193,26 @@ function loadWifiStations(refresh) { $(".js-reload-wifi-stations").on("click", loadWifiStations(true)); +$(document).on("click", ".js-toggle-password", function(e) { + var button = $(e.target) + var field = $(button.data("target")); + if (field.is(":input")) { + e.preventDefault(); + + if (!button.data("__toggle-with-initial")) { + button.data("__toggle-with-initial", button.text()) + } + + if (field.attr("type") === "password") { + button.text(button.data("toggle-with")); + field.attr("type", "text"); + } else { + button.text(button.data("__toggle-with-initial")); + field.attr("type", "password"); + } + } +}); + $(document) .ajaxSend(setCSRFTokenHeader) .ready(contentLoaded) diff --git a/templates/configure_client.php b/templates/configure_client.php index 5a3a5831..053dc452 100644 --- a/templates/configure_client.php +++ b/templates/configure_client.php @@ -21,14 +21,3 @@ - - diff --git a/templates/wifi_stations.php b/templates/wifi_stations.php index a002b85d..1c2b7542 100644 --- a/templates/wifi_stations.php +++ b/templates/wifi_stations.php @@ -69,7 +69,7 @@ - +