Ghost v1.3 — Jump added to menu
Browse files
sand.js
CHANGED
|
@@ -4,7 +4,7 @@ const css=`#sandbar{position:fixed;top:8px;right:8px;z-index:99999;display:flex;
|
|
| 4 |
#sandbar button.on{background:#c9a75d;color:#05070d}`;
|
| 5 |
const st=document.createElement('style');st.textContent=css;document.head.appendChild(st);
|
| 6 |
const bar=document.createElement('div');bar.id='sandbar';
|
| 7 |
-
bar.innerHTML=`<a href="/">🌍 Ghost</a><a href="/spidey.html">🕸️ Spidey</a><a href="/bgg.html">📊 Gantt</a><a href="/drop/">👻 Drop</a><button id="sandbtn">▶ SAND</button>`;
|
| 8 |
document.body.appendChild(bar);
|
| 9 |
const btn=document.getElementById('sandbtn');
|
| 10 |
let ctx,master,timer=null,step=0;
|
|
@@ -30,7 +30,6 @@ function play(){if(!ctx){ctx=new (window.AudioContext||window.webkitAudioContext
|
|
| 30 |
ctx.resume();if(!timer)timer=setInterval(tick,S*1000);btn.textContent='❚❚ SAND';btn.classList.add('on');localStorage.sand='on'}
|
| 31 |
function stop(){clearInterval(timer);timer=null;ctx&&ctx.suspend();btn.textContent='▶ SAND';btn.classList.remove('on');localStorage.sand='off'}
|
| 32 |
btn.onclick=e=>{e.stopPropagation();timer?stop():play()};
|
| 33 |
-
// on by default: try right away; if the browser holds it, the first touch/key/scroll anywhere starts it
|
| 34 |
if(localStorage.sand!=='off'){
|
| 35 |
try{play();if(ctx.state!=='running'){clearInterval(timer);timer=null;btn.textContent='▶ SAND';btn.classList.remove('on')}}catch(e){}
|
| 36 |
const unlock=()=>{if(localStorage.sand!=='off'&&!(timer&&ctx&&ctx.state==='running'))play();
|
|
|
|
| 4 |
#sandbar button.on{background:#c9a75d;color:#05070d}`;
|
| 5 |
const st=document.createElement('style');st.textContent=css;document.head.appendChild(st);
|
| 6 |
const bar=document.createElement('div');bar.id='sandbar';
|
| 7 |
+
bar.innerHTML=`<a href="/">🌍 Ghost</a><a href="/spidey.html">🕸️ Spidey</a><a href="/jump/">⬆️ Jump</a><a href="/bgg.html">📊 Gantt</a><a href="/drop/">👻 Drop</a><button id="sandbtn">▶ SAND</button>`;
|
| 8 |
document.body.appendChild(bar);
|
| 9 |
const btn=document.getElementById('sandbtn');
|
| 10 |
let ctx,master,timer=null,step=0;
|
|
|
|
| 30 |
ctx.resume();if(!timer)timer=setInterval(tick,S*1000);btn.textContent='❚❚ SAND';btn.classList.add('on');localStorage.sand='on'}
|
| 31 |
function stop(){clearInterval(timer);timer=null;ctx&&ctx.suspend();btn.textContent='▶ SAND';btn.classList.remove('on');localStorage.sand='off'}
|
| 32 |
btn.onclick=e=>{e.stopPropagation();timer?stop():play()};
|
|
|
|
| 33 |
if(localStorage.sand!=='off'){
|
| 34 |
try{play();if(ctx.state!=='running'){clearInterval(timer);timer=null;btn.textContent='▶ SAND';btn.classList.remove('on')}}catch(e){}
|
| 35 |
const unlock=()=>{if(localStorage.sand!=='off'&&!(timer&&ctx&&ctx.state==='running'))play();
|