From 0601f2bb481758ed8e0e68f96a976063d9b229db Mon Sep 17 00:00:00 2001 From: Marc Abonce Seguin Date: Mon, 3 Aug 2020 00:15:54 -0700 Subject: add toggle to resize infobox --- searx/static/themes/oscar/js/searx_src/infobox.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 searx/static/themes/oscar/js/searx_src/infobox.js (limited to 'searx/static/themes/oscar/js/searx_src') diff --git a/searx/static/themes/oscar/js/searx_src/infobox.js b/searx/static/themes/oscar/js/searx_src/infobox.js new file mode 100644 index 000000000..0c80bf37b --- /dev/null +++ b/searx/static/themes/oscar/js/searx_src/infobox.js @@ -0,0 +1,11 @@ +$(document).ready(function() { + // Hide infobox toggle if shrunk size already fits all content. + $('.infobox').each(function() { + var infobox_body = $(this).find('.infobox_body'); + var total_height = infobox_body.prop('scrollHeight') + infobox_body.find('img.infobox_part').height(); + var max_height = infobox_body.css('max-height').replace('px', ''); + if (total_height <= max_height) { + $(this).find('.infobox_toggle').hide(); + } + }); +}); -- cgit v1.2.3