refactor: use idiomatic hyperscript selector syntax
Replace verbose document.getElementById() and document.querySelectorAll()
with cleaner hyperscript syntax:
- #id for ID selectors
- .class and the first .class for class selectors
- <selector/> query literals for complex selectors
- #{variable} for dynamic ID interpolation
Files changed:
- utils._hs: scrollHeight, details, footer buttons, scrollToSection
- zoom._hs: all zoom control element selectors (14 changes)
- pdf-modal._hs: modal selector
- keyboard._hs: dynamic toggle and modal selectors
- contact-modal.html: response div and modal close
- index.html: ninja-keys bar selector
This commit is contained in:
@@ -8,9 +8,9 @@
|
||||
-- Helper function to toggle a checkbox by ID (tries primary ID, then menu ID)
|
||||
-- Called from inline keyboard handler in body tag
|
||||
def handleToggleShortcut(toggleId, menuToggleId)
|
||||
set toggle to document.getElementById(toggleId)
|
||||
set toggle to #{toggleId}
|
||||
if toggle is null
|
||||
set toggle to document.getElementById(menuToggleId)
|
||||
set toggle to #{menuToggleId}
|
||||
end
|
||||
if toggle is not null
|
||||
set toggle.checked to (not toggle.checked)
|
||||
@@ -23,7 +23,7 @@ end
|
||||
-- ==============================================================================
|
||||
-- Helper function to open a modal dialog by ID
|
||||
def openModalShortcut(modalId)
|
||||
set modal to document.getElementById(modalId)
|
||||
set modal to #{modalId}
|
||||
if modal is not null
|
||||
call modal.showModal()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user