mirror of
https://github.com/AdaCore/spark2014.git
synced 2026-02-12 12:39:11 -08:00
- rename shared_images to shared/images - move some files to shared/ (or subfolders) in both lrm and ug: - adapt to use new shared locations - copy some shared files in setup step - configure new search template and custom css in conf.py
96 lines
2.5 KiB
HTML
96 lines
2.5 KiB
HTML
{%- extends "!search.html" %}
|
|
{% set title = _('Search') %}
|
|
{% set display_vcs_links = False %}
|
|
|
|
{% block content %}
|
|
<!-- Surround search results with div. Only the right result div will
|
|
be shown. -->
|
|
<div id="rtd-block-content">
|
|
{{ super() }}
|
|
</div>
|
|
|
|
<div id="pagefind-block-content">
|
|
<h1>{{ _("Search") }}</h1>
|
|
<div id="search"></div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{%- block scripts %}
|
|
{{ super() }}
|
|
|
|
<script>
|
|
// pagefind requires dynamic imports to work properly. This is only possible
|
|
// for served page to respect the Cross-Origin Resource Sharing (CORS).
|
|
if (window.location.protocol !== "file:") {
|
|
var script = document.createElement('script');
|
|
script.src = 'pagefind/pagefind-ui.js';
|
|
script.onload = function () {
|
|
function setupSearch() {
|
|
new PagefindUI({
|
|
element: "#search",
|
|
showSubResults: true,
|
|
highlightParam: "highlight",
|
|
showImages: false,
|
|
});
|
|
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const query = urlParams.get('q');
|
|
const searchInputElement = document.querySelector("#search form[role=search] input");
|
|
|
|
const inputChangeEvent = new Event('input');
|
|
searchInputElement.value = query;
|
|
searchInputElement?.dispatchEvent(inputChangeEvent);
|
|
searchInputElement?.focus();
|
|
}
|
|
|
|
if (document.readyState === "loading") {
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
setupSearch();
|
|
});
|
|
} else {
|
|
setupSearch();
|
|
}
|
|
}
|
|
|
|
document.head.appendChild(script);
|
|
}
|
|
</script>
|
|
{%- endblock %}
|
|
{% block footer %}
|
|
{{ super() }}
|
|
<script>
|
|
// Embedded Sphinx search is enabled only if pagefind does not work
|
|
if (window.location.protocol !== "file:") {
|
|
$("#rtd-block-content").hide();
|
|
} else {
|
|
$("#pagefind-block-content").hide();
|
|
}
|
|
|
|
</script>
|
|
{% endblock %}
|
|
|
|
{% block body %}
|
|
{{ super() }}
|
|
{% endblock %}
|
|
|
|
{% block extra_styles -%}
|
|
{{ super() }}
|
|
<style type="text/css">
|
|
#search form input[type="text"] {
|
|
box-sizing: border-box;
|
|
width: 100%;
|
|
line-height: 2em;
|
|
padding-inline: 0.6em;
|
|
font-size: 1.2rem;
|
|
border-radius: 0.25rem;
|
|
border: 2px solid var(--color-foreground-border);
|
|
border-bottom-color: 2px solid var(--color-foreground-secondary);
|
|
transition: border-color 20ms ease;
|
|
}
|
|
|
|
#search form input[type="text"]:focus {
|
|
border-color: var(--color-foreground-primary);
|
|
}
|
|
</style>
|
|
{%- endblock extra_styles %}
|