1class SimpleEventsLegacy { 2 constructor() { 3 this.init(); 4 } 5 6 async init() { 7 this.name = "SimpleEventsLegacy"; 8 this.mainElement = window.document.querySelector(".simple-events"); 9 10 let typeListSelect = this.mainElement.get(".simpleeventslegacy-type-select"); 11 this.typeBtn = typeListSelect.get("button"); 12 this.typeBtn.on("click", this.animateDropdown.bind(this)); 13 //this.initTypeSelect(); 14 let typeListUL = typeListSelect.get("ul"); 15 typeListUL.getAll("li").forEach(li => { 16 li.on("click", this.typeSelectClick.bind(this)); 17 }); 18 console.log(`${this.name} initialized.`); 19 } 20 21 // Delegiert an die zentrale Implementierung in core/UA.js (inert-/Tastatur-Unterstützung). 22 // Siehe tasks/plan-animated-dropdown.md (Phase 3). 23 collapseAllDropdowns(event){ 24 return uaCollapseAllDropdowns(event); 25 } 26 27 animateDropdown(event){ 28 return uaAnimateDropdown(event); 29 } 30 31 async typeSelectClick(event) { 32 //this.getPreloader(); 33 this.collapseAllDropdowns(); 34 // Handle topic click event 35 console.log("Type selected:", event.target); 36 // .us-select selbst ist nicht fokussierbar (kein tabindex) - Fokus muss auf den 37 // Trigger-Button zurück, wie es auch die zentrale Escape-Logik in core/UA.js macht. 38 this.typeBtn?.focus(); 39 // Remove 'selected' class from all list items 40 let target = event.target.closest("li"); 41 console.log("Target:", target); 42 if (!target) { 43 console.warn("No target found for type selection."); 44 return; 45 } 46 let typeListSelect = this.mainElement.get(".simpleeventslegacy-type-select"); 47 let typeListUL = typeListSelect.get("ul"); 48 typeListUL.getAll("li").forEach(li => { 49 if(li !== target) { 50 li.classList.remove("selected"); 51 li.setAttribute("aria-selected", "false"); 52 }else{ 53 li.classList.add("selected"); 54 li.setAttribute("aria-selected", "true"); 55 this.typeBtn.get("span").textContent = (li.textContent); // Update the button text to match the selected type 56 } 57 }); 58 let type = target.dataset.option; 59 console.log("Type selected:", type); 60 // Update the event list based on the selected type 61 if (type) { 62 let eventList = this.mainElement.get(".eventslist"); 63 let eventItems = eventList.getAll("a.item"); 64 eventItems.forEach(item => { 65 if (item.dataset.type === type || type === "all" || type === "") { 66 item.classList.remove("hide"); 67 } else { 68 item.classList.add("hide"); 69 } 70 }); 71 } 72 73 } 74 75} 76 77uaReadyInteractive(() => { 78 const SimpleEventsLegacyClass = new SimpleEventsLegacy(); 79});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.