2023-03-22 17:22:07 +03:00
|
|
|
<!-- The Disqus lazy loading. -->
|
2023-09-08 17:48:37 +03:00
|
|
|
|
|
|
|
<div id="disqus_thread" class="mb-5">
|
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 }}';
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Lazy loading */
|
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
|
|
|
|
2021-09-14 15:45:17 +03:00
|
|
|
disqus_observer.observe(document.querySelector('#disqus_thread'));
|
|
|
|
|
|
|
|
/* Auto switch theme */
|
|
|
|
function reloadDisqus() {
|
2023-03-22 17:22:07 +03:00
|
|
|
if (event.source === window && event.data && event.data.direction === ModeToggle.ID) {
|
2022-11-22 13:33:04 +03:00
|
|
|
/* Disqus hasn't been loaded */
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-22 17:22:07 +03:00
|
|
|
if (document.querySelector('.mode-toggle')) {
|
|
|
|
window.addEventListener('message', reloadDisqus);
|
2021-09-14 15:45:17 +03:00
|
|
|
}
|
2021-01-18 18:27:43 +03:00
|
|
|
</script>
|