aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2020-05-25 19:03:42 +0200
committerGravatar GitHub <noreply@github.com> 2020-05-25 19:03:42 +0200
commit0d74cb8a4204cfaf6fd64e57b14b1ae7d23dbb84 (patch)
tree8041696047e0428cd5c46a22514e281c191f0c72
parent4b2698ff5557cd5ab812250841bdb22101ebb324 (diff)
Fix JS show password in install (#2999)
The button for showing the password was not working in the install. Updated JavaScript file to ES6 at the same time.
-rw-r--r--p/scripts/install.js29
1 files changed, 14 insertions, 15 deletions
diff --git a/p/scripts/install.js b/p/scripts/install.js
index ccf3b6bb0..ca1a2d7af 100644
--- a/p/scripts/install.js
+++ b/p/scripts/install.js
@@ -1,31 +1,31 @@
// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0
"use strict";
-/* jshint globalstrict: true */
+/* jshint esversion:6, strict:global */
function show_password(ev) {
- var button = ev.target;
- var passwordField = document.getElementById(button.getAttribute('data-toggle'));
+ const button = ev.currentTarget;
+ const passwordField = document.getElementById(button.getAttribute('data-toggle'));
passwordField.setAttribute('type', 'text');
button.className += ' active';
return false;
}
function hide_password(ev) {
- var button = ev.target;
- var passwordField = document.getElementById(button.getAttribute('data-toggle'));
+ const button = ev.currentTarget;
+ const passwordField = document.getElementById(button.getAttribute('data-toggle'));
passwordField.setAttribute('type', 'password');
button.className = button.className.replace(/(?:^|\s)active(?!\S)/g , '');
return false;
}
-var toggles = document.getElementsByClassName('toggle-password');
-for (var i = 0 ; i < toggles.length ; i++) {
+const toggles = document.getElementsByClassName('toggle-password');
+for (let i = 0 ; i < toggles.length ; i++) {
toggles[i].addEventListener('mousedown', show_password);
toggles[i].addEventListener('mouseup', hide_password);
}
+const auth_type = document.getElementById('auth_type');
function auth_type_change() {
- var auth_type = document.getElementById('auth_type');
if (auth_type) {
- var auth_value = auth_type.value,
+ const auth_value = auth_type.value,
password_input = document.getElementById('passwordPlain');
if (auth_value === 'form') {
@@ -35,14 +35,13 @@ function auth_type_change() {
}
}
}
-var auth_type = document.getElementById('auth_type');
if (auth_type) {
auth_type_change();
auth_type.addEventListener('change', auth_type_change);
}
function mySqlShowHide() {
- var mysql = document.getElementById('mysql');
+ const mysql = document.getElementById('mysql');
if (mysql) {
if (document.getElementById('type').value === 'sqlite') {
document.getElementById('host').value = '';
@@ -56,20 +55,20 @@ function mySqlShowHide() {
}
}
}
-var bd_type = document.getElementById('type');
+const bd_type = document.getElementById('type');
if (bd_type) {
mySqlShowHide();
bd_type.addEventListener('change', mySqlShowHide);
}
function ask_confirmation(ev) {
- var str_confirmation = ev.target.getAttribute('data-str-confirm');
+ const str_confirmation = ev.target.getAttribute('data-str-confirm');
if (!confirm(str_confirmation)) {
ev.preventDefault();
}
}
-var confirms = document.getElementsByClassName('confirm');
-for (var i = 0 ; i < confirms.length ; i++) {
+const confirms = document.getElementsByClassName('confirm');
+for (let i = 0 ; i < confirms.length ; i++) {
confirms[i].addEventListener('click', ask_confirmation);
}
// @license-end