Make tag handling much more flexible
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
{% load static %}
|
||||
{% load index %}
|
||||
{% load joinsep %}
|
||||
{% include 'partials/notify.html' %}
|
||||
{% if results %}
|
||||
<div style="display: none" id="jsonData" data-json="{{ data }}">
|
||||
@@ -63,7 +64,7 @@
|
||||
{% endif %}">
|
||||
<td>
|
||||
<a class="has-text-link is-underlined"
|
||||
onclick="toggleTag('src', '{{ item.src|escapejs }}')">
|
||||
onclick="populateSearch('src', '{{ item.src|escapejs }}')">
|
||||
{% if item.src == 'irc' %}
|
||||
<span class="icon" data-tooltip="IRC">
|
||||
<i class="fa-solid fa-hashtag" aria-hidden="true"></i>
|
||||
@@ -77,7 +78,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a class="has-text-link is-underlined"
|
||||
onclick="toggleTag('type', '{{ item.type|escapejs }}')">
|
||||
onclick="populateSearch('type', '{{ item.type|escapejs }}')">
|
||||
{% if item.type == 'msg' %}
|
||||
<span class="icon" data-tooltip="Message">
|
||||
<i class="fa-solid fa-message"></i>
|
||||
@@ -122,7 +123,7 @@
|
||||
<td style="max-width: 10em" class="wrap">{{ item.msg }}</td>
|
||||
<td>
|
||||
<a class="has-text-link is-underlined"
|
||||
onclick="toggleTag('host', '{{ item.host|escapejs }}')">
|
||||
onclick="populateSearch('host', '{{ item.host|escapejs }}')">
|
||||
{{ item.host }}
|
||||
</a>
|
||||
</td>
|
||||
@@ -143,7 +144,7 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<a class="nowrap-child has-text-link is-underlined" onclick="toggleTag('nick', '{{ item.nick|escapejs }}')">
|
||||
<a class="nowrap-child has-text-link is-underlined" onclick="populateSearch('nick', '{{ item.nick|escapejs }}')">
|
||||
{{ item.nick }}
|
||||
</a>
|
||||
{% if item.num_chans is not None %}
|
||||
@@ -171,7 +172,7 @@
|
||||
<td>
|
||||
<div class="nowrap-parent">
|
||||
<a class="nowrap-child has-text-link is-underlined"
|
||||
onclick="toggleTag('channel', '{{ item.channel|escapejs }}')">
|
||||
onclick="populateSearch('channel', '{{ item.channel|escapejs }}')">
|
||||
{{ item.channel }}
|
||||
</a>
|
||||
{% if item.num_users is not None %}
|
||||
@@ -185,7 +186,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<a class="has-text-link is-underlined"
|
||||
onclick="toggleTag('net', '{{ item.net|escapejs }}')">
|
||||
onclick="populateSearch('net', '{{ item.net|escapejs }}')">
|
||||
{{ item.net }}
|
||||
</a>
|
||||
</td>
|
||||
@@ -195,4 +196,17 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# Update the tags in case the user changed the query #}
|
||||
{# Check for focus and refocus #}
|
||||
<script>
|
||||
var inputTags = document.getElementsByClassName('tags-input');
|
||||
var inputBox = document.querySelector("[placeholder='Add query']");
|
||||
var isFocused = (document.activeElement === inputBox);
|
||||
inputTags[0].outerHTML = '<input id="tags" class="input" type="tags" placeholder="Add query" value="{{ tags|joinsep:',' }}">';
|
||||
setupTags();
|
||||
var inputBox = document.querySelector("[placeholder='Add query']");
|
||||
if (isFocused) {
|
||||
inputBox.focus();
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user