[WIP] filter btns session storage
This commit is contained in:
parent
25a27b492c
commit
8a6c6fd56d
@ -21,7 +21,7 @@ function initToggle() {
|
|||||||
if(filter) {
|
if(filter) {
|
||||||
let filterMap = new Map(JSON.parse(filter));
|
let filterMap = new Map(JSON.parse(filter));
|
||||||
for (let entry of filterMap.entries()) {
|
for (let entry of filterMap.entries()) {
|
||||||
if(entry[0] === btn.dataset.action) {
|
if(entry[0] === btn.dataset.action && entry[1] !== 'true') {
|
||||||
filterMap.set(entry[0],'true');
|
filterMap.set(entry[0],'true');
|
||||||
} else {
|
} else {
|
||||||
filterMap.set(entry[0],'false');
|
filterMap.set(entry[0],'false');
|
||||||
@ -30,12 +30,13 @@ function initToggle() {
|
|||||||
sessionStorage.setItem('tripsFilter', JSON.stringify( Array.from(filterMap.entries())));
|
sessionStorage.setItem('tripsFilter', JSON.stringify( Array.from(filterMap.entries())));
|
||||||
}
|
}
|
||||||
resetFilteredElements();
|
resetFilteredElements();
|
||||||
console.log(btn.ariaPressed);
|
|
||||||
if(btn.ariaPressed === 'false'){
|
if(btn.ariaPressed === 'false'){
|
||||||
Array.prototype.forEach.call(btns, (b: HTMLButtonElement) => {
|
Array.prototype.forEach.call(btns, (b: HTMLButtonElement) => {
|
||||||
b.setAttribute('aria-pressed', 'false');
|
b.setAttribute('aria-pressed', 'false');
|
||||||
});
|
});
|
||||||
triggerFilterAction(btn.dataset.action);
|
triggerFilterAction(btn.dataset.action);
|
||||||
|
} else {
|
||||||
|
btn.setAttribute('aria-pressed', 'false');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user