Pairables list in progress

This commit is contained in:
Claude Brisson
2023-12-21 10:37:16 +01:00
parent fdcdd9c1a9
commit ea9e298330
11 changed files with 166 additions and 36 deletions

View File

@@ -1,2 +1,23 @@
let focused = undefined;
onLoad(()=>{
$('.listitem').on('click', e => {
if (e.shiftKey && typeof(focused) !== 'undefined') {
let from = focused.index('.listitem');
let to = e.target.closest('.listitem').index('.listitem');
if (from > to) {
let tmp = from;
from = to;
to = tmp;
}
let parent = e.target.closest('.multi-select');
let children = parent.childNodes.filter('.listitem');
for (let j = from; j <= to; ++j) {
children.item(j).addClass('selected');
children.item(j).attr('draggable', true);
}
} else {
focused = e.target.closest('.listitem').toggleClass('selected').attr('draggable', true);
}
});
});