mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Improved Disqus integration to be non-blocking
This commit is contained in:
@@ -8,5 +8,5 @@
|
|||||||
{% if not page.is_homepage and disqus %}
|
{% if not page.is_homepage and disqus %}
|
||||||
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
||||||
<div id="disqus_thread"></div>
|
<div id="disqus_thread"></div>
|
||||||
<script>var disqus_config=function(){this.page.url="{{ page.canonical_url }}",this.page.identifier="{{ page.canonical_url | replace(config.site_url, '') }}"};!function(){var e=document,i=e.createElement("script");i.src="//{{ disqus }}.disqus.com/embed.js",i.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(i)}()</script>
|
<script>window.addEventListener("load",function(){var e,t;e=document,(t=e.createElement("script")).src="//{{ disqus }}.disqus.com/embed.js",t.setAttribute("data-timestamp",+new Date),(e.head||e.body).appendChild(t)})</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -31,16 +31,18 @@
|
|||||||
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
||||||
<div id="disqus_thread"></div>
|
<div id="disqus_thread"></div>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
var disqus_config = function () {
|
window.addEventListener("load", function() {
|
||||||
this.page.url = "{{ page.canonical_url }}";
|
var disqus_config = function () {
|
||||||
this.page.identifier =
|
this.page.url = "{{ page.canonical_url }}";
|
||||||
"{{ page.canonical_url | replace(config.site_url, '') }}";
|
this.page.identifier =
|
||||||
};
|
"{{ page.canonical_url | replace(config.site_url, '') }}";
|
||||||
(function() {
|
};
|
||||||
var d = document, s = d.createElement("script");
|
(function() {
|
||||||
s.src = "//{{ disqus }}.disqus.com/embed.js";
|
var d = document, s = d.createElement("script");
|
||||||
s.setAttribute("data-timestamp", +new Date());
|
s.src = "//{{ disqus }}.disqus.com/embed.js";
|
||||||
(d.head || d.body).appendChild(s);
|
s.setAttribute("data-timestamp", +new Date());
|
||||||
})();
|
(d.head || d.body).appendChild(s);
|
||||||
|
})();
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user