Fix password fill

This commit is contained in:
varjolintu 2019-07-09 13:26:32 +03:00
parent 0399c63f69
commit 9785b20d82
2 changed files with 4 additions and 11 deletions

View file

@ -88,12 +88,12 @@ browser.runtime.onMessage.addListener(function(req, sender) {
});
function _f(fieldId) {
const inputs = document.querySelectorAll('input[data-kpxc-id=\'' + fieldId + '\']');
const inputs = document.querySelectorAll(`input[data-kpxc-id='${fieldId}']`);
return inputs.length > 0 ? inputs[0] : null;
}
function _fs(fieldId) {
const inputs = document.querySelectorAll('input[data-kpxc-id=\'' + fieldId + '\'], select[data-kpxc-id=\'' + fieldId + '\']');
const inputs = document.querySelectorAll(`input[data-kpxc-id='${fieldId}'], select[data-kpxc-id='${fieldId}']`);
return inputs.length > 0 ? inputs[0] : null;
}

View file

@ -267,15 +267,8 @@ kpxcPassword.copy = function(e) {
kpxcPassword.fill = function(e) {
e.preventDefault();
let field = null;
const inputs = document.querySelectorAll('input[type=\'password\']');
for (const i of inputs) {
if (i.getAttribute('data-kpxc-id')) {
field = i;
break;
}
}
// Use the active input field
const field = _f(kpxcPassword.dialog.getAttribute('kpxc-pwgen-field-id'));
if (field) {
const password = $('.kpxc-pwgen-input');
if (field.getAttribute('maxlength')) {