Merge pull request #312 from lioman/improve-stork-loading
Improve stork loading
This commit is contained in:
commit
fe34dfed6f
2 changed files with 9 additions and 7 deletions
|
@ -23,7 +23,7 @@
|
||||||
</form>
|
</form>
|
||||||
{% elif 'pelican.plugins.search' in PLUGINS %}
|
{% elif 'pelican.plugins.search' in PLUGINS %}
|
||||||
<div class="stork">
|
<div class="stork">
|
||||||
<input class="stork-input" type="text" autocomplete="off" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}"/>
|
<input class="stork-input" type="text" autocomplete="off" name="q" data-stork="sitesearch" placeholder="{{ _('Search...') }}" onclick="loadStorkIndex()"/>
|
||||||
<div class="stork-output" data-stork="sitesearch-output"></div>
|
<div class="stork-output" data-stork="sitesearch-output"></div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
{% if 'pelican.plugins.search' in PLUGINS %}
|
{% if 'pelican.plugins.search' in PLUGINS %}
|
||||||
|
<script>
|
||||||
|
window.loadStorkIndex = function () {
|
||||||
|
{% if not STORK_VERSION %}
|
||||||
|
stork.initialize("{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork.wasm")
|
||||||
|
{% endif %}
|
||||||
|
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", { showProgress: false });
|
||||||
|
}
|
||||||
|
</script>
|
||||||
{% if STORK_VERSION %}
|
{% if STORK_VERSION %}
|
||||||
<script src="https://files.stork-search.net/releases/v{{ STORK_VERSION }}/stork.js"></script>
|
<script src="https://files.stork-search.net/releases/v{{ STORK_VERSION }}/stork.js"></script>
|
||||||
<script>
|
|
||||||
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false});
|
|
||||||
</script>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork.js"></script>
|
<script src="{{ SITEURL }}/{{ THEME_STATIC_DIR }}/stork/stork.js"></script>
|
||||||
<script>
|
|
||||||
stork.register("sitesearch", "{{ SITEURL }}/search-index.st", {showProgress: false});
|
|
||||||
</script>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
Loading…
Reference in a new issue