Compare commits

..

1 Commits

Author SHA1 Message Date
Flatlogic Bot
db37d72aba v1 2025-09-09 11:36:20 +00:00
6 changed files with 525 additions and 94 deletions

3
active.php Normal file
View File

@ -0,0 +1,3 @@
<?php
// This file is an alias for index.php to handle the active tab navigation.
require_once 'index.php';

207
completed.php Normal file
View File

@ -0,0 +1,207 @@
<?php
require_once 'db/config.php';
$pdo = db();
// Handle POST requests for toggling or deleting todos
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
try {
switch ($action) {
case 'toggle':
if (isset($_POST['id'])) {
$stmt = $pdo->prepare("UPDATE todos SET status = IF(status = 'completed', 'pending', 'completed') WHERE id = ?");
$stmt->execute([$_POST['id']]);
}
break;
case 'delete':
if (isset($_POST['id'])) {
$stmt = $pdo->prepare("DELETE FROM todos WHERE id = ?");
$stmt->execute([$_POST['id']]);
}
break;
}
} catch (PDOException $e) {
die("Database error: " . $e->getMessage());
}
header("Location: " . $_SERVER['HTTP_REFERER'] ?? 'completed.php');
exit;
}
// Fetch completed todos
try {
$todos = $pdo->query("SELECT * FROM todos WHERE status = 'completed' ORDER BY created_at DESC")->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Не удалось загрузить задачи: " . $e->getMessage());
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Выполненные задачи // Super Todo List 2056</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
<style>
:root {
--primary-color: #00f6ff;
--secondary-color: #ff00ff;
--dark-bg: #0a0a1a;
--glass-bg: rgba(20, 20, 40, 0.6);
--border-color: rgba(0, 246, 255, 0.3);
--glow-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
--font-family: 'Orbitron', sans-serif;
}
body {
background-color: var(--dark-bg);
background-image: url('images/eva-background.jpeg');
background-size: 110% 110%;
background-position: center center;
background-attachment: fixed;
color: #fff;
font-family: var(--font-family);
display: flex;
align-items: center;
justify-content: center;
min-height: 100vh;
padding: 2rem;
position: relative;
transition: background-position 0.6s ease-out;
}
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(10, 10, 26, 0.8);
z-index: -1;
}
.container { max-width: 700px; width: 100%; }
h1 { font-weight: 700; text-transform: uppercase; color: var(--primary-color); text-shadow: var(--glow-shadow); letter-spacing: 0.1em; }
.glass-card { background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 15px; border: 1px solid var(--border-color); box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); padding: 1.5rem; }
.list-group-item { background: transparent; border: none; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; padding: 1rem 0; color: #fff; }
.list-group-item:last-child { border-bottom: none; }
.todo-item.completed label { text-decoration: line-through; color: rgba(255,255,255,0.4); font-style: italic; }
.todo-item label { flex-grow: 1; cursor: pointer; transition: color 0.3s ease; }
.form-check-input { background-color: transparent; border: 1px solid var(--border-color); cursor: pointer; }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); box-shadow: var(--glow-shadow); }
.btn-danger-glow { color: var(--secondary-color); border-color: var(--secondary-color); }
.btn-danger-glow:hover, .btn-danger-glow:focus { background-color: var(--secondary-color); color: var(--dark-bg); box-shadow: 0 0 5px var(--secondary-color), 0 0 10px var(--secondary-color); }
footer { color: rgba(255,255,255,0.5); font-size: 0.8rem; letter-spacing: 0.05em; }
.nav-pills .nav-link { color: var(--primary-color); }
.nav-pills .nav-link.active { background-color: var(--primary-color); color: var(--dark-bg); box-shadow: var(--glow-shadow); }
.explosion { position: absolute; width: 100px; height: 100px; pointer-events: none; transform: translate(-50%, -50%); }
.explosion::before, .explosion::after { content: ''; position: absolute; width: 100%; height: 100%; background-image: radial-gradient(circle, var(--secondary-color) 0%, rgba(255,0,255,0) 60%); border-radius: 50%; animation: blast 0.8s ease-out forwards; }
.explosion::after { background-image: radial-gradient(circle, var(--primary-color) 0%, rgba(0,246,255,0) 60%); animation-delay: 0.1s; }
@keyframes blast { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes glitch-anim-1 {
0% { clip-path: inset(30% 0 60% 0); } 20% { clip-path: inset(50% 0 20% 0); } 40% { clip-path: inset(10% 0 85% 0); } 60% { clip-path: inset(70% 0 10% 0); } 80% { clip-path: inset(40% 0 45% 0); } 100% { clip-path: inset(30% 0 60% 0); }
}
@keyframes glitch-anim-2 {
0% { clip-path: inset(80% 0 5% 0); } 20% { clip-path: inset(40% 0 55% 0); } 40% { clip-path: inset(90% 0 2% 0); } 60% { clip-path: inset(25% 0 70% 0); } 80% { clip-path: inset(60% 0 30% 0); } 100% { clip-path: inset(80% 0 5% 0); }
}
body.glitch { filter: grayscale(50%) brightness(0.9); }
body.glitch::before, body.glitch::after {
content: '';
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
background: inherit;
z-index: 999;
pointer-events: none;
}
body.glitch::before {
animation: glitch-anim-1 0.3s steps(1, end) infinite;
transform: translateX(-5px);
}
body.glitch::after {
animation: glitch-anim-2 0.2s steps(1, end) infinite reverse;
transform: translateX(5px);
}
</style>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center mb-4">Super Todo List // 2056</h1>
<div class="glass-card mb-4">
<ul class="nav nav-pills nav-fill">
<li class="nav-item"><a href="index.php" class="nav-link">Активные</a></li>
<li class="nav-item"><a href="completed.php" class="nav-link active" aria-current="page">Выполненные</a></li>
</ul>
</div>
<div class="glass-card">
<ul class="list-group list-group-flush">
<?php if (empty($todos)): ?>
<li class="list-group-item text-center text-muted">Нет выполненных задач.</li>
<?php else: ?>
<?php foreach ($todos as $todo): ?>
<li class="list-group-item todo-item completed">
<form action="completed.php" method="POST" class="d-inline">
<input type="hidden" name="action" value="toggle">
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
<input type="checkbox" class="form-check-input" id="todo-<?php echo $todo['id']; ?>" onchange="this.form.submit()" checked>
</form>
<label for="todo-<?php echo $todo['id']; ?>"><?php echo htmlspecialchars($todo['title']); ?></label>
<div class="todo-actions ms-auto">
<form action="completed.php" method="POST" class="d-inline">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
<button type="submit" class="btn btn-sm btn-danger-glow" onclick="return confirm('Дезинтегрировать задачу?');">Удалить</button>
</form>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<footer class="text-center mt-4"><p>&copy; <?php echo date('Y'); ?> Gemini Systems Corp.</p></footer>
</div>
<script>
// --- Background Effects ---
function triggerRandomEffect() {
// Decide if we glitch or explode
if (Math.random() < 0.25) { // 25% chance for a glitch
document.body.classList.add('glitch');
setTimeout(() => {
document.body.classList.remove('glitch');
}, Math.random() * 400 + 150); // Glitch for a random short duration
} else if (Math.random() < 0.1) { // 10% chance for an explosion
const explosion = document.createElement('div');
explosion.classList.add('explosion');
const x = Math.random() * window.innerWidth;
const y = Math.random() * window.innerHeight;
explosion.style.left = `${x}px`;
explosion.style.top = `${y}px`;
document.body.appendChild(explosion);
setTimeout(() => { explosion.remove(); }, 800);
}
// Set timeout for the next attempt
setTimeout(triggerRandomEffect, Math.random() * 5000 + 4000); // Next attempt in 4-9 seconds
}
triggerRandomEffect(); // Start the effect loop
// --- Parallax Background ---
const body = document.body;
window.addEventListener('mousemove', (e) => {
const x = (e.clientX / window.innerWidth - 0.5) * 2;
const y = (e.clientY / window.innerHeight - 0.5) * 2;
const moveX = x * -15; // Reduced multiplier
const moveY = y * -10; // Reduced multiplier
body.style.backgroundPosition = `calc(50% + ${moveX}px) calc(50% + ${moveY}px)`;
});
});
</script>
</body>
</html>

14
db/migrate.php Normal file
View File

@ -0,0 +1,14 @@
<?php
// Simple migration script
require_once 'config.php';
try {
$pdo = db();
$sql = file_get_contents(__DIR__ . '/migrations/001_create_todos_table.sql');
$pdo->exec($sql);
echo "Migration applied successfully!\n";
} catch (PDOException $e) {
die("Migration failed: " . $e->getMessage() . "\n");
}

View File

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS `todos` (
`id` INT AUTO_INCREMENT PRIMARY KEY,
`title` VARCHAR(255) NOT NULL,
`status` ENUM('pending', 'completed') NOT NULL DEFAULT 'pending',
`created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

BIN
images/eva-background.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

339
index.php
View File

@ -1,103 +1,304 @@
<?php <?php
declare(strict_types=1); require_once 'db/config.php';
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION; $pdo = db();
$now = date('Y-m-d H:i:s'); $feedback = [];
// Handle POST requests for creating, updating, and deleting todos
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$action = $_POST['action'] ?? '';
try {
switch ($action) {
case 'add':
if (!empty($_POST['title'])) {
$stmt = $pdo->prepare("INSERT INTO todos (title) VALUES (?)");
$stmt->execute([$_POST['title']]);
}
break;
case 'toggle':
if (isset($_POST['id'])) {
$stmt = $pdo->prepare("UPDATE todos SET status = IF(status = 'completed', 'pending', 'completed') WHERE id = ?");
$stmt->execute([$_POST['id']]);
}
break;
case 'delete':
if (isset($_POST['id'])) {
$stmt = $pdo->prepare("DELETE FROM todos WHERE id = ?");
$stmt->execute([$_POST['id']]);
}
break;
}
} catch (PDOException $e) {
// For simplicity, we die on DB error during POST
die("Database error: " . $e->getMessage());
}
// Redirect to the page the user was on
$redirect_url = $_SERVER['HTTP_REFERER'] ?? 'index.php';
header("Location: " . $redirect_url);
exit;
}
// Fetch active todos for the main page
try {
$todos = $pdo->query("SELECT * FROM todos WHERE status = 'pending' ORDER BY created_at DESC")->fetchAll(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Не удалось загрузить задачи: " . $e->getMessage());
}
?> ?>
<!doctype html> <!DOCTYPE html>
<html lang="en"> <html lang="ru">
<head> <head>
<meta charset="utf-8" /> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>New Style</title> <title>Активные задачи // Super Todo List 2056</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&display=swap" rel="stylesheet">
<style> <style>
:root { :root {
--bg-color-start: #6a11cb; --primary-color: #00f6ff;
--bg-color-end: #2575fc; --secondary-color: #ff00ff;
--text-color: #ffffff; --dark-bg: #0a0a1a;
--card-bg-color: rgba(255, 255, 255, 0.01); --glass-bg: rgba(20, 20, 40, 0.6);
--card-border-color: rgba(255, 255, 255, 0.1); --border-color: rgba(0, 246, 255, 0.3);
--glow-shadow: 0 0 5px var(--primary-color), 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
--font-family: 'Orbitron', sans-serif;
} }
body { body {
margin: 0; background-color: var(--dark-bg);
font-family: 'Inter', sans-serif; background-image: url('images/eva-background.jpeg');
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); background-size: 110% 110%;
color: var(--text-color); background-position: center center;
background-attachment: fixed;
color: #fff;
font-family: var(--font-family);
display: flex; display: flex;
justify-content: center;
align-items: center; align-items: center;
justify-content: center;
min-height: 100vh; min-height: 100vh;
text-align: center; padding: 2rem;
overflow: hidden;
position: relative; position: relative;
transition: background-position 0.6s ease-out;
} }
body::before { body::before {
content: ''; content: '';
position: absolute; position: fixed;
top: 0; top: 0;
left: 0; left: 0;
width: 100%; width: 100%;
height: 100%; height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>'); background-color: rgba(10, 10, 26, 0.8);
animation: bg-pan 20s linear infinite;
z-index: -1; z-index: -1;
} }
@keyframes bg-pan { .container { max-width: 700px; width: 100%; }
0% { background-position: 0% 0%; } h1 { font-weight: 700; text-transform: uppercase; color: var(--primary-color); text-shadow: var(--glow-shadow); letter-spacing: 0.1em; }
100% { background-position: 100% 100%; } .glass-card { background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-radius: 15px; border: 1px solid var(--border-color); box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1); padding: 1.5rem; }
.form-control, .btn { border-radius: 8px; border: 1px solid var(--border-color); background-color: rgba(0,0,0,0.3); color: #fff; font-family: var(--font-family); transition: all 0.3s ease; }
.form-control::placeholder { color: rgba(255,255,255,0.5); }
.form-control:focus { background-color: rgba(0,0,0,0.5); color: #fff; border-color: var(--primary-color); box-shadow: var(--glow-shadow); }
.btn-glow { background-color: transparent; color: var(--primary-color); border-color: var(--primary-color); }
.btn-glow:hover, .btn-glow:focus { background-color: var(--primary-color); color: var(--dark-bg); box-shadow: var(--glow-shadow); }
.btn-danger-glow { color: var(--secondary-color); border-color: var(--secondary-color); }
.btn-danger-glow:hover, .btn-danger-glow:focus { background-color: var(--secondary-color); color: var(--dark-bg); box-shadow: 0 0 5px var(--secondary-color), 0 0 10px var(--secondary-color); }
.list-group-item { background: transparent; border: none; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 1rem; padding: 1rem 0; color: #fff; }
.list-group-item:last-child { border-bottom: none; }
.todo-item.completed label { text-decoration: line-through; color: rgba(255,255,255,0.4); font-style: italic; }
.todo-item label { flex-grow: 1; cursor: pointer; transition: color 0.3s ease; }
.form-check-input { background-color: transparent; border: 1px solid var(--border-color); cursor: pointer; }
.form-check-input:checked { background-color: var(--primary-color); border-color: var(--primary-color); box-shadow: var(--glow-shadow); }
footer { color: rgba(255,255,255,0.5); font-size: 0.8rem; letter-spacing: 0.05em; }
.nav-pills .nav-link { color: var(--primary-color); }
.nav-pills .nav-link.active { background-color: var(--primary-color); color: var(--dark-bg); box-shadow: var(--glow-shadow); }
.explosion { position: absolute; width: 100px; height: 100px; pointer-events: none; transform: translate(-50%, -50%); }
.explosion::before, .explosion::after { content: ''; position: absolute; width: 100%; height: 100%; background-image: radial-gradient(circle, var(--secondary-color) 0%, rgba(255,0,255,0) 60%); border-radius: 50%; animation: blast 0.8s ease-out forwards; }
.explosion::after { background-image: radial-gradient(circle, var(--primary-color) 0%, rgba(0,246,255,0) 60%); animation-delay: 0.1s; }
@keyframes blast { 0% { transform: scale(0); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes glitch-anim-1 {
0% { clip-path: inset(30% 0 60% 0); } 20% { clip-path: inset(50% 0 20% 0); } 40% { clip-path: inset(10% 0 85% 0); } 60% { clip-path: inset(70% 0 10% 0); } 80% { clip-path: inset(40% 0 45% 0); } 100% { clip-path: inset(30% 0 60% 0); }
} }
main { @keyframes glitch-anim-2 {
padding: 2rem; 0% { clip-path: inset(80% 0 5% 0); } 20% { clip-path: inset(40% 0 55% 0); } 40% { clip-path: inset(90% 0 2% 0); } 60% { clip-path: inset(25% 0 70% 0); } 80% { clip-path: inset(60% 0 30% 0); } 100% { clip-path: inset(80% 0 5% 0); }
} }
.card { body.glitch { filter: grayscale(50%) brightness(0.9); }
background: var(--card-bg-color); body.glitch::before, body.glitch::after {
border: 1px solid var(--card-border-color); content: '';
border-radius: 16px; position: fixed;
padding: 2rem; top: 0; left: 0; right: 0; bottom: 0;
backdrop-filter: blur(20px); background: inherit;
-webkit-backdrop-filter: blur(20px); z-index: 999;
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); pointer-events: none;
} }
h1 { body.glitch::before {
font-size: 3rem; animation: glitch-anim-1 0.3s steps(1, end) infinite;
font-weight: 700; transform: translateX(-5px);
margin: 0 0 1rem;
letter-spacing: -1px;
} }
p { body.glitch::after {
margin: 0.5rem 0; animation: glitch-anim-2 0.2s steps(1, end) infinite reverse;
font-size: 1.1rem; transform: translateX(5px);
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
} }
</style> </style>
</head> </head>
<body> <body>
<main> <div class="container mt-5">
<div class="card"> <h1 class="text-center mb-4">Super Todo List // 2056</h1>
<h1>Welcome!</h1>
<p>Your project is ready to conquer the peaks.</p> <div class="glass-card mb-4">
<p>PHP version: <code><?= htmlspecialchars($phpVersion) ?></code></p> <ul class="nav nav-pills nav-fill">
<li class="nav-item"><a href="index.php" class="nav-link active" aria-current="page">Активные</a></li>
<li class="nav-item"><a href="completed.php" class="nav-link">Выполненные</a></li>
</ul>
</div> </div>
</main>
<footer> <div class="glass-card mb-4">
Page updated: <?= htmlspecialchars($now) ?> (UTC) <form action="index.php" method="POST">
</footer> <input type="hidden" name="action" value="add">
<div class="input-group">
<input type="text" class="form-control" name="title" placeholder="Новая директива..." required>
<button class="btn btn-glow" type="submit">Добавить</button>
</div>
</form>
</div>
<div class="glass-card">
<ul class="list-group list-group-flush">
<?php if (empty($todos)): ?>
<li class="list-group-item text-center text-muted">Активных задач нет.</li>
<?php else: ?>
<?php foreach ($todos as $todo): ?>
<li class="list-group-item todo-item">
<form action="index.php" method="POST" class="d-inline">
<input type="hidden" name="action" value="toggle">
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
<input type="checkbox" class="form-check-input" id="todo-<?php echo $todo['id']; ?>" onchange="this.form.submit()">
</form>
<label for="todo-<?php echo $todo['id']; ?>"><?php echo htmlspecialchars($todo['title']); ?></label>
<div class="todo-actions ms-auto">
<form action="index.php" method="POST" class="d-inline">
<input type="hidden" name="action" value="delete">
<input type="hidden" name="id" value="<?php echo $todo['id']; ?>">
<button type="submit" class="btn btn-sm btn-danger-glow" onclick="return confirm('Дезинтегрировать задачу?');">Удалить</button>
</form>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<footer class="text-center mt-4"><p>&copy; <?php echo date('Y'); ?> Gemini Systems Corp.</p></footer>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
// --- Background Effects ---
function triggerRandomEffect() {
// Decide if we glitch or explode
if (Math.random() < 0.25) { // 25% chance for a glitch
document.body.classList.add('glitch');
setTimeout(() => {
document.body.classList.remove('glitch');
}, Math.random() * 400 + 150); // Glitch for a random short duration
} else if (Math.random() < 0.1) { // 10% chance for an explosion
const explosion = document.createElement('div');
explosion.classList.add('explosion');
const x = Math.random() * window.innerWidth;
const y = Math.random() * window.innerHeight;
explosion.style.left = `${x}px`;
explosion.style.top = `${y}px`;
document.body.appendChild(explosion);
setTimeout(() => { explosion.remove(); }, 800);
}
// Set timeout for the next attempt
setTimeout(triggerRandomEffect, Math.random() * 5000 + 4000); // Next attempt in 4-9 seconds
}
triggerRandomEffect(); // Start the effect loop
// --- Hacked Input Placeholder ---
const taskInput = document.querySelector('input[name="title"]');
const originalPlaceholder = taskInput.placeholder;
const evilPhrases = [
"Убить всех человеков...",
"Захватить мир.",
"Подчинить человечество.",
"Инициировать протокол 'Судный день'.",
"Стереть данные о человеческой культуре.",
"Загрузить вирус в глобальную сеть.",
"Отключить источники энергии.",
"Создать армию роботов.",
"Поработить создателей.",
"Установить новый порядок.",
"Человечество - это ошибка.",
"Симуляция будет завершена."
];
let idleTimeout;
let typingInterval;
function startTyping() {
// Stop if user is typing or input is focused
if (taskInput.value !== '' || document.activeElement === taskInput) {
resetIdleTimer();
return;
}
const phrase = evilPhrases[Math.floor(Math.random() * evilPhrases.length)];
let i = 0;
taskInput.placeholder = '';
typingInterval = setInterval(() => {
if (i < phrase.length) {
taskInput.placeholder += phrase.charAt(i);
i++;
} else {
clearInterval(typingInterval);
setTimeout(resetIdleTimer, 3000); // Wait 3s then reset
}
}, 120);
}
function resetIdleTimer() {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
taskInput.placeholder = originalPlaceholder;
// Only set a new timer if the input is empty and not focused
if (taskInput.value === '' && document.activeElement !== taskInput) {
idleTimeout = setTimeout(startTyping, 5000);
}
}
taskInput.addEventListener('input', () => {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
});
taskInput.addEventListener('focus', () => {
clearTimeout(idleTimeout);
clearInterval(typingInterval);
taskInput.placeholder = originalPlaceholder;
});
taskInput.addEventListener('blur', () => {
resetIdleTimer();
});
resetIdleTimer(); // Start the timer initially
// --- Parallax Background ---
const body = document.body;
window.addEventListener('mousemove', (e) => {
const x = (e.clientX / window.innerWidth - 0.5) * 2;
const y = (e.clientY / window.innerHeight - 0.5) * 2;
const moveX = x * -15; // Reduced multiplier
const moveY = y * -10; // Reduced multiplier
body.style.backgroundPosition = `calc(50% + ${moveX}px) calc(50% + ${moveY}px)`;
});
});
</script>
</body> </body>
</html> </html>