chg: Open related tree in new tab.

pull/81/head
Raphaël Vinot 2020-08-07 18:01:06 +02:00
parent ed8ad7b945
commit db8e79677e
3 changed files with 20 additions and 2 deletions

View File

@ -78,6 +78,12 @@ function collapse(d) {
} }
}; };
function openTreeInNewTab(treeUUID) {
var win = window.open('/tree/' + treeUUID, '_blank');
// FIXME: If win is None, the browser didn't allow opening a new tab, we need to inform the user.
win.focus();
}
function urlnode_click(d) { function urlnode_click(d) {
var url = "/tree/url/" + d.data.uuid; var url = "/tree/url/" + d.data.uuid;
d3.blob(url, {credentials: 'same-origin'}).then(data => { d3.blob(url, {credentials: 'same-origin'}).then(data => {

View File

@ -14,6 +14,12 @@
}); });
</script> </script>
<script type="text/javascript">
function openTreeInNewTab(treeUUID) {
window.opener.openTreeInNewTab(treeUUID);
};
</script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
@ -50,7 +56,7 @@
<p>The same file was seen in these captures:</p> <p>The same file was seen in these captures:</p>
<ul> <ul>
{% for capture_uuid, title in captures %} {% for capture_uuid, title in captures %}
<li><a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">{{ title }}</a></li> <li><a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}')">{{ title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}

View File

@ -14,6 +14,12 @@
}); });
</script> </script>
<script type="text/javascript">
function openTreeInNewTab(treeUUID) {
window.opener.openTreeInNewTab(treeUUID);
};
</script>
{% endblock %} {% endblock %}
{% block styles %} {% block styles %}
@ -58,7 +64,7 @@
<p>A cookie with that name was seen in these captures:</p> <p>A cookie with that name was seen in these captures:</p>
<ul> <ul>
{% for capture_uuid, title in captures %} {% for capture_uuid, title in captures %}
<li><a href="{{ url_for('tree', tree_uuid=capture_uuid) }}">{{ title }}</a></li> <li><a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}')">{{ title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endblock %} {% endblock %}