Fixed search index being loaded when search is disabled

This commit is contained in:
squidfunk 2021-03-04 18:28:34 +01:00
parent f05c34e30d
commit 5a510cedb3
5 changed files with 18 additions and 16 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -217,7 +217,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.da29d79a.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.9b151c6a.min.js' | url }}"></script>
{% for path in config["extra_javascript"] %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -21,7 +21,7 @@
*/
import "focus-visible"
import { Subject, defer, merge } from "rxjs"
import { NEVER, Subject, defer, merge } from "rxjs"
import {
delay,
filter,
@ -91,11 +91,13 @@ const tablet$ = watchMedia("(min-width: 960px)")
const screen$ = watchMedia("(min-width: 1220px)")
const print$ = watchPrint()
/* Retrieve search index */
/* Retrieve search index, if search is enabled */
const config = configuration()
const index$ = __search?.index || requestJSON<SearchIndex>(
const index$ = document.forms.namedItem("search")
? __search?.index || requestJSON<SearchIndex>(
`${config.base}/search/search_index.json`
)
: NEVER
/* Set up Clipboard.js integration */
const alert$ = new Subject<string>()