|
78 | 78 | } |
79 | 79 | } |
80 | 80 | const show_all_clients_button_container = document.getElementById('show-all-clients-button-container'); |
81 | | - show_all_clients_button_container.querySelector('.platform-name').innerHTML = platform_friendly; |
82 | | - show_all_clients_button_container.classList.remove("d-none"); |
83 | | - document.getElementById('show-all-clients-button').addEventListener('click', function (e) { |
84 | | - for (let card of client_cards) |
85 | | - card.hidden = false; |
86 | | - show_all_clients_button_container.hidden = true; |
87 | | - e.preventDefault(); |
88 | | - }); |
| 81 | + if (show_all_clients_button_container) { |
| 82 | + show_all_clients_button_container.querySelector('.platform-name').innerHTML = platform_friendly; |
| 83 | + show_all_clients_button_container.classList.remove("d-none"); |
| 84 | + document.getElementById('show-all-clients-button').addEventListener('click', function (e) { |
| 85 | + for (let card of client_cards) |
| 86 | + card.hidden = false; |
| 87 | + show_all_clients_button_container.hidden = true; |
| 88 | + e.preventDefault(); |
| 89 | + }); |
| 90 | + } |
89 | 91 | } |
90 | 92 | } |
| 93 | + const toggle_pw_button = document.getElementById('toggle-pw-button'); |
| 94 | + if (toggle_pw_button) |
| 95 | + toggle_pw_button.addEventListener('click', toggle_password); |
| 96 | + |
| 97 | +})(); |
| 98 | + |
| 99 | +function toggle_password(e) { |
| 100 | + var button = e.target; |
| 101 | + var input = button.parentNode.parentNode.querySelector("input"); |
| 102 | + switch(input.attributes.type.value) { |
| 103 | + case "password": |
| 104 | + input.attributes.type.value = "text"; |
| 105 | + button.innerText = button.getAttribute('data-text-hide'); |
| 106 | + break; |
| 107 | + case "text": |
| 108 | + input.attributes.type.value = "password"; |
| 109 | + button.innerText = button.getAttribute('data-text-show'); |
| 110 | + break; |
| 111 | + } |
| 112 | +} |
| 113 | + |
| 114 | +(function() { |
| 115 | + 'use strict'; |
| 116 | + window.addEventListener('load', function() { |
| 117 | + // Fetch all the forms we want to apply custom Bootstrap validation styles to |
| 118 | + var forms = document.getElementsByClassName('needs-validation'); |
| 119 | + // Loop over them and prevent submission |
| 120 | + var validation = Array.prototype.filter.call(forms, function(form) { |
| 121 | + form.addEventListener('submit', function(event) { |
| 122 | + if (form.checkValidity() === false) { |
| 123 | + event.preventDefault(); |
| 124 | + event.stopPropagation(); |
| 125 | + } |
| 126 | + form.classList.add('was-validated'); |
| 127 | + }, false); |
| 128 | + }); |
| 129 | + }, false); |
91 | 130 | })(); |
0 commit comments