Update index.html
This commit is contained in:
479
index.html
479
index.html
@@ -1,338 +1,179 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Calculator</title>
|
<title>Calculator</title>
|
||||||
<style>
|
<style>
|
||||||
* {
|
* {margin:0;padding:0;box-sizing:border-box;}
|
||||||
margin: 0;
|
body {
|
||||||
padding: 0;
|
font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
box-sizing: border-box;
|
background: linear-gradient(135deg,#667eea 0%,#764ba2 100%);
|
||||||
}
|
display:flex;justify-content:center;align-items:center;
|
||||||
|
min-height:100vh;overflow:hidden;
|
||||||
body {
|
}
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
.calculator {
|
||||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
background:#2d3748;border-radius:20px;padding:30px;
|
||||||
display: flex;
|
box-shadow:0 20px 60px rgba(0,0,0,0.5);width:400px;
|
||||||
justify-content: center;
|
}
|
||||||
align-items: center;
|
.display {
|
||||||
min-height: 100vh;
|
background:#1a202c;border-radius:10px;padding:20px;margin-bottom:20px;
|
||||||
overflow: hidden;
|
text-align:right;min-height:100px;display:flex;flex-direction:column;justify-content:flex-end;
|
||||||
}
|
}
|
||||||
|
.equation {color:#a0aec0;font-size:18px;min-height:25px;margin-bottom:10px;}
|
||||||
.calculator {
|
.current {color:#fff;font-size:36px;font-weight:600;}
|
||||||
background: #2d3748;
|
.buttons {display:grid;grid-template-columns:repeat(4,1fr);gap:12px;}
|
||||||
border-radius: 20px;
|
button {
|
||||||
padding: 30px;
|
padding:24px;font-size:20px;font-weight:600;border:none;border-radius:10px;
|
||||||
box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
|
cursor:pointer;transition:all 0.2s;color:#fff;
|
||||||
width: 400px;
|
}
|
||||||
}
|
button:hover {transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,0.3);}
|
||||||
|
button:active {transform:translateY(0);}
|
||||||
.display {
|
.number {background:#4a5568;}
|
||||||
background: #1a202c;
|
.operator {background:#ed8936;}
|
||||||
border-radius: 10px;
|
.clear {background:#e53e3e;grid-column:span 2;}
|
||||||
padding: 20px;
|
.equals {background:#48bb78;grid-column:span 2;}
|
||||||
margin-bottom: 20px;
|
.bsod {
|
||||||
text-align: right;
|
display:none;position:fixed;top:0;left:0;width:100vw;height:100vh;
|
||||||
min-height: 100px;
|
background:#0078d7;color:white;font-family:'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
display: flex;
|
z-index:9999;padding:60px;overflow:hidden;flex-direction:column;justify-content:center;
|
||||||
flex-direction: column;
|
}
|
||||||
justify-content: flex-end;
|
.bsod.show {display:flex;}
|
||||||
}
|
.bsod-content {max-width:800px;}
|
||||||
|
.sad-face {font-size:120px;margin-bottom:40px;}
|
||||||
.equation {
|
.bsod h1 {font-size:48px;font-weight:400;margin-bottom:30px;}
|
||||||
color: #a0aec0;
|
.bsod p {font-size:20px;line-height:1.6;margin-bottom:20px;}
|
||||||
font-size: 18px;
|
.progress {margin:40px 0;font-size:18px;}
|
||||||
min-height: 25px;
|
.error-details {margin-top:40px;font-size:14px;opacity:0.8;}
|
||||||
margin-bottom: 10px;
|
.restart-btn {
|
||||||
}
|
display:none;margin-top:30px;padding:15px 40px;font-size:18px;background:white;color:#0078d7;
|
||||||
|
border:none;cursor:pointer;border-radius:5px;font-weight:600;
|
||||||
.current {
|
}
|
||||||
color: #fff;
|
.restart-btn.show {display:inline-block;}
|
||||||
font-size: 36px;
|
.restart-btn:hover {background:#f0f0f0;}
|
||||||
font-weight: 600;
|
</style>
|
||||||
}
|
|
||||||
|
|
||||||
.buttons {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(4, 1fr);
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
button {
|
|
||||||
padding: 24px;
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
border: none;
|
|
||||||
border-radius: 10px;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: all 0.2s;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
button:hover {
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
button:active {
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
.number {
|
|
||||||
background: #4a5568;
|
|
||||||
}
|
|
||||||
|
|
||||||
.operator {
|
|
||||||
background: #ed8936;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clear {
|
|
||||||
background: #e53e3e;
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.equals {
|
|
||||||
background: #48bb78;
|
|
||||||
grid-column: span 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bsod {
|
|
||||||
display: none;
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100vw;
|
|
||||||
height: 100vh;
|
|
||||||
background: #0078d7;
|
|
||||||
color: white;
|
|
||||||
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
||||||
z-index: 9999;
|
|
||||||
padding: 60px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bsod.show {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bsod-content {
|
|
||||||
max-width: 800px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sad-face {
|
|
||||||
font-size: 120px;
|
|
||||||
margin-bottom: 40px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bsod h1 {
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: 400;
|
|
||||||
margin-bottom: 30px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bsod p {
|
|
||||||
font-size: 20px;
|
|
||||||
line-height: 1.6;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress {
|
|
||||||
margin: 40px 0;
|
|
||||||
font-size: 18px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-details {
|
|
||||||
margin-top: 40px;
|
|
||||||
font-size: 14px;
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.restart-btn {
|
|
||||||
display: none;
|
|
||||||
margin-top: 30px;
|
|
||||||
padding: 15px 40px;
|
|
||||||
font-size: 18px;
|
|
||||||
background: white;
|
|
||||||
color: #0078d7;
|
|
||||||
border: none;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.restart-btn.show {
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.restart-btn:hover {
|
|
||||||
background: #f0f0f0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="calculator">
|
<div class="calculator">
|
||||||
<div class="display">
|
<div class="display">
|
||||||
<div class="equation" id="equation"></div>
|
<div class="equation" id="equation"></div>
|
||||||
<div class="current" id="current">0</div>
|
<div class="current" id="current">0</div>
|
||||||
</div>
|
|
||||||
<div class="buttons">
|
|
||||||
<button class="clear" onclick="clearCalculator()">C</button>
|
|
||||||
<button class="operator" onclick="appendOperator('/')">/</button>
|
|
||||||
<button class="operator" onclick="appendOperator('*')">×</button>
|
|
||||||
|
|
||||||
<button class="number" onclick="appendNumber('7')">7</button>
|
|
||||||
<button class="number" onclick="appendNumber('8')">8</button>
|
|
||||||
<button class="number" onclick="appendNumber('9')">9</button>
|
|
||||||
<button class="operator" onclick="appendOperator('-')">-</button>
|
|
||||||
|
|
||||||
<button class="number" onclick="appendNumber('4')">4</button>
|
|
||||||
<button class="number" onclick="appendNumber('5')">5</button>
|
|
||||||
<button class="number" onclick="appendNumber('6')">6</button>
|
|
||||||
<button class="operator" onclick="appendOperator('+')">+</button>
|
|
||||||
|
|
||||||
<button class="number" onclick="appendNumber('1')">1</button>
|
|
||||||
<button class="number" onclick="appendNumber('2')">2</button>
|
|
||||||
<button class="number" onclick="appendNumber('3')">3</button>
|
|
||||||
<button class="number" onclick="appendNumber('0')">0</button>
|
|
||||||
|
|
||||||
<button class="number" onclick="appendNumber('.')">.</button>
|
|
||||||
<button class="equals" onclick="triggerBSOD()">=</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="buttons">
|
||||||
|
<button class="clear" onclick="clearCalculator()">C</button>
|
||||||
|
<button class="operator" onclick="appendOperator('/')">/</button>
|
||||||
|
<button class="operator" onclick="appendOperator('*')">×</button>
|
||||||
|
|
||||||
<div class="bsod" id="bsod">
|
<button class="number" onclick="appendNumber('7')">7</button>
|
||||||
<div class="bsod-content">
|
<button class="number" onclick="appendNumber('8')">8</button>
|
||||||
<div class="sad-face">:(</div>
|
<button class="number" onclick="appendNumber('9')">9</button>
|
||||||
<h1>Your PC ran into a problem and needs to restart.</h1>
|
<button class="operator" onclick="appendOperator('-')">-</button>
|
||||||
<p>We're just collecting some error info, and then we'll restart for you.</p>
|
|
||||||
<div class="progress">
|
<button class="number" onclick="appendNumber('4')">4</button>
|
||||||
<span id="progress">0</span>% complete
|
<button class="number" onclick="appendNumber('5')">5</button>
|
||||||
</div>
|
<button class="number" onclick="appendNumber('6')">6</button>
|
||||||
<div class="error-details">
|
<button class="operator" onclick="appendOperator('+')">+</button>
|
||||||
<p>If you'd like to know more, you can search online later for this error: fuhh you🥀😭💔.</p>
|
|
||||||
<p>Stop code: 0x0000007B (0x00000034, 0xC0000034, 0x00000000, 0x00000000)</p>
|
<button class="number" onclick="appendNumber('1')">1</button>
|
||||||
<p>What failed: your calculates were so ass it crashed</p>
|
<button class="number" onclick="appendNumber('2')">2</button>
|
||||||
</div>
|
<button class="number" onclick="appendNumber('3')">3</button>
|
||||||
<button class="restart-btn" id="restartBtn" onclick="location.reload()">Restart</button>
|
<button class="number" onclick="appendNumber('0')">0</button>
|
||||||
</div>
|
|
||||||
|
<button class="number" onclick="appendNumber('.')">.</button>
|
||||||
|
<button class="equals" onclick="triggerBSOD()">=</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script>
|
<div class="bsod" id="bsod">
|
||||||
let currentValue = '0';
|
<div class="bsod-content">
|
||||||
let previousValue = '';
|
<div class="sad-face">:(</div>
|
||||||
let operation = '';
|
<h1>Your PC ran into a problem and needs to restart.</h1>
|
||||||
let shouldResetScreen = false;
|
<p>We're just collecting some error info, and then we'll restart for you.</p>
|
||||||
|
<div class="progress"><span id="progress">0</span>% complete</div>
|
||||||
|
<div class="error-details">
|
||||||
|
<p>If you'd like to know more, you can search online later for this error: fuhh you🥀😭💔.</p>
|
||||||
|
<p>Stop code: 0x0000007B (0x00000034, 0xC0000034, 0x00000000, 0x00000000)</p>
|
||||||
|
<p>What failed: your calculates were so ass it crashed</p>
|
||||||
|
</div>
|
||||||
|
<button class="restart-btn" id="restartBtn" onclick="location.reload()">Restart</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
function updateDisplay() {
|
<script>
|
||||||
document.getElementById('current').textContent = currentValue;
|
let currentValue='0', previousValue='', operation='', shouldResetScreen=false;
|
||||||
let equationText = previousValue;
|
|
||||||
if (operation) {
|
|
||||||
equationText += ' ' + operation;
|
|
||||||
}
|
|
||||||
document.getElementById('equation').textContent = equationText;
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendNumber(num) {
|
function updateDisplay(){
|
||||||
if (currentValue === '0' || shouldResetScreen) {
|
document.getElementById('current').textContent=currentValue;
|
||||||
currentValue = num;
|
let equationText=previousValue;
|
||||||
shouldResetScreen = false;
|
if(operation) equationText+=' '+operation;
|
||||||
} else {
|
document.getElementById('equation').textContent=equationText;
|
||||||
currentValue += num;
|
}
|
||||||
}
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendOperator(op) {
|
function appendNumber(num){
|
||||||
if (operation && !shouldResetScreen) {
|
if(currentValue==='0'||shouldResetScreen){currentValue=num; shouldResetScreen=false;}
|
||||||
calculate();
|
else{currentValue+=num;}
|
||||||
}
|
updateDisplay();
|
||||||
previousValue = currentValue;
|
}
|
||||||
operation = op;
|
|
||||||
shouldResetScreen = true;
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
function calculate() {
|
function appendOperator(op){
|
||||||
const prev = parseFloat(previousValue);
|
if(operation&&!shouldResetScreen) calculate();
|
||||||
const current = parseFloat(currentValue);
|
previousValue=currentValue;
|
||||||
|
operation=op;
|
||||||
if (isNaN(prev) || isNaN(current)) return;
|
shouldResetScreen=true;
|
||||||
|
updateDisplay();
|
||||||
let result;
|
}
|
||||||
switch (operation) {
|
|
||||||
case '+':
|
|
||||||
result = prev + current;
|
|
||||||
break;
|
|
||||||
case '-':
|
|
||||||
result = prev - current;
|
|
||||||
break;
|
|
||||||
case '*':
|
|
||||||
result = prev * current;
|
|
||||||
break;
|
|
||||||
case '/':
|
|
||||||
result = prev / current;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentValue = result.toString();
|
|
||||||
operation = '';
|
|
||||||
previousValue = '';
|
|
||||||
shouldResetScreen = true;
|
|
||||||
updateDisplay();
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearCalculator() {
|
function calculate(){
|
||||||
currentValue = '0';
|
const prev=parseFloat(previousValue);
|
||||||
previousValue = '';
|
const current=parseFloat(currentValue);
|
||||||
operation = '';
|
if(isNaN(prev)||isNaN(current)) return;
|
||||||
shouldResetScreen = false;
|
let result;
|
||||||
updateDisplay();
|
switch(operation){
|
||||||
}
|
case'+':result=prev+current;break;
|
||||||
|
case'-':result=prev-current;break;
|
||||||
|
case'*':result=prev*current;break;
|
||||||
|
case'/':result=prev/current;break;
|
||||||
|
default:return;
|
||||||
|
}
|
||||||
|
currentValue=result.toString();
|
||||||
|
operation='';
|
||||||
|
previousValue='';
|
||||||
|
shouldResetScreen=true;
|
||||||
|
updateDisplay();
|
||||||
|
}
|
||||||
|
|
||||||
function triggerBSOD() {
|
function clearCalculator(){currentValue='0'; previousValue=''; operation=''; shouldResetScreen=false; updateDisplay();}
|
||||||
const bsod = document.getElementById('bsod');
|
|
||||||
const progressElement = document.getElementById('progress');
|
|
||||||
const restartBtn = document.getElementById('restartBtn');
|
|
||||||
|
|
||||||
bsod.classList.add('show');
|
|
||||||
|
|
||||||
let progress = 0;
|
|
||||||
const interval = setInterval(() => {
|
|
||||||
progress += Math.floor(Math.random() * 8) + 1;
|
|
||||||
if (progress >= 100) {
|
|
||||||
progress = 100;
|
|
||||||
clearInterval(interval);
|
|
||||||
setTimeout(() => {
|
|
||||||
restartBtn.classList.add('show');
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
progressElement.textContent = progress;
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Keyboard support
|
function triggerBSOD(){
|
||||||
document.addEventListener('keydown', (e) => {
|
// fullscreen request
|
||||||
if (e.key >= '0' && e.key <= '9') {
|
if(document.documentElement.requestFullscreen) document.documentElement.requestFullscreen();
|
||||||
appendNumber(e.key);
|
document.body.style.cursor='none';
|
||||||
} else if (e.key === '.') {
|
|
||||||
appendNumber('.');
|
|
||||||
} else if (e.key === '+' || e.key === '-' || e.key === '*' || e.key === '/') {
|
|
||||||
appendOperator(e.key);
|
|
||||||
} else if (e.key === 'Enter' || e.key === '=') {
|
|
||||||
e.preventDefault();
|
|
||||||
triggerBSOD();
|
|
||||||
} else if (e.key === 'Escape' || e.key === 'c' || e.key === 'C') {
|
|
||||||
clearCalculator();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
updateDisplay();
|
const bsod=document.getElementById('bsod');
|
||||||
</script>
|
const progressElement=document.getElementById('progress');
|
||||||
|
const restartBtn=document.getElementById('restartBtn');
|
||||||
|
|
||||||
|
bsod.classList.add('show');
|
||||||
|
|
||||||
|
let progress=0;
|
||||||
|
const interval=setInterval(()=>{
|
||||||
|
progress+=Math.floor(Math.random()*8)+1;
|
||||||
|
if(progress>=100){progress=100; clearInterval(interval);
|
||||||
|
setTimeout(()=>{restartBtn.classList.add('show');},500);}
|
||||||
|
progressElement.textContent=progress;
|
||||||
|
},200);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keyboard support + Enter = BSOD
|
||||||
|
document.addEventListener('keydown', e=>{
|
||||||
|
if(e.key>='0'&&e.key<='9') appendNumber(e.key);
|
||||||
|
else if(e.key=='.') appendNumber('.');
|
||||||
|
else if(e.key==='+'||e.key==='-'||e.key==='*'||e.key==='/') appendOperator(e.key);
|
||||||
|
else if(e.key==='Enter'||e.key==='='){e.preventDefault(); triggerBSOD();}
|
||||||
|
else if(e.key==='Escape'||e.key==='c'||e.key==='C') clearCalculator();
|
||||||
|
});
|
||||||
|
|
||||||
|
updateDisplay();
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user