2023-03-22 17:22:07 +03:00
|
|
|
<!-- The Disqus lazy loading. -->
|
2023-09-08 17:48:37 +03:00
|
|
|
|
2023-09-17 22:26:02 +03:00
|
|
|
<div id="disqus_thread">
|
2023-03-22 17:22:07 +03:00
|
|
|
<p class="text-center text-muted small">Comments powered by <a href="https://disqus.com/">Disqus</a>.</p>
|
2019-09-30 15:38:41 +03:00
|
|
|
</div>
|
|
|
|
|
2021-09-14 15:45:17 +03:00
|
|
|
<script type="text/javascript">
|
|
|
|
var disqus_config = function () {
|
|
|
|
this.page.url = '{{ page.url | absolute_url }}';
|
|
|
|
this.page.identifier = '{{ page.url }}';
|
|
|
|
};
|
|
|
|
|
2024-04-28 22:25:26 +03:00
|
|
|
{%- comment -%} Lazy loading {%- endcomment -%}
|
2023-03-22 17:22:07 +03:00
|
|
|
var disqus_observer = new IntersectionObserver(
|
|
|
|
function (entries) {
|
|
|
|
if (entries[0].isIntersecting) {
|
2021-09-14 15:45:17 +03:00
|
|
|
(function () {
|
2023-03-22 17:22:07 +03:00
|
|
|
var d = document,
|
|
|
|
s = d.createElement('script');
|
|
|
|
s.src = 'https://{{ site.comments.disqus.shortname }}.disqus.com/embed.js';
|
|
|
|
s.setAttribute('data-timestamp', +new Date());
|
|
|
|
(d.head || d.body).appendChild(s);
|
2021-09-14 15:45:17 +03:00
|
|
|
})();
|
|
|
|
|
|
|
|
disqus_observer.disconnect();
|
2023-03-22 17:22:07 +03:00
|
|
|
}
|
|
|
|
},
|
|
|
|
{ threshold: [0] }
|
|
|
|
);
|
2019-09-30 15:38:41 +03:00
|
|
|
|
2024-04-17 01:10:01 +03:00
|
|
|
disqus_observer.observe(document.getElementById('disqus_thread'));
|
2021-09-14 15:45:17 +03:00
|
|
|
|
2024-04-28 22:25:26 +03:00
|
|
|
{%- comment -%} Auto switch theme {%- endcomment -%}
|
2021-09-14 15:45:17 +03:00
|
|
|
function reloadDisqus() {
|
2023-03-22 17:22:07 +03:00
|
|
|
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
2024-04-28 22:25:26 +03:00
|
|
|
{%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
|
2023-03-22 17:22:07 +03:00
|
|
|
if (typeof DISQUS === 'undefined') {
|
2022-11-22 13:33:04 +03:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (document.readyState == 'complete') {
|
|
|
|
DISQUS.reset({ reload: true, config: disqus_config });
|
|
|
|
}
|
2021-09-14 15:45:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-17 01:10:01 +03:00
|
|
|
if (document.getElementById('mode-toggle')) {
|
2023-03-22 17:22:07 +03:00
|
|
|
window.addEventListener('message', reloadDisqus);
|
2021-09-14 15:45:17 +03:00
|
|
|
}
|
2021-01-18 18:27:43 +03:00
|
|
|
</script>
|