-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
1 lines (1 loc) · 13.6 KB
/
index.html
1
<html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script src="https://cdn.tailwindcss.com"></script><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"><script src="https://cdn.jsdelivr.net/npm/[email protected]/bignumber.min.js"></script><style>.tab{transition:background-color 0.3s ease;}.tab-bar{height:10px;}.popup,.popup2,.popup3{position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);width:512px;height:300px;display:none;flex-direction:column;align-items:center;justify-content:center;border-radius:5px;box-shadow:0 0 10px rgba(0,0,0,0.5);opacity:0;transition:opacity 0.3s ease;backdrop-filter:blur(10px);}.popup.visible,.popup2.visible,.popup3.visible{display:flex;opacity:1;}.popup3{animation:flash 1s ease-in-out infinite;}@keyframes flash{0%{background-color:red;}50%{background-color:orange;}100%{background-color:red;}}.version{position:fixed;bottom:10px;left:10px;color:rgba(255,255,255,0.5);text-shadow:0 0 5px rgba(255,255,255,0.5);}.achievement{background-color:#064e3b;border:2px solid #10b981;width:512px;height:70px;display:flex;align-items:center;justify-content:center;border-radius:5px;margin-top:10px;}.hidden{display:none;}.tab-border{border:2px solid;}</style><script>document.addEventListener('DOMContentLoaded',function(){let hz=new BigNumber(0),gain=new BigNumber(1),cost=new BigNumber(7),powBoost=new BigNumber(1.25),powGainDecrease=new BigNumber(0.26),powGain=new BigNumber(1.25),volumeUnlocked=false,volume=new BigNumber(0),hzBonus=new BigNumber(1);const hzDisplay=document.getElementById('hz-display'),gainDisplay=document.getElementById('gain-display'),costDisplay=document.getElementById('cost-display'),popup=document.getElementById('popup'),popup2=document.getElementById('popup2'),popup3=document.getElementById('popup3'),achievement=document.getElementById('achievement'),achievement2=document.getElementById('achievement2'),achievement3=document.getElementById('achievement3'),achievement4=document.getElementById('achievement4'),unlockVolumeButton=document.getElementById('unlock-volume-button'),nerfDecreaseButton=document.getElementById('nerf-decrease-button'),tabVolume=document.getElementById('tab-volume'),volumeContent=document.getElementById('volume-content'),saveData=localStorage.getItem('saveData');if(saveData){const data=JSON.parse(saveData);({hz,gain,cost,powBoost,powGainDecrease,powGain,volumeUnlocked,volume,hzBonus}=data);hz=new BigNumber(hz);gain=new BigNumber(gain);cost=new BigNumber(cost);powBoost=new BigNumber(powBoost);powGainDecrease=new BigNumber(powGainDecrease);powGain=new BigNumber(powGain);volume=new BigNumber(volume);hzBonus=new BigNumber(hzBonus);updateDisplay();}function updateHz(){hz=hz.plus(gain.div(30));updateDisplay();checkAchievements();saveGame();}function updateDisplay(){hzDisplay.textContent=abbreviateNumber(hz);gainDisplay.textContent=abbreviateNumber(gain,'Gain: ');costDisplay.textContent=`${cost}Hz`;if(volumeUnlocked){volumeContent.innerHTML=`<div class="text-4xl text-blue-500">The volume is ${volume.times(100)}% (Boosts hz gain by x${hzBonus}!)</div><div class="text-teal-500 text-lg">Upgrades soon. ;></div>`;}}function abbreviateNumber(num,prefix=''){if(num.isLessThan(1000000))return`${prefix}${num.toFixed(0)} Hz`;const exponent=num.e,mantissa=num.dividedBy(new BigNumber(10).pow(exponent)).toFixed(5);return`${prefix}${mantissa} × 10^${exponent} Hz`;}function checkAchievements(){if(hz.isGreaterThanOrEqualTo(1)&&!achievement.classList.contains('completed'))completeAchievement(achievement,'First Hertz Complete');if(hz.isGreaterThanOrEqualTo(60)&&!achievement2.classList.contains('completed'))completeAchievement(achievement2,'I can hear now');if(hz.isGreaterThanOrEqualTo(2000)&&!achievement3.classList.contains('completed'))completeAchievement(achievement3,'beep thing XD');if(hz.isGreaterThanOrEqualTo(10000)&&!volumeUnlocked)unlockVolumeButton.classList.remove('hidden');}function completeAchievement(element,text){element.classList.add('completed');element.textContent=text;showPopup(`Achievement Complete: ${text}`);}function showPopup(message){popup.textContent=message;popup.classList.add('visible');setTimeout(()=>popup.classList.remove('visible'),3000);}function saveGame(){const data={hz:hz.toString(),gain:gain.toString(),cost:cost.toString(),powBoost:powBoost.toString(),powGainDecrease:powGainDecrease.toString(),powGain:powGain.toString(),volumeUnlocked,volume:volume.toString(),hzBonus:hzBonus.toString()};localStorage.setItem('saveData',JSON.stringify(data));}setInterval(updateHz,1000/30);document.getElementById('upgrade-button').addEventListener('click',()=>{if(hz.isGreaterThanOrEqualTo(cost)){hz=hz.minus(cost);gain=gain.times(2);cost=cost.times(2);updateDisplay();}});document.getElementById('max-button').addEventListener('click',()=>{while(hz.isGreaterThanOrEqualTo(cost)){hz=hz.minus(cost);gain=gain.times(2);cost=cost.times(2);}updateDisplay();});document.getElementById('power-frequency-button').addEventListener('click',()=>{if(hz.isGreaterThanOrEqualTo(100)){hz=hz.minus(100);gain=gain.times(1.25);updateDisplay();}});nerfDecreaseButton.addEventListener('click',()=>{if(hz.isGreaterThanOrEqualTo(250)){hz=hz.minus(250);powGainDecrease=powGainDecrease.minus(0.05);if(powGainDecrease.isLessThanOrEqualTo(0)){nerfDecreaseButton.classList.add('text-red-500','border-red-500');nerfDecreaseButton.textContent='MAXXED OUT';nerfDecreaseButton.disabled=true;}updateDisplay();}});document.getElementById('save-button').addEventListener('click',saveGame);document.getElementById('load-button').addEventListener('click',()=>popup2.classList.add('visible'));document.getElementById('cancel-button2').addEventListener('click',()=>popup2.classList.remove('visible'));document.getElementById('submit-button2').addEventListener('click',()=>{const saveInput=document.getElementById('save-input2').value;try{const data=JSON.parse(saveInput);({hz,gain,cost,powBoost,powGainDecrease,powGain,volumeUnlocked,volume,hzBonus}=data);hz=new BigNumber(hz);gain=new BigNumber(gain);cost=new BigNumber(cost);powBoost=new BigNumber(powBoost);powGainDecrease=new BigNumber(powGainDecrease);powGain=new BigNumber(powGain);volume=new BigNumber(volume);hzBonus=new BigNumber(hzBonus);updateDisplay();saveGame();popup2.classList.remove('visible');}catch(error){console.log('Invalid save data');}});document.getElementById('reset-button').addEventListener('click',()=>popup3.classList.add('visible'));document.getElementById('cancel-button3').addEventListener('click',()=>popup3.classList.remove('visible'));document.getElementById('yes-button').addEventListener('click',()=>{resetGame();popup3.classList.remove('visible');});unlockVolumeButton.addEventListener('click',()=>{if(hz.isGreaterThanOrEqualTo(1000000)){resetGame();volumeUnlocked=true;unlockVolumeButton.classList.add('hidden');tabVolume.classList.remove('hidden');completeAchievement(achievement4,'Volumeness');saveGame();}});function resetGame(){hz=new BigNumber(0);gain=new BigNumber(1);cost=new BigNumber(7);powBoost=new BigNumber(1.25);powGainDecrease=new BigNumber(0.26);powGain=new BigNumber(1.25);volumeUnlocked=false;volume=new BigNumber(0);hzBonus=new BigNumber(1);unlockVolumeButton.classList.add('hidden');nerfDecreaseButton.classList.remove('text-red-500','border-red-500');nerfDecreaseButton.textContent='Nerf the Decrease';nerfDecreaseButton.disabled=false;updateDisplay();achievement.classList.remove('completed');achievement.textContent='First Hertz';achievement2.classList.remove('completed');achievement2.textContent='I can hear now';achievement3.classList.remove('completed');achievement3.textContent='beep thing XD';achievement4.classList.remove('completed');achievement4.textContent='Volumeness';saveGame();}document.getElementById('copy-button').addEventListener('click',()=>{const data=localStorage.getItem('saveData');navigator.clipboard.writeText(data).then(()=>console.log('Save data copied to clipboard'));});document.getElementById('download-button').addEventListener('click',()=>{const data=localStorage.getItem('saveData');const blob=new Blob([data],{type:'application/json'});const link=document.createElement('a');link.href=URL.createObjectURL(blob);link.download='saveData.json';link.click();console.log('Save data downloaded');});const tabs=document.querySelectorAll('.tab');tabs.forEach(tab=>{tab.addEventListener('click',function(){tabs.forEach(t=>t.classList.remove('bg-white','bg-green-500','bg-orange-500','bg-blue-500','bg-teal-500','text-black','bg-gray-800','text-gray-300'));this.classList.add(this.id==='tab-hz'?'bg-white':this.id==='tab-achievements'?'bg-green-500':this.id==='tab-settings'?'bg-orange-500':this.id==='tab-changelog'?'bg-blue-500':'bg-teal-500','text-black');document.querySelectorAll('.content').forEach(content=>content.classList.add('hidden'));document.getElementById(this.dataset.content).classList.remove('hidden');});});});</script></head><body class="bg-gray-900 text-gray-300 font-sans h-screen"><div class="flex h-full"><div class="w-1/4 bg-gray-800 p-8 flex flex-col justify-center"><div id="tab-hz" class="tab text-6xl font-bold text-black bg-white p-4 cursor-pointer tab-border border-white" data-content="hz-content">Hz<div class="tab-bar"></div></div><div class="h-2"></div><div id="tab-achievements" class="tab text-lg text-gray-300 bg-gray-800 p-4 cursor-pointer tab-border border-green-500" data-content="achievement-content">Achievements<div class="tab-bar"></div></div><div class="h-2"></div><div id="tab-settings" class="tab text-lg text-gray-300 bg-gray-800 p-4 cursor-pointer tab-border border-orange-500" data-content="settings-content">Settings<div class="tab-bar"></div></div><div class="h-2"></div><div id="tab-changelog" class="tab text-lg text-gray-300 bg-gray-800 p-4 cursor-pointer tab-border border-blue-500" data-content="changelog-content">Changelog<div class="tab-bar"></div></div><div class="h-2"></div><div id="tab-volume" class="tab text-lg text-gray-300 bg-gray-800 p-4 cursor-pointer tab-border border-teal-500 hidden" data-content="volume-content">Volume<div class="tab-bar"></div></div></div><div class="flex-1 p-8 flex flex-col justify-center"><div id="hz-content" class="content"><div class="text-2xl">You Have</div><div id="hz-display" class="text-6xl font-bold">0 Hz</div><div id="gain-display" class="text-xl">Gain: 1Hz/s (Boosted by 1.25)</div><div class="mt-8 border-t border-gray-500 pt-4"><div class="text-3xl font-bold">Double Gain Speed</div><div class="text-lg mt-2">Double Click Gain</div><div class="flex space-x-4"><button id="upgrade-button" class="mt-4 px-4 py-2 border border-gray-300 text-white">BUY</button><button id="max-button" class="mt-4 px-4 py-2 border border-gray-300 text-white">MAX</button></div><div id="cost-display" class="text-lg mt-2">7Hz</div></div><div class="mt-8 border-t border-gray-500 pt-4 flex space-x-8"><div><div class="text-3xl font-bold">Power The Frequency</div><div class="text-lg mt-2">Boost Gain Speed by 25%</div><div class="flex space-x-4"><button id="power-frequency-button" class="mt-4 px-4 py-2 border border-gray-300 text-white">BUY</button></div><div class="text-lg mt-2">100Hz</div></div><div><div class="text-3xl font-bold">Nerf the Decrease</div><div class="text-lg mt-2">Decrease Gain Speed Reduction</div><div class="flex space-x-4"><button id="nerf-decrease-button" class="mt-4 px-4 py-2 border border-gray-300 text-white">BUY</button></div><div class="text-lg mt-2">250Hz</div></div></div><div class="mt-8 border-t border-gray-500 pt-4 hidden" id="unlock-volume-button"><button class="mt-4 px-4 py-2 border border-teal-500 text-blue-500">Unlock Volume</button></div></div><div id="achievement-content" class="content hidden"><div class="border border-gray-500 p-4"><div class="text-2xl font-bold">Achievements</div><hr class="border-gray-500 my-4"><div class="achievement" id="achievement">First Hertz</div><div class="achievement" id="achievement2">I can hear now</div><div class="achievement" id="achievement3">beep thing XD</div><div class="achievement" id="achievement4">Volumeness</div></div></div><div id="settings-content" class="content hidden"><div class="flex flex-row space-x-4"><button id="save-button" class="px-4 py-2 border border-gray-300 text-white">Save</button><button id="load-button" class="px-4 py-2 border border-gray-300 text-white">Load</button><button id="copy-button" class="px-4 py-2 border border-gray-300 text-white">Copy</button><button id="download-button" class="px-4 py-2 border border-gray-300 text-white">Download</button><button id="reset-button" class="px-4 py-2 border border-gray-300 text-white">Reset</button></div></div><div id="changelog-content" class="content hidden"><div class="text-lg">v0.3.2a - fixes!!!1</div></div><div id="volume-content" class="content hidden"><div class="text-4xl text-blue-500">The volume is 0% (Boosts hz gain by x1!)</div><div class="text-teal-500 text-lg">Upgrades soon. ;></div></div></div><div id="popup" class="popup hidden"></div><div id="popup2" class="popup2 hidden"><div class="text-white text-xl absolute top-4 left-4">Load Save</div><input id="save-input2" type="text" class="mt-8 p-2 rounded-lg bg-gray-500 bg-opacity-50 text-white w-3/4"><div class="flex space-x-4 absolute bottom-4 right-4"><button id="submit-button2" class="px-4 py-2 border border-gray-300 text-white">Submit</button><button id="cancel-button2" class="px-4 py-2 border border-gray-300 text-white">Cancel</button></div></div><div id="popup3" class="popup3 hidden"><div class="text-pink-500 text-xl absolute top-4 left-4">Are you sure you wanna reset?</div><div class="flex space-x-4 absolute bottom-4 right-4"><button id="yes-button" class="px-4 py-2 border border-gray-300 text-white">Yes</button><button id="cancel-button3" class="px-4 py-2 border border-gray-300 text-white">Cancel</button></div></div><div class="version">v0.3.2a</div></body></html>