Bug 35134: Use localStorage instead of a cookie

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Lucas Gass 2025-02-25 23:22:14 +00:00 committed by Katrin Fischer
parent da66e8ac83
commit b1a326238a
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834
2 changed files with 7 additions and 5 deletions

View file

@ -39,16 +39,16 @@ function Click$function_name(ev) {
let window_height = screen.height;
q = document.getElementById(ev.data.id);
if(Cookies.get(\"popup_window_height\") && Cookies.get(\"popup_window_width\")){
window_width = Cookies.get(\"popup_window_width\");
window_height = Cookies.get(\"popup_window_height\");
if(localStorage.getItem(\"popup_window_height\") && localStorage.getItem(\"popup_window_width\")){
window_width = localStorage.getItem(\"popup_window_width\");
window_height = localStorage.getItem(\"popup_window_height\");
}
var windowref = window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=cn_browser.pl&popup&q=\"+encodeURIComponent(q.value),\"cnbrowser\",\"width=\"+window_width+\"\,height=\"+window_height+\"\,toolbar=false,scrollbars=yes\");
windowref.onresize = function(){
Cookies.set(\"popup_window_height\", windowref.innerHeight, { path: '/', sameSite: 'Lax' });
Cookies.set(\"popup_window_width\", windowref.innerWidth, { path: '/', sameSite: 'Lax' });
localStorage.setItem(\"popup_window_height\", windowref.innerHeight);
localStorage.setItem(\"popup_window_width\", windowref.innerWidth);
}
}

View file

@ -504,6 +504,8 @@ function logOut() {
localStorage.removeItem("patron_search_selections");
localStorage.removeItem("item_search_selections");
localStorage.removeItem("copiedPermissions");
localStorage.removeItem("popup_window_width");
localStorage.removeItem("popup_window_height");
// Remove DataTables states
Object.keys(localStorage).forEach(k => {