themes: use noscript for search js notification

The "search.html" template will generate a warning admonition about
requiring JavaScript for search and automatically hiding the element
when supported. While functional, if a client renders the page slowly,
the warning notification may be visible to the user for a moment.

Instead of relying on JavaScript to suppress this warning, use a
`noscript` tag to hide the warning for clients who do not support
JavaScript. This also has the benefit of one less JavaScript call
required by a client.

Signed-off-by: James Knight <james.d.knight@live.com>
This commit is contained in:
James Knight 2021-09-06 23:44:35 -04:00 committed by Takeshi KOMIYA
parent 293beecc06
commit e01d914dbd

View File

@ -21,13 +21,14 @@
{% block body %}
<h1 id="search-documentation">{{ _('Search') }}</h1>
{% block scriptwarning %}
<div id="fallback" class="admonition warning">
<script>$('#fallback').hide();</script>
<noscript>
<div class="admonition warning">
<p>
{% trans %}Please activate JavaScript to enable the search
functionality.{% endtrans %}
</p>
</div>
</noscript>
{% endblock %}
{% block searchtext %}
<p>