-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
58 lines (49 loc) · 1.62 KB
/
Copy pathscript.js
File metadata and controls
58 lines (49 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
let qrcode = null;
function generateQR() {
const text = document.getElementById("qr-text").value;
const qrcodeContainer = document.getElementById("qrcode");
// Effacer le QR code précédent
qrcodeContainer.innerHTML = "";
// Créer un nouveau QR code
qrcode = new QRCode(qrcodeContainer, {
text: text,
width: 300,
height: 300,
});
}
//---------------------------------------------------------------------
function togglePasswordVisibility(inputId, iconId) {
const passwordInput = document.getElementById(inputId);
const icon = document.getElementById(iconId);
if (passwordInput.type === "password") {
passwordInput.type = "text";
icon.src = "./images/visibility_off.svg";
icon.alt = "Hide password";
} else {
passwordInput.type = "password";
icon.src = "./images/visibility.svg";
icon.alt = "Show password";
}
}
// Event listeners pour les boutons de visibilité du mot de passe
document.addEventListener("DOMContentLoaded", function () {
const passwordToggle = document.querySelector(
".password-container .toggle-password"
);
const confirmPasswordToggle = document.querySelector(
".confirm-password-container .toggle-password"
);
if (passwordToggle) {
passwordToggle.addEventListener("click", function () {
togglePasswordVisibility("password", "password-toggle-icon");
});
}
if (confirmPasswordToggle) {
confirmPasswordToggle.addEventListener("click", function () {
togglePasswordVisibility(
"confirm-password",
"confirm-password-toggle-icon"
);
});
}
});