Compare commits

..

2 Commits

Author SHA1 Message Date
b2fd52e4a5 Merge pull request 'also remove js function for (unnecessary) filtering of months' (#211) from staging into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 7m44s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 3m25s
Reviewed-on: #211
2024-02-16 10:48:05 +01:00
fe2ca0f33a also remove js function for (unnecessary) filtering of months
All checks were successful
CI/CD Pipeline / test (push) Successful in 8m4s
CI/CD Pipeline / deploy-staging (push) Successful in 3m30s
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-02-16 10:47:28 +01:00

View File

@ -461,10 +461,6 @@ function filterAction(activeFilter: string) {
filterCoxs();
break;
}
case 'filter-months': {
filterMonths(activeFilter)
break;
}
}
}
@ -482,28 +478,6 @@ 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');