PageSourceSearch

https://doughboyz.org/js/login-page-listeners.js

js doughboyz.org collected 2026-10-08 19:40:13 UTC 1,657 bytes, 53 lines download raw bytes

1/**
2 * Event handler for show password checkbox on the login page
3 */
4function onShowPasswordCheck() {
5    document.getElementById('show_psw').checked ? psw2text() : text2psw();
6}
7
8/**
9 * Changes the password field input type to text, allowing the user to see the password
10 */
11function psw2text() {
12    let old_input = document.getElementById('psw');
13    let new_input = document.createElement('input');
14    new_input.value = old_input.value;
15    new_input.placeholder = old_input.placeholder;
16    new_input.type = 'text';
17    new_input.name = old_input.name;
18    new_input.style.width = "100%";
19    new_input.id = old_input.id;
20    new_input.required = true;
21    old_input.replaceWith(new_input);
22}
23/**
24 * Changes the password field input type to password, hiding the password characters in the input
25 */
26function text2psw() {
27    let old_input = document.getElementById('psw');
28    let new_input = document.createElement('input');
29    new_input.value = old_input.value;
30    new_input.placeholder = old_input.placeholder;
31    new_input.type = 'password';
32    new_input.name = old_input.name;
33    new_input.style.width = "100%";
34    new_input.id = old_input.id;
35    new_input.required = true;
36    old_input.replaceWith(new_input);
37}
38
39/**
40 * Listener for caps lock
41 */
42document.getElementById('psw').addEventListener("keyup", (event) => {
43   event.getModifierState("CapsLock") ?
44       document.getElementById('psw_caps').style.display = 'block' :
45       document.getElementById('psw_caps').style.display = 'none';
46});
47
48/**
49 * Listener for the enter key
50 */
51window.addEventListener("keypress", (event) => {
52    if(event.key === "Enter") request_login();
53});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.