/* AFR Arcade: paste into PodPage "Custom Javascript Code". Builds the arcade inside
. */ (function(){ var MARKUP=`
Take a Time Out. Play a game. Reset. Find help.
Fun games with real value from Absolutely Focused Radio, plus help for cravings, stress, discouragement, and tough moments at home. Free. No sign-up. Nothing is saved.
Play now Get helpWhat do you need right now?
Play
Reset Room
Two minutes. Pick what fits right now.
Breathe: 60 secondsTry this first
Four rounds. In for 4, hold for 4, out for 6.
Ready when you are.
Ground: 5-4-3-2-1Try this first
Look around and check each one off.
Pause before you crash out: 10 minutesTry this first
Don't send it. Don't decide it. Don't drive angry.
10:00
Pick one while you wait: drink water. Walk outside. Text someone you trust. Write it down and do not send it.
HALT checkTry this first
Which of these is true right now?
Why this works
Triggers are patterns
A trigger is a signal, not a sentence. Once you can name it, you can choose what happens next.
Body first, thoughts second
A longer exhale than inhale helps your body settle. Calm the body and the thoughts get easier to manage.
Delay beats decide
Strong urges and big emotions tend to rise, peak, and fade. Buying yourself ten minutes often changes the decision.
These tools are for everyday stress and tough moments. They are not medical advice or a replacement for professional care.
Get help
Pick what fits. Nobody here will judge you. If you slipped or lost a round, you're still here, and that counts.
I'm in crisis or thinking about hurting myself
You matter. Reach out right now.
- 988 Suicide & Crisis Lifeline: call 988 or text 988, or chat at 988lifeline.org. Free, 24/7 (US).
- Crisis Text Line: text HOME to 741741 (US).
- In immediate danger: call 911.
I'm having a craving, or I slipped
A craving rises, peaks, and passes. A slip is not the end of your story. Reach out the same day.
- SAMHSA National Helpline: 1-800-662-4357 (HELP). Free, confidential, 24/7 support and referrals for substance use and mental health.
- Find a meeting: aa.org or na.org.
- Call or text one safe person right now.
I'm about to crash out
Don't send it. Don't decide it. Don't drive angry. Give yourself ten minutes.
I'm discouraged or overwhelmed
Feeling worn down is human. It's a signal, not a verdict on you.
I don't feel safe at home
Abuse is never your fault. You deserve to be safe.
- National Domestic Violence Hotline: call 1-800-799-7233 (SAFE), text START to 88788, or chat at thehotline.org. Free, confidential, 24/7 (US).
- In immediate danger: call 911.
- If someone might be watching your phone or computer, use a device they can't access. The Quick exit button at the top leaves this page fast, but it can't erase your browser history.
I'm outside the US
- Find a helpline in your country: findahelpline.com.
Numbers and services listed are for the United States unless noted. This page offers education and support tools, not medical advice or a replacement for professional care.
Keep going with AFR
- Podcast and site
- YouTube
- All links
- Newsletter: Firmware Updates for the Mind
- Book: 77 Affirmations for Sobriety: The Architecture Behind the Behavior, by Daniel Nelson.
More Time Out games are coming.
`; function start(){ var R=document.getElementById('afr-arcade');if(!R||R.getAttribute('data-ready'))return;R.setAttribute('data-ready','1'); R.innerHTML=MARKUP; const $=s=>R.querySelector(s),$$=s=>[...R.querySelectorAll(s)],rm=matchMedia('(prefers-reduced-motion: reduce)').matches,sleep=ms=>new Promise(r=>setTimeout(r,ms)); // ===== GAME LIST: to add a game, copy one entry and change title, url, desc, controls, notes. ===== // url = the web address of the game page. Games open inside this page in an iframe. const GAMES=[ {id:'lil-budd',title:'Lil Budd: Focus Sparks',url:'https://afr-lil-budd.divine-king-83f5.workers.dev/', desc:'Run, jump, and collect 10 Focus Sparks. Stomp the triggers: STRESS, CRAVING, and HALT. Every trigger is a pattern you can notice and reframe.', controls:'Click the game once, then use arrow keys to move and space or up arrow to jump. On a phone, use the on-screen buttons (try Full screen).', notes:'
What the triggers mean
- STRESS: Pressure piling up. Reframe it: one small step, not the whole mountain.
- CRAVING: A wave that rises, peaks, and passes. Notice it and ride it out.
- HALT: Hungry, Angry, Lonely, Tired. The four basics that make everything feel harder. Check them first.
'}, {id:'g2',title:'Game 2: Coming soon',soon:true}, {id:'g3',title:'Game 3: Coming soon',soon:true} ]; const playable=GAMES.filter(g=>!g.soon);let cur=null; $('#more').innerHTML=GAMES.filter(g=>g.soon).map(g=>`
${g.title}
`).join(''); const box=$('#game-box'); function pick(g){cur=g; $$('#picker .btn').forEach(b=>b.setAttribute('aria-pressed',b.dataset.id===g.id)); $('#ginfo').innerHTML=`
${g.title}
${g.desc}
Controls: ${g.controls}
`; $('#gnotes').innerHTML=g.notes||''; const ok=g.url&&g.url.indexOf('PASTE_')!==0; $('#gopen').href=ok?g.url:'#';$('#gopen').hidden=!ok; box.innerHTML=ok?``:'
This game is almost ready. Go to the Reset Room below in the meantime.
'; const p=$('#gplay');if(p)p.addEventListener('click',()=>{box.innerHTML='';const f=document.createElement('iframe');f.src=g.url;f.title=g.title;f.allow='fullscreen; autoplay';f.setAttribute('allowfullscreen','');box.appendChild(f);f.focus()})} $('#picker').innerHTML=playable.map(g=>``).join(''); $$('#picker .btn').forEach(b=>b.addEventListener('click',()=>pick(playable.find(g=>g.id===b.dataset.id)))); $('#gfull').addEventListener('click',()=>{const f=box.requestFullscreen||box.webkitRequestFullscreen;if(f)f.call(box)}); // The game page tells this page when the player wins, so the Reset Room opens. addEventListener('message',e=>{const f=box.querySelector('iframe');if(!f||e.source!==f.contentWindow)return;if(e.data&&e.data.type==='afr:game-won')dispatchEvent(new Event('afr:game-won'))}); if(playable.length)pick(playable[0]); function openReset(win){const r=$('#reset');r.hidden=false;if(win)$('#banner').hidden=false;setTimeout(()=>r.scrollIntoView({behavior:rm?'auto':'smooth'}),win?3000:0)} $('#qx').addEventListener('click',()=>location.replace('https://www.google.com')); $$('[data-help]').forEach(b=>b.addEventListener('click',()=>{const d=$('#'+b.dataset.help);d.open=true;d.scrollIntoView({behavior:rm?'auto':'smooth',block:'start'})})); $$('[data-open]').forEach(b=>b.addEventListener('click',()=>openReset(false))); addEventListener('afr:game-won',()=>openReset(true)); const MAP={stressed:'t-breathe',anxious:'t-ground',crash:'t-pause',minute:'t-halt'}; $$('.mood').forEach(b=>b.addEventListener('click',()=>{$$('.mood').forEach(x=>x.setAttribute('aria-pressed',x===b));$$('.tag').forEach(t=>t.hidden=true);const t=$('#'+MAP[b.dataset.m]);t.querySelector('.tag').hidden=false;t.scrollIntoView({behavior:rm?'auto':'smooth',block:'center'})})); // Breathe let run=0; function bReset(msg){const c=$('#circle');c.style.transition='none';c.style.transform='none';$('#btxt').textContent='Ready when you are.';$('#bstart').disabled=false;$('#bmsg').textContent=msg||''} $('#bstart').addEventListener('click',async()=>{const id=++run,c=$('#circle'),t=$('#btxt');$('#bstart').disabled=true;$('#bmsg').textContent=''; for(let r=0;r<4;r++)for(const [l,s,k] of [['Breathe in',4,1.4],['Hold',4,1.4],['Breathe out',6,1]]){ if(id!==run)return; if(!rm&&l!=='Hold'){c.style.transition='transform '+s+'s ease-in-out';c.style.transform='scale('+k+')'} for(let n=s;n>0;n--){t.textContent=l+' '+n;await sleep(1000);if(id!==run)return}} bReset('Done. Notice how your shoulders feel.')}); $('#bstop').addEventListener('click',()=>{run++;bReset('')}); // Ground const GR=['5 things you can see','4 things you can feel','3 things you can hear','2 things you can smell','1 thing you can taste']; $('#glist').innerHTML=GR.map(t=>`
`).join(''); $('#glist').addEventListener('change',()=>{$('#gmsg').textContent=$$('.gc').every(c=>c.checked)?"You're here. You're present.":''}); // Pause let pt=null,left=600;const fmt=s=>String(Math.floor(s/60)).padStart(2,'0')+':'+String(s%60).padStart(2,'0'); function pstop(msg){clearInterval(pt);pt=null;left=600;$('#ptime').textContent=fmt(600);$('#pstart').disabled=false;$('#pmsg').textContent=msg||''} $('#pstart').addEventListener('click',()=>{if(pt)return;$('#pstart').disabled=true;$('#pmsg').textContent='Timer started. You have time.';left=600;pt=setInterval(()=>{left--;$('#ptime').textContent=fmt(left);if(left<=0)pstop('Ten minutes passed. Still want to do it? Choose slowly.')},1000)}); $('#pstop').addEventListener('click',()=>pstop('Stopped early. That counts.')); // HALT const HALT=[['Hungry','Eat something real and drink water.'],['Angry','Name what happened in one sentence. Then step away from it for 10 minutes.'],['Lonely',`Text or call one safe person. "Got a minute?" is enough.`],['Tired','Rest your eyes for 5 minutes, or plan an early night.']]; $('#hlist').innerHTML=HALT.map((h,i)=>`
-
${h[1]}
`).join(''); $('#hlist').addEventListener('change',e=>{$('#h'+e.target.dataset.h).hidden=!e.target.checked}); } if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',start);else start(); })();