diff options
author | dweller <dweller@cabin.digital> | 2024-03-05 23:50:29 +0200 |
---|---|---|
committer | dweller <dweller@cabin.digital> | 2024-03-05 23:50:29 +0200 |
commit | 3eb27535646fd45a61365870f4ed8a65dd1f02ec (patch) | |
tree | 45bc1f4e563ca8e3f4c29d7bd11bda100c648e32 /js/query_opts.js | |
parent | 98cc28af8d4cb81a7070ba0d43e2254eae073d01 (diff) |
hide query options (-s -S). fml that took some work, esp. on iOS
Diffstat (limited to 'js/query_opts.js')
-rw-r--r-- | js/query_opts.js | 9 |
1 files changed, 5 insertions, 4 deletions
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; } |