Fedi.CrowdedGames.Group/JS/setting.js

20 lines
732 B
JavaScript

let LocalButton = document.getElementsByClassName("Local")[0];
let RemoteButton = document.getElementsByClassName("Remote")[0];
LocalButton.onclick = (event) => {
// Toggle the cookie
if (document.cookie.split(";").some((item) => item.trim().startsWith("Local="))) {
document.cookie = "Local=true;samesite=strict;path=/;expires=expires=0000-01-01;";
} else {
document.cookie = "Local=true;samesite=strict;path=/;";
}
}
RemoteButton.onclick = (event) => {
// Toggle the cookie
if (document.cookie.split(";").some((item) => item.trim().startsWith("Remote="))) {
document.cookie = "Remote=true;samesite=strict;path=/;expires=expires=0000-01-01;";
} else {
document.cookie = "Remote=true;samesite=strict;path=/;";
}
}