feat: easter egg théière 418 + Konami obfusqué via global.js centralisé

- /418/ (et /fr|en/418) : vraie page HTTP 418 'Je suis une théière', SVG
  animé (vapeur), boutons café (refus RFC 2324) / thé (toast), noindex.
- Nouveau public/js/global.js chargé sur toutes les pages (statiques,
  dynamiques articles/blog, page d'erreur) qui :
  * écoute le code Konami ↑↑↓↓←→←→BA → redirige vers /418/ ;
  * charge ses clés par codes de caractères (aucune chaîne révélatrice en
    clair : ni 'ArrowUp', ni '/418/', ni 'b/a' dans la source) ;
  * sert de dispatcher centralisé : injecte par page (components/discord/
    zfprobe) via <body data-page=...> ou règles de chemin, sans doublon.
- easter.js supprimé au profit de global.js unique sur 22 pages statiques.
This commit is contained in:
riricdev 2026-09-07 15:16:20 +02:00
commit 1482c6aaf0
24 changed files with 217 additions and 0 deletions

81
public/js/global.js Normal file
View file

@ -0,0 +1,81 @@
(function (w, d) {
"use strict";
function dc() {
var a = [].slice.call(arguments), o = "";
for (var i = 0; i < a.length; i++) o += String.fromCharCode(a[i]);
return o;
}
function bt() {
var p = dc(65, 114, 114, 111, 119);
var u = p + dc(85, 112);
var dn = p + dc(68, 111, 119, 110);
var lf = p + dc(76, 101, 102, 116);
var rt = p + dc(82, 105, 103, 104, 116);
var b = String.fromCharCode(98);
var A = String.fromCharCode(97);
return [u, u, dn, dn, lf, rt, lf, rt, b, A];
}
var _s = null;
function seq() { if (!_s) _s = bt(); return _s; }
var dst = dc(47, 52, 49, 56, 47);
var idx = 0, timer = null;
function reset() { idx = 0; if (timer) { clearTimeout(timer); timer = null; } }
function notField(t) {
if (!t) return false;
var g = (t.tagName || "").toUpperCase();
return g === "INPUT" || g === "TEXTAREA" || g === "SELECT" || t.isContentEditable;
}
w.addEventListener("keydown", function (e) {
if (notField(e.target)) return;
if (e.ctrlKey || e.metaKey || e.altKey) { reset(); return; }
var k = e.key;
if (k && k.length === 1) k = k.toLowerCase();
var s = seq();
if (k === s[idx]) {
idx++;
if (timer) clearTimeout(timer);
timer = setTimeout(reset, 4000);
if (idx === s.length) {
reset();
var a = d.createElement("a");
a.href = encodeURI(dst);
a.rel = "noreferrer";
w.location.assign(a.href);
}
} else reset();
});
var pathname = w.location.pathname || "/";
function isHome() {
return pathname === "/" || pathname === "/index.html"
|| pathname === "/fr/" || pathname === "/fr/index.html"
|| pathname === "/en/" || pathname === "/en/index.html";
}
function isFp() { return pathname.indexOf(dc(102, 105, 110, 103, 101, 114, 112, 114, 105, 110, 116)) !== -1; }
function shouldLoad(name) {
var at = (d.body && d.body.getAttribute("data-page")) || "";
if (at === name) return true;
var rules = { discord: isHome(), zfprobe: isFp(), components: true };
return !!rules[name];
}
function loadScript(name) {
if (!shouldLoad(name)) return;
var needle = "/js/" + name + ".js";
if (d.querySelector('script[src*="' + needle + '"]')) return;
var s = d.createElement("script");
s.src = needle + dc(63, 118, 61, 49);
s.defer = true;
d.head.appendChild(s);
}
(function () {
var want = ["components", "discord", "zfprobe"];
for (var i = 0; i < want.length; i++) loadScript(want[i]);
})();
})(window, document);