Add "Show passphrase"

This commit is contained in:
Visman 2023-07-17 00:20:52 +07:00
parent 6af7284349
commit 9b3221f2f9
2 changed files with 66 additions and 1 deletions

View file

@ -1,3 +1,10 @@
/**
* This file is part of the ForkBB <https://github.com/forkbb>.
*
* @copyright (c) Visman <mio.visman@yandex.ru, https://github.com/MioVisman>
* @license The MIT License (MIT)
*/
if (typeof ForkBB === "undefined" || !ForkBB) {
var ForkBB = {};
}
@ -36,10 +43,39 @@ ForkBB.common = (function (doc, win) {
}
}
function initShowPAss()
{
var inps = doc.querySelectorAll("input[type='password']");
for (var i = 0; i < inps.length; i++) {
var span = doc.createElement("span");
span.classList.add('f-pass-ctrl');
span.addEventListener('click', (function(i, s){
return function () {
if (i.getAttribute('type') == 'password') {
i.setAttribute('type', 'text');
s.classList.add('f-pass-dspl');
} else {
i.setAttribute('type', 'password');
s.classList.remove('f-pass-dspl');
}
i.focus();
}
})(inps[i], span));
var parent = inps[i].parentNode;
parent.appendChild(span);
parent.classList.add('f-pass-prnt');
}
}
return {
init : function () {
initGoBack();
initAnchorHL();
initShowPAss();
},
};
}(document, window));

View file

@ -837,6 +837,30 @@ body,
max-height: 10rem;
}
#fork .f-pass-prnt {
position: relative;
}
#fork .f-pass-prnt .f-ctrl {
padding-inline-end: 2rem;
}
#fork .f-pass-ctrl::before {
position: absolute;
display: block;
font-family: "fa";
font-weight: 900;
content: "\f06e";
padding: 0.5rem;
top: 0;
inset-inline-end: 0;
cursor: pointer;
}
#fork .f-pass-dspl::before {
content: "\f070";
}
/**************/
/* Объявление */
/**************/
@ -1141,7 +1165,7 @@ body,
position: relative;
}
#fork #id-dl-passinlogin .f-yhint {
#id-dl-passinlogin .f-yhint {
position: absolute;
top: 0.5rem;
inset-inline-end: 0.3125rem;
@ -1149,6 +1173,11 @@ body,
margin: 0;
}
#id-dl-passinlogin .f-pass-prnt .f-yhint { /* для просмотра пароля */
top: -1.3125rem;
inset-inline-end: 0;
}
/***************************************/
/* Таблица разделов, подразделов и тем */
/***************************************/