diff --git a/index_template.html b/index_template.html index 3b02f08..4431708 100644 --- a/index_template.html +++ b/index_template.html @@ -25,6 +25,7 @@

sike pona +

sina ken tawa jan wan tan nasa.

sina wile kama la o lukin e nasin kama :)

diff --git a/script.js b/script.js index e69de29..9b640f4 100644 --- a/script.js +++ b/script.js @@ -0,0 +1,15 @@ +document.addEventListener('DOMContentLoaded', function () { + const nasaLink = document.getElementById('nasa') + const links = document.querySelectorAll('#peoplelist a') + if (!nasaLink || !links.length) + return + const randomUrl = function () { return links[Math.floor(Math.random() * links.length)].href } + const redirectIfHash = function () { if (location.hash == '#nasa') { location.hash = '', location.href = randomUrl() }} + + redirectIfHash() + if (navigation) { + navigation.addEventListener('navigatesuccess', redirectIfHash) + } else { + nasaLink.addEventListener('click', function () { location.href = randomUrl() }) + } +}) \ No newline at end of file