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:
parent
355a1cacd5
commit
96f58edae6
@ -8,5 +8,5 @@
|
||||
{% if not page.is_homepage and disqus %}
|
||||
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
||||
<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 %}
|
||||
|
@ -31,16 +31,18 @@
|
||||
<h2 id="__comments">{{ lang.t("meta.comments") }}</h2>
|
||||
<div id="disqus_thread"></div>
|
||||
<script type="application/javascript">
|
||||
var disqus_config = function () {
|
||||
this.page.url = "{{ page.canonical_url }}";
|
||||
this.page.identifier =
|
||||
"{{ page.canonical_url | replace(config.site_url, '') }}";
|
||||
};
|
||||
(function() {
|
||||
var d = document, s = d.createElement("script");
|
||||
s.src = "//{{ disqus }}.disqus.com/embed.js";
|
||||
s.setAttribute("data-timestamp", +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
window.addEventListener("load", function() {
|
||||
var disqus_config = function () {
|
||||
this.page.url = "{{ page.canonical_url }}";
|
||||
this.page.identifier =
|
||||
"{{ page.canonical_url | replace(config.site_url, '') }}";
|
||||
};
|
||||
(function() {
|
||||
var d = document, s = d.createElement("script");
|
||||
s.src = "//{{ disqus }}.disqus.com/embed.js";
|
||||
s.setAttribute("data-timestamp", +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
})();
|
||||
})
|
||||
</script>
|
||||
{% endif %}
|
||||
|
Loading…
Reference in New Issue
Block a user