Initial commit
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
(function () {
|
||||
document.querySelectorAll(".setting-switch").forEach(function (btn) {
|
||||
btn.addEventListener("click", function () {
|
||||
var on = btn.classList.toggle("setting-switch--on");
|
||||
btn.setAttribute("aria-pressed", on ? "true" : "false");
|
||||
});
|
||||
});
|
||||
|
||||
var logoutBtn = document.querySelector("[data-auth-logout]");
|
||||
if (logoutBtn) {
|
||||
logoutBtn.addEventListener("click", function () {
|
||||
function done() {
|
||||
if (window.AuthAPI && typeof AuthAPI.markGuestLogout === "function") {
|
||||
AuthAPI.markGuestLogout();
|
||||
}
|
||||
if (window.CookieUtil && typeof CookieUtil.clearAuth === "function") {
|
||||
CookieUtil.clearAuth();
|
||||
}
|
||||
try {
|
||||
document.dispatchEvent(new CustomEvent("auth:logout"));
|
||||
} catch (e) {}
|
||||
window.location.href = "/";
|
||||
}
|
||||
|
||||
if (window.HttpRequest) {
|
||||
HttpRequest.post("/api/auth/logout", {})
|
||||
.catch(function () {})
|
||||
.then(done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user