Fixed announcement bar dismissal when using instant loading

This commit is contained in:
squidfunk 2023-09-02 16:39:05 +02:00
parent 6e1c658a9d
commit 76a30ecab2
No known key found for this signature in database
GPG Key ID: 5ED40BC4F9C436DF
4 changed files with 18 additions and 9 deletions

View File

@ -250,7 +250,7 @@
</script> </script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ 'assets/javascripts/bundle.78eede0e.min.js' | url }}"></script> <script src="{{ 'assets/javascripts/bundle.fa3e4f16.min.js' | url }}"></script>
{% for script in config.extra_javascript %} {% for script in config.extra_javascript %}
{{ script | script_tag }} {{ script | script_tag }}
{% endfor %} {% endfor %}

View File

@ -28,6 +28,8 @@ import {
finalize, finalize,
fromEvent, fromEvent,
map, map,
mergeWith,
of,
tap tap
} from "rxjs" } from "rxjs"
@ -82,6 +84,13 @@ export function mountAnnounce(
if (!feature("announce.dismiss") || !el.childElementCount) if (!feature("announce.dismiss") || !el.childElementCount)
return EMPTY return EMPTY
/* Support instant loading - see https://t.ly/3FTme */
if (!el.hidden) {
const content = getElement(".md-typeset", el)
if (__md_hash(content.innerHTML) === __md_get("__announce"))
el.hidden = true
}
/* Mount component on subscription */ /* Mount component on subscription */
return defer(() => { return defer(() => {
const push$ = new Subject<Announce>() const push$ = new Subject<Announce>()