diff --git a/var/www/static/css/ail-project.css b/var/www/static/css/ail-project.css index 653d4ea5..21b4aaaf 100644 --- a/var/www/static/css/ail-project.css +++ b/var/www/static/css/ail-project.css @@ -18,3 +18,11 @@ font-size: 16px; pointer-events: none; } + +.text-collapse { + overflow: hidden; + display: block; + max-height: 3em; + line-height: 1.5em; + transition: max-height 0.3s ease-in-out; +} diff --git a/var/www/templates/hunter/tracker_show.html b/var/www/templates/hunter/tracker_show.html index 40510305..2639b843 100644 --- a/var/www/templates/hunter/tracker_show.html +++ b/var/www/templates/hunter/tracker_show.html @@ -8,6 +8,7 @@ + @@ -219,7 +220,7 @@ {% if rule_content %}
Yara Rule:

-

{{ rule_content }}
+
{{ rule_content }}

{% endif %} @@ -379,6 +380,7 @@ $('#div_edit_tags').hide(); $('#div_edit_description').hide(); $("#page-Tracker").addClass("active"); + text_collapse(); $('#date-range-from').dateRangePicker({ separator: ' to ', @@ -437,6 +439,29 @@ } } + function text_collapse() { + const textElements = document.querySelectorAll(".text-collapse"); + + textElements.forEach((textElement) => { + console.log(textElements) + const lineHeight = parseFloat(window.getComputedStyle(textElement).lineHeight); + const maxLines = 30; + const maxHeight = lineHeight * maxLines; + + // Apply initial truncation + textElement.style.maxHeight = maxHeight + 'px'; + + // Hover effect + textElement.addEventListener("mouseenter", () => { + textElement.style.maxHeight = 'none'; + }); + + textElement.addEventListener("mouseleave", () => { + textElement.style.maxHeight = maxHeight + 'px'; + }); + }); + } + function edit_tags() { $('#div_edit_mails').hide(); $('#div_edit_description').hide();