Edisoneh commited on
Commit
9c4e2e9
·
verified ·
1 Parent(s): 84de192

Refresh White Room viewer asset

Browse files
Files changed (1) hide show
  1. frontend/app.js +1 -1
frontend/app.js CHANGED
@@ -223,5 +223,5 @@ $('reconstruct').onclick=()=>task(async()=>{
223
  $('load-viewer').onclick=()=>{if(viewerURL)viewer(viewerURL,$('scene-title').textContent);};
224
  $('reset').onclick=()=>{if(viewerURL)viewer(viewerURL,$('scene-title').textContent);};$('fullscreen').onclick=async()=>{try{if(document.fullscreenElement)await document.exitFullscreen();else {if(!$('frame-host').firstChild&&viewerURL)viewer(viewerURL,$('scene-title').textContent);await $('viewport').requestFullscreen();}}catch{toast('Fullscreen unavailable. Use ↗ to open the viewer.');}};
225
  $('theme').onclick=()=>{const light=document.documentElement.dataset.theme!=='light';document.documentElement.dataset.theme=light?'light':'dark';$('theme').setAttribute('aria-label',light?'Switch to dark theme':'Switch to light theme');};
226
- async function init(){setBusy(true,'Loading examples…');try{const r=await fetch('/studio-examples',{cache:'no-store'});if(!r.ok)throw Error('Could not load examples. Refresh the page.');scenes=await r.json();$('example-count').textContent=`${scenes.length} scenes`;for(const [i,scene]of scenes.entries()){const card=document.createElement('button');card.className='scene-card';card.dataset.id=scene.id;card.setAttribute('aria-pressed','false');const thumb=document.createElement('div');thumb.className='thumb';const img=new Image();img.src=`/studio-assets/thumbs-v1/${scene.id}/card.webp?v=gt-20261015`;img.alt='';img.decoding='async';thumb.append(img);const index=document.createElement('span');index.className='card-index';index.textContent=String(i+1).padStart(2,'0');const check=document.createElement('span');check.className='card-selected';check.textContent='✓';thumb.append(index,check);const info=document.createElement('div');info.className='card-info';const title=document.createElement('strong');title.textContent=scene.title;info.append(title);card.append(thumb,info);card.disabled=true;card.onclick=()=>task(()=>selectScene(scene));$('gallery').append(card);}if(scenes.length)await selectScene(scenes[0]);}catch(error){$('run-status').textContent=error.message;toast(error.message);}finally{setBusy(false);}}
227
  init();
 
223
  $('load-viewer').onclick=()=>{if(viewerURL)viewer(viewerURL,$('scene-title').textContent);};
224
  $('reset').onclick=()=>{if(viewerURL)viewer(viewerURL,$('scene-title').textContent);};$('fullscreen').onclick=async()=>{try{if(document.fullscreenElement)await document.exitFullscreen();else {if(!$('frame-host').firstChild&&viewerURL)viewer(viewerURL,$('scene-title').textContent);await $('viewport').requestFullscreen();}}catch{toast('Fullscreen unavailable. Use ↗ to open the viewer.');}};
225
  $('theme').onclick=()=>{const light=document.documentElement.dataset.theme!=='light';document.documentElement.dataset.theme=light?'light':'dark';$('theme').setAttribute('aria-label',light?'Switch to dark theme':'Switch to light theme');};
226
+ async function init(){setBusy(true,'Loading examples…');try{const r=await fetch('/studio-examples',{cache:'no-store'});if(!r.ok)throw Error('Could not load examples. Refresh the page.');scenes=await r.json();$('example-count').textContent=`${scenes.length} scenes`;for(const [i,scene]of scenes.entries()){const card=document.createElement('button');card.className='scene-card';card.dataset.id=scene.id;card.setAttribute('aria-pressed','false');const thumb=document.createElement('div');thumb.className='thumb';const img=new Image();img.src=`/studio-assets/thumbs-v1/${scene.id}/card.webp?v=white-room-20261015`;img.alt='';img.decoding='async';thumb.append(img);const index=document.createElement('span');index.className='card-index';index.textContent=String(i+1).padStart(2,'0');const check=document.createElement('span');check.className='card-selected';check.textContent='✓';thumb.append(index,check);const info=document.createElement('div');info.className='card-info';const title=document.createElement('strong');title.textContent=scene.title;info.append(title);card.append(thumb,info);card.disabled=true;card.onclick=()=>task(()=>selectScene(scene));$('gallery').append(card);}if(scenes.length)await selectScene(scenes[0]);}catch(error){$('run-status').textContent=error.message;toast(error.message);}finally{setBusy(false);}}
227
  init();