Fix FLEXIAPI-393 Autofill the digits when pasting a code

This commit is contained in:
Timothée Jaussoin 2025-09-30 11:56:33 +02:00
parent b0de4841f6
commit 10cdbb4b6a
2 changed files with 15 additions and 6 deletions

View file

@ -18,6 +18,7 @@ v2.1
- Fix FLEXIAPI-391 Add missing account view attribute in the actions.delete view - Fix FLEXIAPI-391 Add missing account view attribute in the actions.delete view
- Fix FLEXIAPI-392 Fix the recover_by_code view and use the account space object - Fix FLEXIAPI-392 Fix the recover_by_code view and use the account space object
- Fix FLEXIAPI-395 Remove config()->set('app.sip_domain') and directly use the correct domain - Fix FLEXIAPI-395 Remove config()->set('app.sip_domain') and directly use the correct domain
- Fix FLEXIAPI-393 Autofill the digits when pasting a code
v2.0 v2.0
---- ----

View file

@ -43,7 +43,7 @@ var Utils = {
sessionStorage.setObject('list.' + key, list); sessionStorage.setObject('list.' + key, list);
}, },
removeFromStorageList: function(key, id) { removeFromStorageList: function (key, id) {
var list = Utils.getStorageList(key); var list = Utils.getStorageList(key);
list.splice(list.indexOf(id), 1); list.splice(list.indexOf(id), 1);
@ -51,7 +51,7 @@ var Utils = {
sessionStorage.setObject('list.' + key, list); sessionStorage.setObject('list.' + key, list);
}, },
existsInStorageList: function(key, id) { existsInStorageList: function (key, id) {
var list = Utils.getStorageList(key); var list = Utils.getStorageList(key);
return (list && list.includes(id)); return (list && list.includes(id));
}, },
@ -64,7 +64,7 @@ var Utils = {
} }
var ListToggle = { var ListToggle = {
init: function() { init: function () {
document.querySelectorAll('input[type=checkbox].list_toggle').forEach(checkbox => { document.querySelectorAll('input[type=checkbox].list_toggle').forEach(checkbox => {
checkbox.checked = Utils.existsInStorageList(checkbox.dataset.listId, checkbox.dataset.id); checkbox.checked = Utils.existsInStorageList(checkbox.dataset.listId, checkbox.dataset.id);
@ -84,7 +84,7 @@ var ListToggle = {
ListToggle.refreshCounters(); ListToggle.refreshCounters();
}, },
refreshFormList: function() { refreshFormList: function () {
document.querySelectorAll('select.list_toggle').forEach(select => { document.querySelectorAll('select.list_toggle').forEach(select => {
select.innerHTML = ''; select.innerHTML = '';
select.multiple = true; select.multiple = true;
@ -99,20 +99,28 @@ var ListToggle = {
}); });
}, },
refreshCounters: function() { refreshCounters: function () {
document.querySelectorAll('span.list_toggle').forEach(counter => { document.querySelectorAll('span.list_toggle').forEach(counter => {
counter.innerHTML = Utils.getStorageList(counter.dataset.listId).length; counter.innerHTML = Utils.getStorageList(counter.dataset.listId).length;
}); });
} }
} }
document.addEventListener("DOMContentLoaded", function(event) { document.addEventListener("DOMContentLoaded", function (event) {
ListToggle.init(); ListToggle.init();
}); });
function digitFilled(element) { function digitFilled(element) {
if (element.value.length == 1) { if (element.value.length == 1) {
element.nextElementSibling.focus(); element.nextElementSibling.focus();
} else if (element.value.length == 4 && element.previousElementSibling == undefined) {
var spread = new String(element.value);
element.value = spread[0];
element.nextElementSibling.value = spread[1];
element.nextElementSibling.nextElementSibling.value = spread[2];
element.nextElementSibling.nextElementSibling.nextElementSibling.value = spread[3];
} else {
element.value = '';
} }
} }