{"id":"4desvP9TaS","url":"https://pastebin.ca/4desvP9TaS","raw_url":"https://raw.anybin.ca/4desvP9TaS","visibility":"public","access":"public","created_at":1790546694676,"expires_at":1791151494676,"fetch_limit":null,"fetches_used":0,"reads_remaining":null,"size_bytes":963,"syntax_hint":"javascript","title":null,"filename":null,"change_note":null,"cipher":null,"cipher_meta":null,"parent_id":null,"root_id":"4desvP9TaS","version":1,"owner_id":null,"recipient_id":null,"body":"(() => main())()\n\nvar game\nvar C\nfunction main() {\n\tgame = document.getElementsByTagName('game')[0]\n\tgame.addEventListener('click', handle_buttons)\n\taddEventListener('hashchange', set_current)\n  set_current()\n}\n\nfunction remove_current() {\n  Array.from(game.getElementsByClassName('current')).forEach(e => e.classList.remove('current'))\n}\n\nfunction goto_tag(tag) {\n  if (tag == null) {return}\n  let P = document.getElementById(tag)\n  if (P) {\n    remove_current()\n    P.classList.add('current')\n    document.location.hash = tag\n  } else {\n    console.log(`Tag ${tag} not found.`)\n  }\n}\n\nfunction set_current(event) {\n\tlet pages = document.getElementsByTagName('page')\n  remove_current()\n\tif (document.location.hash && document.location.hash.slice(1) in pages) {\n\t  pages[document.location.hash.slice(1)].classList.add('current')\n\t} else {\n\t  pages[0].classList.add('current')\n\t}\n}\n\nfunction handle_buttons(event) {\n  goto_tag(event.target.getAttribute('page'))\n}\n"}