LIMITED QUANTITIES
(function () {
if (window.__pwConsole) { console.log('already running'); return; }
window.__pwConsole = true;
var label = null, box = null, text = null, timer = null;
function field() {
return document.querySelector('input[name="password"]');
}
function hide() {
clearTimeout(timer);
var f = field();
if (f) f.type = 'password';
if (box) box.checked = false;
if (text) text.textContent = 'Show password';
}
function build() {
label = document.createElement('label');
label.style.cssText = 'display:block;margin:8px 0;font-size:16px;cursor:pointer;background:#ff0;padding:6px;';
box = document.createElement('input');
box.type = 'checkbox';
box.style.cssText = 'width:20px;height:20px;vertical-align:middle;margin-right:8px;';
text = document.createElement('span');
text.textContent = 'Show password';
label.appendChild(box);
label.appendChild(text);
box.addEventListener('change', function () {
var f = field();
if (!f) return;
if (box.checked) {
f.type = 'text';
text.textContent = 'Hide password';
clearTimeout(timer);
timer = setTimeout(hide, 30000);
} else {
hide();
}
});
}
function tick() {
var f = field();
if (!f) return;
var r = f.getBoundingClientRect();
if (!r.width || !r.height) return;
var anchor = f.parentElement && f.parentElement.parentElement;
if (!anchor) return;
if (!label) build();
if (!document.documentElement.contains(label) || label.previousElementSibling !== anchor) {
anchor.insertAdjacentElement('afterend', label);
}
}
document.addEventListener('submit', hide, true);
setInterval(tick, 300);
tick();
console.log('running: look for the yellow bar under the Password field');
})();