fix: Properly highlight node across captures

pull/81/head
Raphaël Vinot 2020-08-08 19:09:34 +02:00
parent db8e79677e
commit 55d08e7675
3 changed files with 11 additions and 4 deletions

View File

@ -78,8 +78,12 @@ function collapse(d) {
} }
}; };
function openTreeInNewTab(treeUUID) { function openTreeInNewTab(capture_uuid, hostnode_uuid=null) {
var win = window.open('/tree/' + treeUUID, '_blank'); var url = '/tree/' + capture_uuid;
if (hostnode_uuid) {
url += '/' + hostnode_uuid;
};
var win = window.open(url, '_blank');
// FIXME: If win is None, the browser didn't allow opening a new tab, we need to inform the user. // FIXME: If win is None, the browser didn't allow opening a new tab, we need to inform the user.
win.focus(); win.focus();
} }

View File

@ -16,6 +16,9 @@
function flag(hostname_uuid) { function flag(hostname_uuid) {
window.opener.PermanentNodeHighlight(hostname_uuid); window.opener.PermanentNodeHighlight(hostname_uuid);
}; };
function openTreeInNewTab(capture_uuid, hostnode_uuid=Null) {
window.opener.openTreeInNewTab(capture_uuid, hostnode_uuid);
}
</script> </script>
<script> <script>
// Source: https://codepen.io/nathanlong/pen/ZpAmjv // Source: https://codepen.io/nathanlong/pen/ZpAmjv

View File

@ -33,7 +33,7 @@
<ul> <ul>
{% for capture_uuid, urlnode_uuid, title, hostname in details['different_url'] %} {% for capture_uuid, urlnode_uuid, title, hostname in details['different_url'] %}
<li> <li>
<a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }} <a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}', '{{ urlnode_uuid }}')">{{ title }}</a> - {{ hostname }}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
@ -47,7 +47,7 @@
<ul> <ul>
{% for capture_uuid, urlnode_uuid, title, hostname in details['same_url'] %} {% for capture_uuid, urlnode_uuid, title, hostname in details['same_url'] %}
<li> <li>
<a href="{{ url_for('tree', tree_uuid=capture_uuid, urlnode_uuid=urlnode_uuid) }}">{{ title }}</a> - {{ hostname }} <a href="#/" onclick="openTreeInNewTab('{{ capture_uuid }}', '{{ urlnode_uuid }}')">{{ title }}</a> - {{ hostname }}
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>