Spaces:
Running
Running
give the name Shivaam Shukla Calculator
Browse files- index.html +8 -19
index.html
CHANGED
|
@@ -3,8 +3,8 @@
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>
|
| 7 |
-
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
@@ -78,14 +78,13 @@
|
|
| 78 |
<!-- Header -->
|
| 79 |
<header class="text-center mb-12">
|
| 80 |
<h1 class="text-4xl md:text-5xl font-bold mb-2 bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary">
|
| 81 |
-
|
| 82 |
</h1>
|
| 83 |
<p class="text-gray-300 max-w-2xl mx-auto">
|
| 84 |
Advanced calculator with GST, unit conversion, trigonometry, matrix operations, and more. All in one place!
|
| 85 |
</p>
|
| 86 |
</header>
|
| 87 |
-
|
| 88 |
-
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
| 89 |
<!-- Calculator Section -->
|
| 90 |
<div class="lg:col-span-2">
|
| 91 |
<div class="bg-dark rounded-2xl p-6 shadow-xl">
|
|
@@ -112,8 +111,7 @@
|
|
| 112 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="deleteLast()">DEL</button>
|
| 113 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('(')">(</button>
|
| 114 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay(')')">)</button>
|
| 115 |
-
|
| 116 |
-
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('7')">7</button>
|
| 117 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('8')">8</button>
|
| 118 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('9')">9</button>
|
| 119 |
<button class="calculator-btn bg-primary hover:bg-indigo-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('/')">/</button>
|
|
@@ -327,7 +325,7 @@
|
|
| 327 |
<h2 class="text-xl font-bold mb-4 flex items-center">
|
| 328 |
<i data-feather="clock" class="mr-2"></i> Calculation History
|
| 329 |
</h2>
|
| 330 |
-
|
| 331 |
<div class="text-gray-500 text-center py-8">
|
| 332 |
No calculations yet
|
| 333 |
</div>
|
|
@@ -338,7 +336,7 @@
|
|
| 338 |
<h2 class="text-xl font-bold mb-4 flex items-center">
|
| 339 |
<i data-feather="info" class="mr-2"></i> Quick Tips
|
| 340 |
</h2>
|
| 341 |
-
|
| 342 |
<li class="flex items-start">
|
| 343 |
<i data-feather="check-circle" class="text-green-500 mr-2 mt-1 flex-shrink-0"></i>
|
| 344 |
<span>Switch modes using the top buttons</span>
|
|
@@ -371,7 +369,6 @@
|
|
| 371 |
const mainDisplay = document.getElementById('mainDisplay');
|
| 372 |
const historyDisplay = document.getElementById('historyDisplay');
|
| 373 |
const historyList = document.getElementById('historyList');
|
| 374 |
-
|
| 375 |
// Initialize calculator
|
| 376 |
document.addEventListener('DOMContentLoaded', function() {
|
| 377 |
feather.replace();
|
|
@@ -379,7 +376,6 @@
|
|
| 379 |
updateDisplay();
|
| 380 |
loadHistory();
|
| 381 |
});
|
| 382 |
-
|
| 383 |
// Mode switching
|
| 384 |
document.querySelectorAll('.mode-selector').forEach(button => {
|
| 385 |
button.addEventListener('click', function() {
|
|
@@ -399,7 +395,6 @@
|
|
| 399 |
document.getElementById(currentMode + 'Calculator').classList.remove('hidden');
|
| 400 |
});
|
| 401 |
});
|
| 402 |
-
|
| 403 |
// Basic calculator functions
|
| 404 |
function appendToDisplay(value) {
|
| 405 |
if (currentInput === '0' && value !== '.') {
|
|
@@ -448,7 +443,6 @@
|
|
| 448 |
function updateDisplay() {
|
| 449 |
mainDisplay.textContent = currentInput;
|
| 450 |
}
|
| 451 |
-
|
| 452 |
// GST Calculator
|
| 453 |
function calculateGST() {
|
| 454 |
const amount = parseFloat(document.getElementById('gstAmount').value) || 0;
|
|
@@ -468,7 +462,6 @@
|
|
| 468 |
document.getElementById('gstResult').textContent = '₹0.00';
|
| 469 |
document.getElementById('totalAmount').textContent = '₹0.00';
|
| 470 |
}
|
| 471 |
-
|
| 472 |
// Unit Conversion
|
| 473 |
function convertUnits() {
|
| 474 |
const fromUnit = document.getElementById('fromUnit').value;
|
|
@@ -499,7 +492,6 @@
|
|
| 499 |
document.getElementById('unitValue').value = '1';
|
| 500 |
document.getElementById('unitResult').textContent = '1 cm = 0.01 m';
|
| 501 |
}
|
| 502 |
-
|
| 503 |
// Trigonometry
|
| 504 |
function calculateTrig() {
|
| 505 |
const angle = parseFloat(document.getElementById('trigAngle').value) || 0;
|
|
@@ -541,7 +533,6 @@
|
|
| 541 |
document.getElementById('trigAngle').value = '45';
|
| 542 |
document.getElementById('trigResult').textContent = 'sin(45°) = 0.7071';
|
| 543 |
}
|
| 544 |
-
|
| 545 |
// Matrix Calculator
|
| 546 |
function generateMatrixInputs(size) {
|
| 547 |
const container = document.getElementById('matrixInputs');
|
|
@@ -691,7 +682,6 @@
|
|
| 691 |
}
|
| 692 |
document.getElementById('matrixResult').innerHTML = 'Result will appear here';
|
| 693 |
}
|
| 694 |
-
|
| 695 |
// History functions
|
| 696 |
function addToHistory(expression, result) {
|
| 697 |
const historyItem = {
|
|
@@ -749,7 +739,6 @@
|
|
| 749 |
updateHistoryDisplay();
|
| 750 |
}
|
| 751 |
}
|
| 752 |
-
|
| 753 |
// Keyboard support
|
| 754 |
document.addEventListener('keydown', function(event) {
|
| 755 |
if (currentMode === 'basic' || currentMode === 'scientific') {
|
|
@@ -768,6 +757,6 @@
|
|
| 768 |
}
|
| 769 |
}
|
| 770 |
});
|
| 771 |
-
|
| 772 |
</body>
|
| 773 |
</html>
|
|
|
|
| 3 |
<head>
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Shivaam Shukla Calculator</title>
|
| 7 |
+
<link rel="icon" type="image/x-icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🧮</text></svg>">
|
| 8 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
|
|
| 78 |
<!-- Header -->
|
| 79 |
<header class="text-center mb-12">
|
| 80 |
<h1 class="text-4xl md:text-5xl font-bold mb-2 bg-clip-text text-transparent bg-gradient-to-r from-primary to-secondary">
|
| 81 |
+
Shivaam Shukla Calculator 🧮
|
| 82 |
</h1>
|
| 83 |
<p class="text-gray-300 max-w-2xl mx-auto">
|
| 84 |
Advanced calculator with GST, unit conversion, trigonometry, matrix operations, and more. All in one place!
|
| 85 |
</p>
|
| 86 |
</header>
|
| 87 |
+
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
|
|
|
|
| 88 |
<!-- Calculator Section -->
|
| 89 |
<div class="lg:col-span-2">
|
| 90 |
<div class="bg-dark rounded-2xl p-6 shadow-xl">
|
|
|
|
| 111 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="deleteLast()">DEL</button>
|
| 112 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('(')">(</button>
|
| 113 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay(')')">)</button>
|
| 114 |
+
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('7')">7</button>
|
|
|
|
| 115 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('8')">8</button>
|
| 116 |
<button class="calculator-btn bg-gray-700 hover:bg-gray-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('9')">9</button>
|
| 117 |
<button class="calculator-btn bg-primary hover:bg-indigo-600 text-white font-bold py-4 rounded-xl" onclick="appendToDisplay('/')">/</button>
|
|
|
|
| 325 |
<h2 class="text-xl font-bold mb-4 flex items-center">
|
| 326 |
<i data-feather="clock" class="mr-2"></i> Calculation History
|
| 327 |
</h2>
|
| 328 |
+
<div id="historyList" class="max-h-96 overflow-y-auto">
|
| 329 |
<div class="text-gray-500 text-center py-8">
|
| 330 |
No calculations yet
|
| 331 |
</div>
|
|
|
|
| 336 |
<h2 class="text-xl font-bold mb-4 flex items-center">
|
| 337 |
<i data-feather="info" class="mr-2"></i> Quick Tips
|
| 338 |
</h2>
|
| 339 |
+
<ul class="space-y-3 text-gray-300">
|
| 340 |
<li class="flex items-start">
|
| 341 |
<i data-feather="check-circle" class="text-green-500 mr-2 mt-1 flex-shrink-0"></i>
|
| 342 |
<span>Switch modes using the top buttons</span>
|
|
|
|
| 369 |
const mainDisplay = document.getElementById('mainDisplay');
|
| 370 |
const historyDisplay = document.getElementById('historyDisplay');
|
| 371 |
const historyList = document.getElementById('historyList');
|
|
|
|
| 372 |
// Initialize calculator
|
| 373 |
document.addEventListener('DOMContentLoaded', function() {
|
| 374 |
feather.replace();
|
|
|
|
| 376 |
updateDisplay();
|
| 377 |
loadHistory();
|
| 378 |
});
|
|
|
|
| 379 |
// Mode switching
|
| 380 |
document.querySelectorAll('.mode-selector').forEach(button => {
|
| 381 |
button.addEventListener('click', function() {
|
|
|
|
| 395 |
document.getElementById(currentMode + 'Calculator').classList.remove('hidden');
|
| 396 |
});
|
| 397 |
});
|
|
|
|
| 398 |
// Basic calculator functions
|
| 399 |
function appendToDisplay(value) {
|
| 400 |
if (currentInput === '0' && value !== '.') {
|
|
|
|
| 443 |
function updateDisplay() {
|
| 444 |
mainDisplay.textContent = currentInput;
|
| 445 |
}
|
|
|
|
| 446 |
// GST Calculator
|
| 447 |
function calculateGST() {
|
| 448 |
const amount = parseFloat(document.getElementById('gstAmount').value) || 0;
|
|
|
|
| 462 |
document.getElementById('gstResult').textContent = '₹0.00';
|
| 463 |
document.getElementById('totalAmount').textContent = '₹0.00';
|
| 464 |
}
|
|
|
|
| 465 |
// Unit Conversion
|
| 466 |
function convertUnits() {
|
| 467 |
const fromUnit = document.getElementById('fromUnit').value;
|
|
|
|
| 492 |
document.getElementById('unitValue').value = '1';
|
| 493 |
document.getElementById('unitResult').textContent = '1 cm = 0.01 m';
|
| 494 |
}
|
|
|
|
| 495 |
// Trigonometry
|
| 496 |
function calculateTrig() {
|
| 497 |
const angle = parseFloat(document.getElementById('trigAngle').value) || 0;
|
|
|
|
| 533 |
document.getElementById('trigAngle').value = '45';
|
| 534 |
document.getElementById('trigResult').textContent = 'sin(45°) = 0.7071';
|
| 535 |
}
|
|
|
|
| 536 |
// Matrix Calculator
|
| 537 |
function generateMatrixInputs(size) {
|
| 538 |
const container = document.getElementById('matrixInputs');
|
|
|
|
| 682 |
}
|
| 683 |
document.getElementById('matrixResult').innerHTML = 'Result will appear here';
|
| 684 |
}
|
|
|
|
| 685 |
// History functions
|
| 686 |
function addToHistory(expression, result) {
|
| 687 |
const historyItem = {
|
|
|
|
| 739 |
updateHistoryDisplay();
|
| 740 |
}
|
| 741 |
}
|
|
|
|
| 742 |
// Keyboard support
|
| 743 |
document.addEventListener('keydown', function(event) {
|
| 744 |
if (currentMode === 'basic' || currentMode === 'scientific') {
|
|
|
|
| 757 |
}
|
| 758 |
}
|
| 759 |
});
|
| 760 |
+
</script>
|
| 761 |
</body>
|
| 762 |
</html>
|