21 lines
529 B
JavaScript
21 lines
529 B
JavaScript
export const b = {}
|
|
|
|
export function addCollection(ev, sender, el) {
|
|
const parser = new DOMParser();
|
|
const e = parser.parseFromString(b.templates.collectionItem, 'text/html').body.firstElementChild;
|
|
el.appendChild(e);
|
|
}
|
|
|
|
export function deleteCollection(ev, sender, el) {
|
|
if (!el.contains(sender)) return;
|
|
b.send({ 'id': el.prop('id') }, 'countDeletedCollection');
|
|
el.remove();
|
|
}
|
|
|
|
export function countDeletedCollection(payload, _, el) {
|
|
if (payload.id === 'new') {
|
|
return;
|
|
}
|
|
el.value += `${payload.id};`
|
|
}
|