cross-reader/templates/results.html

105 lines
2.4 KiB
HTML
Raw Normal View History

2019-07-10 21:19:51 +02:00
{% extends "base.html" %}
{% block title %}- {{ query }}{% endblock %}
{% block printbutton %}
<div id="print" class="{{ connection }}">
<a href="?q={{ query }}&print=now"><button></button></a>
</div>
<script>
(function () {
var printing = false,
button = document.querySelector('#print button');
button.addEventListener('click', function (e) {
if (!printing) {
printing = true;
button.classList.add('printing');
}
else {
e.preventDefault();
alert('Already printing ...');
}
})
})();
</script>
{% endblock %}
{% block results %}
{% if results == {} %}
<div id="notused">
This word could not be found.
<br>
<br>
<div>
Please note that ...
<br>
<br>
... the cross-reader can only search for one word
<br>
... "-" or "_" are understood as spaces
<br>
... search results are not case sensitive
</div>
</div>
{% else %}
<div id="results">
<h1>Cross-readings along the axes of <strong class="query">{{ query }}</strong>:</h1>
<div class="results">
{% for x, manifesto in results.items() %}
{% for sentence in manifesto.html %}
<div id="{{ x }}_{{ loop.index }}" class="result">
<div class="title">
{{ manifesto.name }}
2019-07-10 21:19:51 +02:00
<div><a class="contrast" href="/mapping/{{ manifesto.filename }}"></a></div>
</div>
<div class="sentence">{{ sentence }}</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
{% endif %}
{% endblock %}
{% if analytics %}
{% block suggestions %}
<div id="suggestions">
<br>
<br>
<br>
<br>
<h1>SUGGESTIONS</h1>
{% if analytics.stemmer %}
<div id="similars" class="analytics stemmer">
<h2>Similar but not the same to <em>{{ query }}</em>:</h2>
{% for word in analytics.stemmer %}
2019-07-10 21:19:51 +02:00
<strong class="word"><a href="/?q={{ word }}">{{ word }}</a></strong>
{% endfor%}
</div>
<br>
{% endif%}
{% if analytics.suggestions %}
<div class="suggestions tfidf">
<h1>Also specific to <em>{{ results[0]['name'] }}</em>: <br></h1>
<div class="">
{% for word, idf in analytics.suggestions %}
{% if loop.index < 50 %}
{% if word == query %}
<strong class="word">{{ word }}</strong>
{% else %}
2019-07-10 21:19:51 +02:00
<strong class="word"><a href="/?q={{ word }}">{{ word }}</a></strong>
{% endif%}
{% endif%}
{% endfor%}
</div>
<br>
<br>
</div>
{% else %}
<div>None</div>
{% endif%}
</div>
{% endblock %}
{% endif%}