Elon earns approximately $438 per second.
Earnings Since Opening
$0.00
0 seconds
Projected Balance
$${Math.round(fv).toLocaleString()}
Includes employer match
`;
}function runMortgageCalc() {
const price = parseFloat(document.getElementById('mort_price').value) || 0;
const down = parseFloat(document.getElementById('mort_down').value) || 0;
const rate = (parseFloat(document.getElementById('mort_rate').value) / 100) / 12;
const n = (parseFloat(document.getElementById('mort_term').value) || 30) * 12;const P = price - down;
const monthly = (P * rate * Math.pow(1 + rate, n)) / (Math.pow(1 + rate, n) - 1);
const totalInterest = (monthly * n) - P;const box = document.getElementById('resMort');
box.style.display = 'block';
box.innerHTML = `Monthly Payment
$${monthly.toFixed(2)}
Total Interest: $${Math.round(totalInterest).toLocaleString()}
`;
}function runCompoundCalc() {
const P = parseFloat(document.getElementById('cmp_init').value) || 0;
const PMT = parseFloat(document.getElementById('cmp_monthly').value) || 0;
const rate = (parseFloat(document.getElementById('cmp_rate').value) / 100) / 12;
const months = (parseFloat(document.getElementById('cmp_years').value) || 0) * 12;let balance = P;
let contributed = P;for (let i = 0; i < months; i++) {
balance = (balance + PMT) * (1 + rate);
contributed += PMT;
}const box = document.getElementById('resCmp');
box.style.display = 'block';
box.innerHTML = `Future Value
$${Math.round(balance).toLocaleString()}
Interest Earned: $${Math.round(balance - contributed).toLocaleString()}
`;
}function runTipCalc() {
const bill = parseFloat(document.getElementById('tip_bill').value) || 0;
const pct = (parseFloat(document.getElementById('tip_pct').value) / 100) || 0;
const people = parseInt(document.getElementById('tip_people').value) || 1;const tip = bill * pct;
const total = bill + tip;
const perPerson = total / people;const box = document.getElementById('resTip');
box.style.display = 'block';
box.innerHTML = `Per Person
$${perPerson.toFixed(2)}
Tip: $${tip.toFixed(2)} | Total: $${total.toFixed(2)}
`;
}function runSalaryCalc() {
const gross = parseFloat(document.getElementById('sal_gross').value) || 0;
const freq = parseInt(document.getElementById('sal_freq').value) || 26;
const tax = (parseFloat(document.getElementById('sal_tax').value) / 100) || 0;const net = gross * (1 - tax);
const paycheck = net / freq;const box = document.getElementById('resSalary');
box.style.display = 'block';
box.innerHTML = `Net Take-Home
$${paycheck.toFixed(2)}/check
Annual: $${Math.round(net).toLocaleString()}
`;
}function runDogCalc() {
const age = parseFloat(document.getElementById('dog_age').value) || 0;
const size = document.getElementById('dog_size').value;let humanYears = 0;
if (age <= 1) humanYears = 15;
else if (age <= 2) humanYears = 24;
else {
let mult = 4;
if (size === 'medium') mult = 5;
else if (size === 'large') mult = 6;
else if (size === 'giant') mult = 7;
humanYears = 24 + (age - 2) * mult;
}const box = document.getElementById('resDog');
box.style.display = 'block';
box.innerHTML = `Human Age
${humanYears} Years
Your ${size} dog is ${humanYears > 50 ? 'senior' : 'adult'}
`;
}const rates = { USD: 1.0, EUR: 0.92, GBP: 0.79, CAD: 1.35, PKR: 278.50 };function runCurrencyCalc() {
const amt = parseFloat(document.getElementById('curr_amt').value) || 0;
const from = document.getElementById('curr_from').value;
const to = document.getElementById('curr_to').value;const inUSD = amt / rates[from];
const converted = inUSD * rates[to];const box = document.getElementById('resCurr');
box.style.display = 'block';
box.innerHTML = `Result
${converted.toFixed(2)} ${to}
Rate: 1 ${from} = ${(rates[to]/rates[from]).toFixed(4)} ${to}
`;
}function runProportionCalc() {
const a = parseFloat(document.getElementById('prop_a').value);
const b = parseFloat(document.getElementById('prop_b').value);
const c = parseFloat(document.getElementById('prop_c').value);const d = (b * c) / a;const box = document.getElementById('resProp');
box.style.display = 'block';
box.innerHTML = `Solved Value D
${d.toFixed(4)}
Proportion: ${a}:${b} = ${c}:${d.toFixed(4)}
`;
}function runGpaCalc() {
const input = document.getElementById('gpa_grades').value;
const grades = input.split(' ').map(g => parseFloat(g)).filter(g => !isNaN(g) && g >= 0 && g <= 4.0);if (grades.length === 0) {
alert('Please enter valid grades between 0-4.0');
return;
}const gpa = grades.reduce((a, b) => a + b, 0) / grades.length;const box = document.getElementById('resGpa');
box.style.display = 'block';
box.innerHTML = `Your GPA
${gpa.toFixed(2)}
${grades.length} grades
`;
}let elonSeconds = 0;
function startElonTicker() {
if (window.elonInterval) clearInterval(window.elonInterval);
elonSeconds = 0;
window.elonInterval = setInterval(() => {
elonSeconds += 0.1;
const earned = elonSeconds * 438;
document.getElementById('elonLiveValue').textContent = `$${earned.toFixed(2)}`;
document.getElementById('elonLiveTime').textContent = `${elonSeconds.toFixed(1)} sec`;
}, 100);
}// SEARCH
document.getElementById('globalSearch').addEventListener('input', (e) => {
const query = e.target.value.toLowerCase();
document.querySelectorAll('.card').forEach(card => {
const title = card.getAttribute('data-title') || '';
card.style.display = title.includes(query) ? 'flex' : 'none';
});
});// INIT
updateDisplay();