+
+
-
-
-
-
-
@@ -338,13 +307,6 @@ const totalPages = Math.ceil(allMods.length / defaultLimit)
}
})
}
-
- document.addEventListener('limit-changed', e => {
- if (e instanceof CustomEvent) {
- const newLimit = e.detail.value
- this.setState({ limit: newLimit, page: 1 })
- }
- })
}
setState(newState) {
// Prevent multiple renders
@@ -712,60 +674,4 @@ const totalPages = Math.ceil(allMods.length / defaultLimit)
// Initialize the mods search
new ModsSearch()
-
- class CustomDropdown {
- constructor() {
- this.button = document.getElementById('limit-button')
- this.dropdown = document.getElementById('limit-dropdown')
- this.valueSpan = document.getElementById('limit-value')
-
- if (!this.button || !this.dropdown || !this.valueSpan) return
-
- this.button.addEventListener('click', () => this.toggle())
- this.dropdown.addEventListener('click', e => this.handleOptionClick(e))
-
- // Close dropdown when clicking outside
- document.addEventListener('click', e => {
- if (!this.button?.contains(e.target) && !this.dropdown?.contains(e.target)) {
- this.close()
- }
- })
- }
-
- toggle() {
- const isExpanded = this.button?.getAttribute('aria-expanded') === 'true'
- if (isExpanded) {
- this.close()
- } else {
- this.open()
- }
- }
-
- open() {
- this.button?.setAttribute('aria-expanded', 'true')
- this.dropdown?.classList.remove('hidden')
- }
-
- close() {
- this.button?.setAttribute('aria-expanded', 'false')
- this.dropdown?.classList.add('hidden')
- }
-
- handleOptionClick(e) {
- const target = e.target
- if (target instanceof HTMLButtonElement && target.dataset.value) {
- const value = target.dataset.value
- if (this.valueSpan) {
- this.valueSpan.textContent = value
- }
- // Trigger change event for ModsSearch
- const event = new CustomEvent('limit-changed', { detail: { value: parseInt(value, 10) } })
- document.dispatchEvent(event)
- this.close()
- }
- }
- }
-
- // Initialize the custom dropdown
- new CustomDropdown()