41 lines
1.7 KiB
JavaScript
41 lines
1.7 KiB
JavaScript
var disqus_url = embedVars.disqusUrl;
|
|
var disqus_identifier = embedVars.disqusIdentifier;
|
|
var disqus_container_id = 'disqus_thread';
|
|
var disqus_shortname = embedVars.disqusShortname;
|
|
var disqus_title = embedVars.disqusTitle;
|
|
var disqus_config_custom = window.disqus_config;
|
|
var disqus_config = function () {
|
|
/*
|
|
All currently supported events:
|
|
onReady: fires when everything is ready,
|
|
onNewComment: fires when a new comment is posted,
|
|
onIdentify: fires when user is authenticated
|
|
*/
|
|
var dsqConfig = embedVars.disqusConfig;
|
|
this.page.integration = dsqConfig.integration;
|
|
this.page.remote_auth_s3 = dsqConfig.remote_auth_s3;
|
|
this.page.api_key = dsqConfig.api_key;
|
|
this.sso = dsqConfig.sso;
|
|
this.language = dsqConfig.language;
|
|
|
|
if (disqus_config_custom)
|
|
disqus_config_custom.call(this);
|
|
};
|
|
|
|
(function() {
|
|
// Adds the disqus_thread id to the comment section if site is using a WP block theme
|
|
var commentsBlock = document.querySelector('.wp-block-comments');
|
|
if (commentsBlock) {
|
|
commentsBlock.id = 'disqus_thread';
|
|
}
|
|
if (document.getElementById(disqus_container_id)) {
|
|
var dsq = document.createElement('script');
|
|
dsq.type = 'text/javascript';
|
|
dsq.async = true;
|
|
dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';
|
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
|
|
} else {
|
|
console.error("Could not find 'disqus_thread' container to load DISQUS. This is usually the result of a WordPress theme conflicting with the DISQUS plugin. Try switching your site to a Classic Theme, or contact DISQUS support for help.");
|
|
}
|
|
})();
|