Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ <h1 id="header"><img class="tokipona" src="assets/tokipona.svg"></img>sike pona

<!-- </div> -->

<p>sina ken tawa jan wan <a href="#nasa" id=nasa>tan nasa</a>.
<p>sina wile kama la o lukin e <a href="nasin-kama.html">nasin kama</a> :)</p>


Expand Down
15 changes: 15 additions & 0 deletions script.js
Original file line number Diff line number Diff line change
@@ -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() })
}
})