osvaldasvalutis / disqusloader.js Goto Github PK
View Code? Open in Web Editor NEWA JavaScript plugin for lazy-loading Disqus comments widget.
Home Page: https://css-tricks.com/lazy-loading-disqus-comments
License: MIT License
A JavaScript plugin for lazy-loading Disqus comments widget.
Home Page: https://css-tricks.com/lazy-loading-disqus-comments
License: MIT License
I can not connect
I do not quite understand the process of connecting the disqusLoade plugin,
What am I doing wrong?
Original code
https://jsfiddle.net/dokxpi/a0uwgm8f/6
<div id="disqus_thread"></div>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://ochatik-github-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Пожалуйста, включите JavaScript для просмотра комментариев</a></noscript>
Connecting disqusLoader.js (added disqusLoader.js to the root directory)
<div class="disqus"></div>
<script src="disqusloader.js"></script>
<script>
// vanilla
disqusLoader( '.disqus', { scriptUrl: '//username.disqus.com/embed.js' });
// jQuery
$.disqusLoader( '.disqus', { scriptUrl: '//username.disqus.com/embed.js' });</script>
<script>
/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables*/
/*
var disqus_config = function () {
this.page.url = PAGE_URL; // Replace PAGE_URL with your page's canonical URL variable
this.page.identifier = PAGE_IDENTIFIER; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
};
*/
(function() { // DON'T EDIT BELOW THIS LINE
var d = document, s = d.createElement('script');
s.src = 'https://ochatik-github-io.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Пожалуйста, включите JavaScript для просмотра комментариев</a></noscript>
What am I doing wrong? I can not connect
First of all, thanks for a great repo! I had no idea Disqus embeds bundled so much JS & CSS.
I noticed that scroll & resize event listeners aren't removed on Disqus initialization. I imagine the performance impact is minimal, but it'd still be best practice to remove them. If you'd like, I'd be happy to submit a PR.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.