chg: shorten_string can return a div with title

pull/136/head
Raphaël Vinot 2020-12-10 11:56:44 +01:00
parent cff9962013
commit 603303560a
3 changed files with 22 additions and 4 deletions

View File

@ -64,7 +64,7 @@ $(document).ready(function () {
<tr>
<td>
<p title="{{ page_title }}"><a href="{{ url_for('tree', tree_uuid=uuid) }}">{{ page_title }}</a></p>
<p title="{{ url }}">{{ shorten_string(url, 150) }}</p>
{{ shorten_string(url, 50, with_title=True) }}
</td>
<td>{{ datetime }}</td>
<td>

View File

@ -281,10 +281,19 @@
</div>
{% endmacro %}
{% macro shorten_string(string, cut_length) %}
{% macro shorten_string(string, cut_length, with_title=False) %}
{% if with_title %}
<div title={{string}}>
{%endif%}
{% if string|length > cut_length %}
{{ string[:cut_length] }} [...]
{% else %}
{{ string }}
{%endif%}
{% if with_title %}
</div>
{%endif%}
{% endmacro %}

View File

@ -1,9 +1,15 @@
{% from "macros.html" import shorten_string %}
<div>
{% if vt %}
<center><h1 class="display-4">Virus Total</h1></center>
{% for url, entries in vt.items() %}
<div class="border-top my-3"></div>
<center><h3><small class="text-muted">URL</small><br>{{ url }}</h3></center>
<center>
<h3><small class="text-muted">URL</small>
{{ shorten_string(url, 50, with_title=True) }}
</h3>
</center>
{% if entries['malicious'] %}
<center>
<p class="lead">Detected as malicious by the following vendors</p>
@ -23,7 +29,10 @@
{% if pi%}
<center><h1 class="display-4">Phishing Initiative</h1></center>
{% for url, tag in pi.items() %}
<center><h3><small class="text-muted">URL</small><br>{{ url }}</h3>
<center>
<h3><small class="text-muted">URL</small>
{{ shorten_string(url, 50, with_title=True) }}
</h3>
<div>This URL is tagged as <b>{{ tag }}</b> on Phishing Initiative</div>
</center>
{% endfor %}