From 67d274f502aa2d4d83b631987acc96a59f9ffe12 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 23 Apr 2024 12:11:59 +0000 Subject: [PATCH] Bug 35134: [Alternative] Save popup size to cookies and use that instead Follow the original test-plan, open the pop-up and resize to whatever size. Close the pop-up, open again, notice it opens to the same size it was previously closed. Signed-off-by: David Nind --- cataloguing/value_builder/cn_browser.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cataloguing/value_builder/cn_browser.pl b/cataloguing/value_builder/cn_browser.pl index 881103c8f8..364f32a922 100755 --- a/cataloguing/value_builder/cn_browser.pl +++ b/cataloguing/value_builder/cn_browser.pl @@ -38,7 +38,18 @@ function Click$function_name(ev) { let window_width = screen.width / 2; let window_height = screen.height; q = document.getElementById(ev.data.id); - 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\"); + + 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\"); + } + + 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' }); + } } -- 2.39.2