Files
martinfencl.eu/locenice/js/bootstrap.js
T
martin.fencl c32d1e5a04
continuous-integration/drone/push Build is passing
feat(fence): add height selection for fence panels and update related logic
- Introduced a new section in the UI for selecting fence heights, visible only when the fence option is enabled.
- Updated the fence label to clarify the presence of gates.
- Enhanced the JavaScript logic to manage the visibility of fence heights based on user selection.
- Modified the fence rendering logic to accommodate different heights and ensure proper visibility based on the selected height.
- Updated CSS to style the new fence height controls appropriately.
- Adjusted the model configuration to reflect changes in the fence height options.
2026-10-26 21:24:38 +01:00

25 lines
2.3 KiB
JavaScript

/** Only application startup. All paths are relative to /locenice/index.php. */
async function json(path){const response=await fetch(path,{cache:'no-cache'});if(!response.ok)throw Error(path+' / HTTP '+response.status);return response.json();}
try{
const config=await json('./data/app-config.json');
const [catalog,assets,references,scene,site]=await Promise.all([config.catalog,config.assets,config.references,config.sceneMetadata,config.site].map(json));
const response=await fetch(config.model);if(!response.ok)throw Error('Model / HTTP '+response.status);
const modelBytes=new Uint8Array(await response.arrayBuffer());
config.threeModule=new URL(config.threeModule,location.href).href;config.threeLoader=new URL(config.threeLoader,location.href).href;
// The standard GLTFLoader imports the same pinned Three.js copy. app.html normally adds this map
// before any module loads (Firefox ignores a later one); this is only the fallback.
if(!document.querySelector('script[type=importmap]')){const map=document.createElement('script');map.type='importmap';map.textContent=JSON.stringify({imports:{three:config.threeModule}});document.head.appendChild(map);}
const hash=location.hash;
if(hash.startsWith('#vyber='))try{
let text=hash.slice(7).replace(/-/g,'+').replace(/_/g,'/');text+='='.repeat((4-text.length%4)%4);
if(text.length>32000)throw Error('Too large');const bytes=Uint8Array.from(atob(text),ch=>ch.charCodeAt(0));const payload=JSON.parse(new TextDecoder().decode(bytes));
if(payload.schema!=='allstav-rd-config'||payload.version!==1||!payload.selection)throw Error('Invalid selection');
document.getElementById('stdSavedState').textContent=JSON.stringify({selection:payload.selection});
}catch(error){console.warn('Invalid shared selection:',error);}
window.LOCENICE_RESOURCES={config,catalog,assets,references,scene,site,modelBytes};
await import('./app.js?v=20261026e');
}catch(error){
console.error(error);const box=document.getElementById('loading');box.className='error';box.innerHTML='<div class="errorDetail"></div><p>Nahrajte celou slozku vcetne js, css, data, models a assets. Otevrete ji pres HTTP(S), nikoli dvojklikem na HTML.</p><a href="./models/dum.glb" download>Stahnout model GLB</a>';
box.querySelector('.errorDetail').textContent=error.message;document.getElementById('webStatus').textContent='Chyba nacitani';
}