26 lines
675 B
JavaScript
26 lines
675 B
JavaScript
|
|
function initSorter() {
|
|
const form = document.getElementById('search-form-id');
|
|
const sortRadios = document.querySelectorAll('.sort-radio');
|
|
|
|
if (!form) return;
|
|
|
|
sortRadios.forEach(radio => {
|
|
radio.addEventListener('change', function() {
|
|
|
|
const pageInput = document.getElementById('s-res-page-input');
|
|
if (pageInput) {
|
|
pageInput.value = '1';
|
|
}
|
|
|
|
form.submit();
|
|
});
|
|
});
|
|
}
|
|
|
|
// ist das DOM bereits vollständig aufgebaut?
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', initSorter);
|
|
} else {
|
|
initSorter();
|
|
} |