CalcGPT - The Intelligent Calculator
About this app
CalcGPT is a fun, AI-themed calculator that uses advanced logic to solve your math problems with a conversational twist.
CalcGPT - The Intelligent Calculator CalcGPT Download App System Status: Online | Powered by LogicNodes v4.2
Put this on your site
Source
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
<title>CalcGPT - The Intelligent Calculator</title>
<meta name="description" content="CalcGPT is a fun, AI-themed calculator that uses advanced logic to solve your math problems with a conversational twist.">
<meta name="keywords" content="calculator, ai calculator, calcgpt, math app, web calculator, smart math">
<!-- Libraries -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css" crossorigin="anonymous">
<script type="text/javascript">
try {
document.addEventListener("DOMContentLoaded", function() {
const chatHistory = document.getElementById('chat-history');
const userInput = document.getElementById('user-input');
const sendBtn = document.getElementById('send-btn');
const statusIndicator = document.getElementById('status-text');
const thinkingPhrases = [
"Consulting neural nodes...",
"Optimizing arithmetic pathways...",
"Decoding mathematical constants...",
"Running through 10,000 iterations...",
"Verifying floating point precision...",
"Accessing the mainframe...",
"Analyzing numerical probability..."
];
function appendMessage(role, text) {
const messageDiv = document.createElement('div');
messageDiv.className = `message ${role}-message animate__animated animate__fadeInUp`;
const icon = role === 'ai' ? '<i class="fas fa-robot me-2"></i>' : '<i class="fas fa-user me-2"></i>';
const label = role === 'ai' ? 'CalcGPT' : 'You';
messageDiv.innerHTML = `
<div class="message-header"><strong>${icon}${label}</strong></div>
<div class="message-content">${text}</div>
`;
chatHistory.appendChild(messageDiv);
chatHistory.scrollTop = chatHistory.scrollHeight;
}
function calculate(input) {
// Sanitize input: only numbers, operators, dots, and parentheses
const sanitizedInput = input.replace(/[^-+*/().0-9]/g, '');
try {
// Using Function instead of eval for a bit more safety in this scope
return Function('"use strict";return (' + sanitizedInput + ')')();
} catch (e) {
return null;
}
}
async function handleSubmission() {
const query = userInput.val().trim();
if (!query) return;
appendMessage('user', query);
userInput.val('');
sendBtn.prop('disabled', true);
statusIndicator.innerText = "Thinking...";
// Show AI is thinking with a random phrase
const phrase = thinkingPhrases[Math.floor(Math.random() * thinkingPhrases.length)];
const tempAiMsg = document.createElement('div');
tempAiMsg.className = 'message ai-message loading-state';
tempAiMsg.innerHTML = `<div class="spinner-border spinner-border-sm text-primary me-2" role="status"></div> <em>${phrase}</em>`;
chatHistory.appendChild(tempAiMsg);
chatHistory.scrollTop = chatHistory.scrollHeight;
// Simulate "Processing" time
await new Promise(resolve => setTimeout(resolve, 1200 + Math.random() * 800));
tempAiMsg.remove();
const result = calculate(query);
if (result !== null && !isNaN(result)) {
const responses = [
`The computational result for "${query}" is exactly **${result}**.`,
`I have analyzed your request. The answer is **${result}**.`,
`Based on my advanced calculations, the output is **${result}**.`,
`Successfully computed: **${result}**.`
];
appendMessage('ai', responses[Math.floor(Math.random() * responses.length)]);
} else {
appendMessage('ai', "I'm sorry, my logic gates couldn't parse that mathematical expression. Please provide a standard equation (e.g., '5 + 5').");
}
sendBtn.prop('disabled', false);
statusIndicator.innerText = "Online";
userInput.focus();
}
sendBtn.on('click', handleSubmission);
userInput.on('keypress', function(e) {
if (e.which === 13) handleSubmission();
});
// Download feature
document.getElementById('download-btn').addEventListener('click', function() {
const htmlContent = document.documentElement.outerHTML;
const blob = new Blob([htmlContent], { type: 'text/html' });
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'CalcGPT.html';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
alert("Download started! You can now run CalcGPT offline.");
});
// Initial greeting
setTimeout(() => {
appendMessage('ai', "Hello! I am CalcGPT. I specialize in complex arithmetic. What can I calculate for you today?");
}, 500);
});
} catch (error) {
console.error(error);
}
</script>
<style>
:root {
--primary-bg: #0f172a;
--secondary-bg: #1e293b;
--accent-color: #38bdf8;
--ai-bubble: #334155;
--user-bubble: #0ea5e9;
--text-color: #f1f5f9;
}
body {
background-color: var(--primary-bg);
color: var(--text-color);
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
height: 100vh;
display: flex;
flex-direction: column;
}
#main-container {
flex: 1;
display: flex;
flex-direction: column;
max-width: 800px;
margin: 0 auto;
padding: 1rem;
height: 100%;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 0;
border-bottom: 1px solid #334155;
margin-bottom: 10px;
}
.logo {
font-size: 1.5rem;
font-weight: 800;
background: linear-gradient(90deg, #38bdf8, #818cf8);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
display: flex;
align-items: center;
gap: 10px;
}
#chat-history {
flex: 1;
overflow-y: auto;
padding: 1rem;
background: var(--secondary-bg);
border-radius: 12px;
box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
display: flex;
flex-direction: column;
gap: 15px;
}
.message {
max-width: 85%;
padding: 12px 16px;
border-radius: 18px;
line-height: 1.5;
position: relative;
}
.ai-message {
align-self: flex-start;
background-color: var(--ai-bubble);
border-bottom-left-radius: 4px;
}
.user-message {
align-self: flex-end;
background-color: var(--user-bubble);
border-bottom-right-radius: 4px;
color: white;
}
.message-header {
font-size: 0.8rem;
margin-bottom: 5px;
opacity: 0.8;
}
.input-area {
padding: 20px 0;
display: flex;
gap: 10px;
}
#user-input {
flex: 1;
background: var(--secondary-bg);
border: 1px solid #475569;
color: white;
padding: 12px 20px;
border-radius: 30px;
outline: none;
transition: border-color 0.3s;
}
#user-input:focus {
border-color: var(--accent-color);
}
#send-btn {
background: var(--user-bubble);
border: none;
color: white;
width: 50px;
height: 50px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
transition: transform 0.2s, background 0.2s;
}
#send-btn:hover {
transform: scale(1.05);
background: #0284c7;
}
#send-btn:active {
transform: scale(0.95);
}
.status-bar {
font-size: 0.75rem;
color: #94a3b8;
text-align: center;
margin-top: 5px;
}
.loading-state {
font-style: italic;
opacity: 0.7;
background: transparent;
border: none;
box-shadow: none;
}
.btn-download {
background: transparent;
border: 1px solid var(--accent-color);
color: var(--accent-color);
border-radius: 20px;
padding: 5px 15px;
font-size: 0.8rem;
transition: all 0.3s;
}
.btn-download:hover {
background: var(--accent-color);
color: var(--primary-bg);
}
/* Animations */
@keyframes fadeInUp {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.animate__fadeInUp {
animation: fadeInUp 0.3s ease-out forwards;
}
/* Scrollbar */
#chat-history::-webkit-scrollbar {
width: 6px;
}
#chat-history::-webkit-scrollbar-track {
background: transparent;
}
#chat-history::-webkit-scrollbar-thumb {
background: #475569;
border-radius: 10px;
}
@media (max-width: 480px) {
.message {
max-width: 95%;
}
.logo span {
display: none;
}
}
</style>
</head>
<body>
<div id="main-container">
<header>
<div class="logo">
<i class="fas fa-calculator"></i>
<span>CalcGPT</span>
</div>
<button id="download-btn" class="btn btn-download">
<i class="fas fa-download me-1"></i> Download App
</button>
</header>
<div id="chat-history">
<!-- Messages will appear here -->
</div>
<div class="input-area">
<input type="text" id="user-input" placeholder="Type a math problem (e.g. 24 * 12)..." autocomplete="off">
<button id="send-btn" title="Send">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<div class="status-bar">
System Status: <span id="status-text" class="text-success">Online</span> | Powered by LogicNodes v4.2
</div>
</div>
<!-- Hidden container for download logic if needed elsewhere -->
</body>
</html>
NEW APPS
These are apps made by the community!