20 lines
754 B
JavaScript
20 lines
754 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=Thu, 01 Jan 1970 00:00:00 GMT;";
|
|
} 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=Thu, 01 Jan 1970 00:00:00 GMT;";
|
|
} else {
|
|
document.cookie = "Remote=true;samesite=strict;path=/;";
|
|
}
|
|
}
|