rendered paste body(() => main())()var gamevar Cfunction main() { game = document.getElementsByTagName('game')[0] game.addEventListener('click', handle_buttons) addEventListener('hashchange', set_current) set_current()}function remove_current() { Array.from(game.getElementsByClassName('current')).forEach(e => e.classList.remove('current'))}function goto_tag(tag) { if (tag == null) {return} let P = document.getElementById(tag) if (P) { remove_current() P.classList.add('current') document.location.hash = tag } else { console.log(`Tag ${tag} not found.`) }}function set_current(event) { let pages = document.getElementsByTagName('page') remove_current() if (document.location.hash && document.location.hash.slice(1) in pages) { pages[document.location.hash.slice(1)].classList.add('current') } else { pages[0].classList.add('current') }}function handle_buttons(event) { goto_tag(event.target.getAttribute('page'))}