summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/query_opts.js9
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;
}