Update index.php
This commit is contained in:
55
index.php
55
index.php
@@ -1,3 +1,16 @@
|
||||
<?php
|
||||
// PHP: theme onthouden via cookie
|
||||
$theme = "normal";
|
||||
if(isset($_COOKIE['theme'])) {
|
||||
$theme = $_COOKIE['theme'];
|
||||
}
|
||||
if(isset($_GET['theme'])) {
|
||||
$theme = $_GET['theme'] === "hacker" ? "hacker" : "normal";
|
||||
setcookie('theme', $theme, time() + (86400 * 30), "/"); // 30 dagen bewaren
|
||||
header("Location: ".$_SERVER['PHP_SELF']);
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="nl">
|
||||
<head>
|
||||
@@ -33,18 +46,18 @@ h1 {
|
||||
#themeToggle {
|
||||
position: fixed;
|
||||
top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
padding: 10px 20px;
|
||||
left: 10px;
|
||||
padding: 5px 10px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background: rgba(0,255,255,0.2);
|
||||
color: #00ffff;
|
||||
cursor: pointer;
|
||||
font-size: 16px;
|
||||
backdrop-filter: blur(5px);
|
||||
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
|
||||
font-size: 12px;
|
||||
backdrop-filter: blur(3px);
|
||||
box-shadow: 0 2px 5px rgba(0,0,0,0.3);
|
||||
transition: all 0.3s;
|
||||
z-index: 999;
|
||||
}
|
||||
|
||||
#themeToggle:hover {
|
||||
@@ -117,7 +130,7 @@ body.hacker li:hover {
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<body class="<?= $theme === 'hacker' ? 'hacker' : '' ?>">
|
||||
<canvas id="matrix"></canvas>
|
||||
<button id="themeToggle">Hackertheme aan/uit</button>
|
||||
<h1>voor alle dieren in de dierentuin</h1>
|
||||
@@ -145,10 +158,12 @@ body.hacker li:hover {
|
||||
<script>
|
||||
// Hackertheme toggle
|
||||
const btn = document.getElementById('themeToggle');
|
||||
const body = document.body;
|
||||
btn.addEventListener('click', () => {
|
||||
body.classList.toggle('hacker');
|
||||
matrixToggle(body.classList.contains('hacker'));
|
||||
if(document.body.classList.contains('hacker')) {
|
||||
window.location.href = "?theme=normal";
|
||||
} else {
|
||||
window.location.href = "?theme=hacker";
|
||||
}
|
||||
});
|
||||
|
||||
// Matrix rain effect
|
||||
@@ -163,7 +178,7 @@ const columns = Math.floor(width / fontSize);
|
||||
const drops = Array(columns).fill(1);
|
||||
|
||||
function drawMatrix() {
|
||||
ctx.fillStyle = "rgba(0, 0, 0, 0.05)";
|
||||
ctx.fillStyle = "rgba(0, 0, 0, 0.08)"; // beetje langzaam vervagen
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
|
||||
ctx.fillStyle = "#00ff00";
|
||||
@@ -178,22 +193,14 @@ function drawMatrix() {
|
||||
}
|
||||
drops[i]++;
|
||||
}
|
||||
requestAnimationFrame(drawMatrix);
|
||||
}
|
||||
|
||||
let matrixActive = false;
|
||||
function matrixToggle(active) {
|
||||
if(active && !matrixActive) {
|
||||
canvas.style.display = "block";
|
||||
matrixActive = true;
|
||||
drawMatrix();
|
||||
} else if(!active) {
|
||||
canvas.style.display = "none";
|
||||
matrixActive = false;
|
||||
if(document.body.classList.contains('hacker')){
|
||||
requestAnimationFrame(drawMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
canvas.style.display = "none";
|
||||
if(document.body.classList.contains('hacker')){
|
||||
drawMatrix();
|
||||
}
|
||||
|
||||
window.addEventListener('resize', () => {
|
||||
width = canvas.width = window.innerWidth;
|
||||
|
||||
Reference in New Issue
Block a user