Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
rel="stylesheet"
/>
<link href="style.css" rel="stylesheet" />
<link href="win2000.css" rel="stylesheet" />
</head>
<body>
<!-- Theme Picker -->
Expand Down
54 changes: 54 additions & 0 deletions invoice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,59 @@
const STORAGE_KEY = "invoiceData";
const THEME_KEY = "invoiceTheme";
const WIN2000_KEY = "win2000Mode";

// ── Windows 2000 Easter Egg ──────────────────────────────────

const SECRET_CODE = "win2000";
let secretBuffer = "";

function toggleWin2000(forceState) {
const isActive = forceState !== undefined ? forceState : !document.body.classList.contains("win2000");
document.body.classList.toggle("win2000", isActive);
localStorage.setItem(WIN2000_KEY, isActive ? "true" : "false");

// Fun audio feedback (optional, won't error if not supported)
if (isActive) {
try {
const ctx = new (window.AudioContext || window.webkitAudioContext)();
const osc = ctx.createOscillator();
const gain = ctx.createGain();
osc.connect(gain);
gain.connect(ctx.destination);
osc.frequency.value = 800;
gain.gain.value = 0.1;
osc.start();
osc.stop(ctx.currentTime + 0.15);
} catch (e) { /* silent fail */ }
}
}

// Restore saved win2000 state
if (localStorage.getItem(WIN2000_KEY) === "true") {
document.body.classList.add("win2000");
}

// Listen for secret code typing
document.addEventListener("keydown", (e) => {
// Don't capture when typing in editable fields
if (e.target.isContentEditable || e.target.tagName === "INPUT" || e.target.tagName === "TEXTAREA") {
return;
}

// Build the buffer
secretBuffer += e.key.toLowerCase();

// Keep only last N characters (length of secret)
if (secretBuffer.length > SECRET_CODE.length) {
secretBuffer = secretBuffer.slice(-SECRET_CODE.length);
}

// Check for match
if (secretBuffer === SECRET_CODE) {
toggleWin2000();
secretBuffer = "";
}
});

// ── Theme ────────────────────────────────────────────────────

Expand Down
Loading