summaryrefslogtreecommitdiff
path: root/docs/js/site.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/js/site.js')
-rw-r--r--docs/js/site.js24
1 files changed, 15 insertions, 9 deletions
diff --git a/docs/js/site.js b/docs/js/site.js
index 59d09f9..df9d657 100644
--- a/docs/js/site.js
+++ b/docs/js/site.js
@@ -8,6 +8,7 @@ const site = (function(){
} else {
document.body.parentNode.classList.add('day')
}
+ preload('img/pause-inv.png')
setTimeout(() => {
document.body.classList.remove('loading')
navigateHash(window.location.hash)
@@ -18,8 +19,18 @@ const site = (function(){
document.querySelector("#twitter_addr").innerHTML = twitter
document.querySelector("#twitter_addr").href = 'https://twitter.com/' + twitter
}, 0)
+ toArray(document.querySelectorAll('.menu a')).forEach(a => {
+ a.addEventListener("click", e => {
+ e.preventDefault()
+ sounds.play('click')
+ navigateHash(e.target.href)
+ })
+ })
function navigateHash(url){
- let new_section = url.split('#')[1]
+ if (is_mobile) {
+ player.hidePlaylist()
+ }
+ let new_section = (url || "").split('#')[1]
if (section) {
document.body.classList.remove(section)
links.forEach(link => link.classList.remove('active'))
@@ -33,16 +44,11 @@ const site = (function(){
}
// window.location.hash = section || ""
}
- toArray(document.querySelectorAll('.menu a')).forEach(a => {
- a.addEventListener("click", e => {
- e.preventDefault()
- sounds.play('click')
- navigateHash(e.target.href)
- })
- })
function preload(src) {
const img = new Image
img.src = src
}
- preload('img/pause-inv.png')
+ return {
+ navigateHash: navigateHash
+ }
})()