Add toggle_password_visibility which is used in options for MQTT password
parent
43b62db186
commit
b37c894ffc
|
@ -103,7 +103,9 @@ window.addEventListener("DOMContentLoaded", function onSkinDCL() {
|
||||||
|
|
||||||
// 'data-on-click-this' calls the global function in the attribute value with the element when a click happens.
|
// 'data-on-click-this' calls the global function in the attribute value with the element when a click happens.
|
||||||
function dataOnClickThis() {
|
function dataOnClickThis() {
|
||||||
document.querySelectorAll("a[data-on-click-this], button[data-on-click-this], input[data-on-click-this]").forEach(function attachOnClick(el) {
|
console.log("Looking for data-on-click-this");
|
||||||
|
document.querySelectorAll("a[data-on-click-this], button[data-on-click-this], input[data-on-click-this], span[data-on-click-this]").forEach(function attachOnClick(el) {
|
||||||
|
console.log(el);
|
||||||
var fnName = el.getAttribute("data-on-click-this");
|
var fnName = el.getAttribute("data-on-click-this");
|
||||||
if ( !window[fnName] ) {
|
if ( !window[fnName] ) {
|
||||||
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
|
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
|
||||||
|
@ -986,3 +988,18 @@ function closeFullscreen() {
|
||||||
document.msExitFullscreen();
|
document.msExitFullscreen();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggle_password_visibility(element) {
|
||||||
|
input = document.getElementById(element.getAttribute('data-password-input'));
|
||||||
|
if (!input) {
|
||||||
|
console.log("Input not found! " + element.getAttribute('data-password-input'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (element.innerHTML=='visibility') {
|
||||||
|
input.type = 'text';
|
||||||
|
element.innerHTML = 'visibility_off';
|
||||||
|
} else {
|
||||||
|
input.type = 'password';
|
||||||
|
element.innerHTML='visibility';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue