-- Reusable Hyperscript behaviours and helper functions for the site. -- Loaded from base.html before the Hyperscript runtime, so every behaviour -- defined here can be applied with _="install Name(...)" on any page. -- See HYPERSCRIPT_CONVENTIONS.md, section 4, before adding to this file. -- Menus -- Closes a
menu when a link inside it is tapped or Escape is pressed. behavior CloseMenu on click if the target matches remove @open from me end end on keydown[key is 'Escape'] from window remove @open from me end end -- Soundscape -- Hides the native audio controls in favour of the designed button, and keeps -- that button's label and level indicator in step with the audio itself. With -- the runtime blocked the native player stays, so the piece is always playable. behavior ToggleSoundscape(player) init default player to the previous