Code cleanup

This commit is contained in:
varjolintu 2024-01-27 09:34:00 +02:00
parent 5a0e211e19
commit b7739344d4

View file

@ -108,16 +108,8 @@ class TOTPFieldIcon extends Icon {
}
}
TOTPFieldIcon.prototype.initField = async function(field, segmented) {
// Observer the visibility
if (this.observer) {
this.observer.observe(field);
}
this.createIcon(field, segmented);
this.inputField = field;
// Fill TOTP automatically if option is enabled
// Fill TOTP automatically if option is enabled
TOTPFieldIcon.prototype.autoFillSingleTotp = async function(field) {
if (kpxc.settings.autoFillSingleTotp) {
if (kpxc.credentials.length === 0) {
await kpxc.receiveCredentialsIfNecessary();
@ -129,6 +121,18 @@ TOTPFieldIcon.prototype.initField = async function(field, segmented) {
}
};
TOTPFieldIcon.prototype.initField = async function(field, segmented) {
// Observer the visibility
if (this.observer) {
this.observer.observe(field);
}
this.createIcon(field, segmented);
this.inputField = field;
await this.autoFillSingleTotp(field);
};
TOTPFieldIcon.prototype.createIcon = function(field, segmented = false) {
const className = (isFirefox() ? 'moz' : 'default');