Compare commits
No commits in common. "b2fd52e4a540da8bc33de3c066323aae4452fab6" and "14fbfd200ba4f9d3f2e5b92b0efdddd5c7ce62a6" have entirely different histories.
b2fd52e4a5
...
14fbfd200b
@ -461,6 +461,10 @@ function filterAction(activeFilter: string) {
|
||||
filterCoxs();
|
||||
break;
|
||||
}
|
||||
case 'filter-months': {
|
||||
filterMonths(activeFilter)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,6 +482,28 @@ function filterCoxs() {
|
||||
});
|
||||
}
|
||||
|
||||
function filterMonths(action: string) {
|
||||
const months = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
|
||||
const monthToggle = <HTMLButtonElement>document.querySelector('button[data-action="' + action + '"]');
|
||||
if(monthToggle) {
|
||||
const currentMonth = monthToggle.dataset.month;
|
||||
|
||||
if(currentMonth) {
|
||||
const index = months.indexOf(currentMonth);
|
||||
if (index > -1) { // only splice array when item is found
|
||||
months.splice(index, 1); // 2nd parameter means remove one item only
|
||||
}
|
||||
|
||||
Array.prototype.forEach.call(months, (month: HTMLElement) => {
|
||||
const notThisMonth = document.querySelectorAll('div[data-month="' + month + '"]');
|
||||
Array.prototype.forEach.call(notThisMonth, (notThisMonth: HTMLElement) => {
|
||||
notThisMonth.classList.toggle('hidden');
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initSearch() {
|
||||
const input = <HTMLInputElement>document.querySelector('#filter-js');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user