Mercurial > hg > rr-repo
view sites/all/modules/disqus/disqus.js @ 0:ff03f76ab3fe
initial version
author | danieleb <danielebarchiesi@me.com> |
---|---|
date | Wed, 21 Aug 2013 18:51:11 +0100 |
parents | |
children |
line wrap: on
line source
/** * @file * JavaScript for the Disqus Drupal module. */ // The Disqus global variables. var disqus_shortname = ''; var disqus_url = ''; var disqus_title = ''; var disqus_identifier = ''; var disqus_developer = 0; var disqus_def_name = ''; var disqus_def_email = ''; var disqus_config; (function ($) { /** * Drupal Disqus behavior. */ Drupal.behaviors.disqus = { attach: function (context, settings) { $('body').once('disqus', function() { // Load the Disqus comments. if (settings.disqus || false) { // Setup the global JavaScript variables for Disqus. disqus_shortname = settings.disqus.domain; disqus_url = settings.disqus.url; disqus_title = settings.disqus.title; disqus_identifier = settings.disqus.identifier; disqus_developer = settings.disqus.developer || 0; disqus_def_name = settings.disqus.name || ''; disqus_def_email = settings.disqus.email || ''; // Language and SSO settings are passed in through disqus_config(). disqus_config = function() { if (settings.disqus.language || false) { this.language = settings.disqus.language; } if (settings.disqus.remote_auth_s3 || false) { this.page.remote_auth_s3 = settings.disqus.remote_auth_s3; } if (settings.disqus.api_key || false) { this.page.api_key = settings.disqus.api_key; } if (settings.disqus.sso || false) { this.sso = settings.disqus.sso; } }; // Make the AJAX call to get the Disqus comments. jQuery.ajax({ type: 'GET', url: 'http://' + disqus_shortname + '.disqus.com/embed.js', dataType: 'script', cache: false }); } // Load the comment numbers JavaScript. if (settings.disqusComments || false) { disqus_shortname = settings.disqusComments; // Make the AJAX call to get the number of comments. jQuery.ajax({ type: 'GET', url: 'http://' + disqus_shortname + '.disqus.com/count.js', dataType: 'script', cache: false }); } }); } }; })(jQuery);