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