51 lines
2.1 KiB
JavaScript
51 lines
2.1 KiB
JavaScript
/*
|
|
* Logo da sidebar (`#sidebar-brand-link`, presente em todo shell) — link de
|
|
* verdade pra `portal.html` (tela Principal). Fora do tema sazonal
|
|
* Halloween: os olhos do ícone piscam antes de navegar
|
|
* (`.pid-icon-eye`/`pidIconBlink` em base.css, 200ms), navegação adiada só o
|
|
* suficiente pra a piscada terminar de tocar. Durante o Halloween
|
|
* (`pidIsHalloweenActive()`, seasonal-theme.js): o ícone/assinatura viram o
|
|
* vampiro (`pidApplyVampireIcon`/`pidApplyVampireFull`) e o clique dispara a
|
|
* animação de "susto" (`pidTriggerVampireScare`, `.is-scaring` em base.css)
|
|
* em vez da piscada, com a navegação adiada o suficiente pra ela ser vista.
|
|
* ctrl/cmd/shift/clique do meio continuam abrindo em nova aba normalmente
|
|
* (não intercepta esses casos).
|
|
*/
|
|
document.addEventListener("DOMContentLoaded", () => {
|
|
const brand = document.getElementById("sidebar-brand-link");
|
|
if (!brand) return;
|
|
|
|
const halloween = typeof pidIsHalloweenActive === "function" && pidIsHalloweenActive();
|
|
|
|
if (halloween) {
|
|
pidApplyVampireIcon(brand.querySelector(".sidebar__logo--icon"));
|
|
pidApplyVampireFull(brand.querySelector(".sidebar__logo--full"));
|
|
if (typeof pidApplySeasonalFavicon === "function") pidApplySeasonalFavicon();
|
|
// Container só existe em portal.html (#pw-cobwebs-portal) — no-op nos demais shells.
|
|
if (typeof pidApplyHalloweenCobwebs === "function") pidApplyHalloweenCobwebs("pw-cobwebs-portal");
|
|
}
|
|
|
|
brand.addEventListener("click", (event) => {
|
|
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
event.preventDefault();
|
|
|
|
if (halloween) {
|
|
pidTriggerVampireScare(brand);
|
|
setTimeout(() => {
|
|
window.location.href = brand.getAttribute("href");
|
|
}, PID_HALLOWEEN_SCARE_MS - 100);
|
|
return;
|
|
}
|
|
|
|
brand.querySelectorAll(".pid-icon-eye").forEach((eye) => {
|
|
eye.classList.remove("is-blinking");
|
|
void eye.getBoundingClientRect();
|
|
eye.classList.add("is-blinking");
|
|
});
|
|
|
|
setTimeout(() => {
|
|
window.location.href = brand.getAttribute("href");
|
|
}, 260);
|
|
});
|
|
});
|