one cookie set function, for consistent samesite/path/expires

This commit is contained in:
Shish
2023-12-26 02:36:51 +00:00
parent 532dbdc751
commit e5c8bf7b18
9 changed files with 34 additions and 27 deletions

View File

@ -24,7 +24,7 @@ document.addEventListener('DOMContentLoaded', () => {
$(".shm-zoomer").val(zoom_type);
if (save_cookie) {
Cookies.set("ui-image-zoom", zoom_type, {expires: 365});
shm_cookie_set("ui-image-zoom", zoom_type, {expires: 365, samesite: "lax", path: "/"});
}
}
@ -38,13 +38,13 @@ document.addEventListener('DOMContentLoaded', () => {
});
$("img.shm-main-image").click(function(e) {
switch(Cookies.get("ui-image-zoom")) {
switch(shm_cookie_get("ui-image-zoom")) {
case "full": zoom("width"); break;
default: zoom("full"); break;
}
});
if(Cookies.get("ui-image-zoom")) {
zoom(Cookies.get("ui-image-zoom"));
if(shm_cookie_get("ui-image-zoom")) {
zoom(shm_cookie_get("ui-image-zoom"));
}
});