Compare commits
No commits in common. "2b2edc7505f54d5d66b958ce2e4d900480f05ef5" and "69119f347de8ca1b42fb57259457247f9eb41f39" have entirely different histories.
2b2edc7505
...
69119f347d
2 changed files with 3 additions and 24 deletions
|
|
@ -80,29 +80,6 @@
|
||||||
function boot() {
|
function boot() {
|
||||||
initScrollReveal();
|
initScrollReveal();
|
||||||
initCursorGlow();
|
initCursorGlow();
|
||||||
initCusdisReload();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Re-initialize Cusdis comment widget after Zensical instant-navigation
|
|
||||||
* page transitions (XHR-based SPA navigation). Without this, the widget
|
|
||||||
* only renders on hard-refresh / initial page load.
|
|
||||||
*/
|
|
||||||
function initCusdisReload() {
|
|
||||||
if (typeof document$ === "undefined") return; // not in Zensical context
|
|
||||||
|
|
||||||
document$.subscribe(function () {
|
|
||||||
var el = document.getElementById("cusdis_thread");
|
|
||||||
if (!el) return;
|
|
||||||
|
|
||||||
// Clear stale Cusdis iframe from previous page render
|
|
||||||
el.innerHTML = "";
|
|
||||||
|
|
||||||
// Re-create Cusdis widget for the new page
|
|
||||||
if (window.CUSDIS && typeof window.CUSDIS.renderTo === "function") {
|
|
||||||
window.CUSDIS.renderTo(el);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (document.readyState === "loading") {
|
if (document.readyState === "loading") {
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
{% if page.meta.comments %}
|
||||||
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
||||||
<div id="cusdis_thread"
|
<div id="cusdis_thread"
|
||||||
data-host="{{ config.extra.cusdis.host }}"
|
data-host="{{ config.extra.cusdis.host }}"
|
||||||
|
|
@ -9,3 +10,4 @@
|
||||||
</div>
|
</div>
|
||||||
<script async defer src="{{ config.extra.cusdis.host }}/js/cusdis.es.js"></script>
|
<script async defer src="{{ config.extra.cusdis.host }}/js/cusdis.es.js"></script>
|
||||||
<noscript>Please enable JavaScript to view the comments.</noscript>
|
<noscript>Please enable JavaScript to view the comments.</noscript>
|
||||||
|
{% endif %}
|
||||||
Loading…
Reference in a new issue