From 3eb27535646fd45a61365870f4ed8a65dd1f02ec Mon Sep 17 00:00:00 2001 From: dweller Date: Tue, 5 Mar 2024 23:50:29 +0200 Subject: hide query options (-s -S). fml that took some work, esp. on iOS --- js/query_opts.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'js/query_opts.js') diff --git a/js/query_opts.js b/js/query_opts.js index ba88787..64f917f 100644 --- a/js/query_opts.js +++ b/js/query_opts.js @@ -6,8 +6,7 @@ */ -const min_width = 20; -const rpad = 15; +let min_width = 20; const tmp = document.getElementById('js_tmp'); const opts = new Array(document.getElementById('sect'), @@ -18,11 +17,13 @@ function fix_width(e) let style = window.getComputedStyle(e, null); let font_sz = parseFloat(style.getPropertyValue('font-size')); + let txt = e.options[e.selectedIndex].text; + tmp.style.fontSize = font_sz + "px"; - tmp.innerHTML = e.options[e.selectedIndex].text; + tmp.innerHTML = txt + '#'; let tmp_width = parseFloat(window.getComputedStyle(tmp, null).width); - let width = (min_width + tmp_width + (tmp_width > 0 ? rpad : 0)) + "px"; + let width = (min_width + tmp_width) + "px"; e.style.width = width; } -- cgit v1.2.3