Debugging 2
This commit is contained in:
+16
-15
@@ -1,27 +1,28 @@
|
||||
function initPaginator() {
|
||||
|
||||
function initSorter() {
|
||||
const form = document.getElementById('search-form-id');
|
||||
const pageInput = document.getElementById('s-res-page-input');
|
||||
const pageButtons = document.querySelectorAll('.s-res-page-navigation .s-res-page-btn');
|
||||
const sortRadios = document.querySelectorAll('.sort-radio');
|
||||
|
||||
pageButtons.forEach(button => {
|
||||
button.addEventListener('click', function() {
|
||||
if (this.disabled) return;
|
||||
console.log("Sorter geladen. Formular gefunden:", !!form, "Radios gefunden:", sortRadios.length);
|
||||
|
||||
const targetPage = this.getAttribute('data-page');
|
||||
if (!form) return;
|
||||
|
||||
if (targetPage && form && pageInput) {
|
||||
pageInput.value = targetPage;
|
||||
form.submit();
|
||||
sortRadios.forEach(radio => {
|
||||
radio.addEventListener('change', function() {
|
||||
console.log("Sortierung geändert auf:", this.value);
|
||||
|
||||
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') {
|
||||
// Falls noch geladen wird, auf das Event warten
|
||||
document.addEventListener('DOMContentLoaded', initPaginator);
|
||||
document.addEventListener('DOMContentLoaded', initSorter);
|
||||
} else {
|
||||
// Falls das HTML bereits komplett da ist, sofort ausführen
|
||||
initPaginator();
|
||||
initSorter();
|
||||
}
|
||||
Reference in New Issue
Block a user