MC/website/web/app.js
2026-11-27 23:43:05 +00:00

13 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

const houses={
fremen:{name:'Vrijduin',world:'ARRAKDUIN / THE DESERT WORLD',lore:'The desert is home. Its secrets are survival.',detail:'Harvest two spice units per deposit and keep moving with an Arrakduin speed bonus. The orange reclaimer suit is your first line of defense.',status:'Arrakduin has the complete gameplay guide: spice, shelter, sandworms, missions and Imperial rights.',image:'arrakis',alt:'Illustrated block-built Arrakduin desert'},
atreides:{name:'Aerdrecht',world:'KALADAM / WATER & GREEN LANDS',lore:'From ocean horizons to the dunes of destiny.',detail:'Choose the blue reclaimer suit and an Aerdrecht movement-speed bonus. Kaladam’s released terrain profile brings jungle, greenery and water to your homeworld.',status:'Kaladam terrain is implemented. Its manual chapter reserves space for future planet-specific gameplay.',image:'caladan',alt:'Illustrated block-built green Kaladam mountains and water'},
harkonnen:{name:'Harkveen',world:'GIEDERMARK / INDUSTRIAL SHADOWS',lore:'Power casts a long shadow.',detail:'The red Harkveen reclaimer suit accompanies increased melee damage. Giedermark uses a swamp biome and a dark blackstone terrain palette.',status:'Giedermark terrain is implemented. The illustrated factories are concept scenery, not generated plugin structures.',image:'giedi',alt:'Illustrated dark voxel citadels on Giedermark'},
corrino:{name:'Korenholt',world:'KAITERHOF / THE IMPERIAL HORIZON',lore:'The throne watches every grain of spice.',detail:'Wear the purple reclaimer suit and gain the Korenholt armor bonus. Kaiterhof’s released profile includes plains, flowers and configured ore deposits.',status:'Kaiterhof terrain is implemented. Imperial palace architecture is concept artwork; local quests are reserved for future expansion.',image:'kaitain',alt:'Illustrated Minecraft-influenced Imperial golden palace on Kaiterhof'},
ordos:{name:'Oordwijk',world:'SIGMADRAKEN IV / COLD HORIZONS',lore:'A quiet step. A calculated advantage.',detail:'The green reclaimer suit carries your allegiance. Use the Oordwijk Shadow Step and configure an optional Wind Charge ability; explore the snowy homeworld profile.',status:'Sigmadraken IV terrain is implemented. Its reserved chapter documents the current profile without promising new settlements.',image:'sigma',alt:'Illustrated block-built snowy Sigmadraken IV landscape'}
};
const tabs=[...document.querySelectorAll('[data-house]')];
function selectHouse(key){const h=houses[key];if(!h)return;tabs.forEach(t=>{const active=t.dataset.house===key;t.setAttribute('aria-selected',String(active));t.tabIndex=active?0:-1});for(const [id,value] of [['house-world',h.world],['house-name',h.name],['house-lore',h.lore],['house-detail',h.detail],['house-status',h.status]])document.getElementById(id).textContent=value;const img=document.getElementById('house-image');img.src=`assets/${h.image}.webp`;img.alt=h.alt;const command=document.getElementById('house-command');command.dataset.copy=`/dune choose ${key}`;command.replaceChildren(document.createTextNode(command.dataset.copy+' '));const span=document.createElement('span');span.textContent='Copy ⧉';command.append(span);document.getElementById('house-panel').setAttribute('aria-labelledby',`tab-${key}`)}
tabs.forEach((tab,index)=>{tab.addEventListener('click',()=>selectHouse(tab.dataset.house));tab.addEventListener('keydown',e=>{let next=index;if(e.key==='ArrowRight')next=(index+1)%tabs.length;else if(e.key==='ArrowLeft')next=(index-1+tabs.length)%tabs.length;else if(e.key==='Home')next=0;else if(e.key==='End')next=tabs.length-1;else return;e.preventDefault();selectHouse(tabs[next].dataset.house);tabs[next].focus()})});
const toggle=document.querySelector('.menu-toggle'),nav=document.querySelector('nav');toggle.addEventListener('click',()=>{const open=nav.classList.toggle('open');toggle.setAttribute('aria-expanded',String(open));toggle.setAttribute('aria-label',open?'Close navigation':'Open navigation')});nav.querySelectorAll('a').forEach(a=>a.addEventListener('click',()=>{nav.classList.remove('open');toggle.setAttribute('aria-expanded','false');toggle.setAttribute('aria-label','Open navigation')}));
let toastTimer;function notify(message){const toast=document.querySelector('.toast');toast.textContent=message;toast.classList.add('visible');clearTimeout(toastTimer);toastTimer=setTimeout(()=>toast.classList.remove('visible'),2800)}
document.querySelectorAll('[data-copy]').forEach(button=>button.addEventListener('click',async()=>{try{await navigator.clipboard.writeText(button.dataset.copy);notify('Command copied. Paste it in Minecraft.')}catch{notify('Copy this command: '+button.dataset.copy)}}));