1/** 2 * @file 3 * JavaScript for the Disqus Drupal module. 4 */ 5 6// The Disqus global variables. 7var disqus_shortname = ''; 8var disqus_url = ''; 9var disqus_title = ''; 10var disqus_identifier = ''; 11var disqus_def_name = ''; 12var disqus_def_email = ''; 13var disqus_config; 14 15(function ($, once, Drupal) { 16 17"use strict"; 18 19Drupal.disqus = {}; 20 21/** 22 * Drupal Disqus behavior. 23 */ 24Drupal.behaviors.disqus = { 25 attach: function (context, settings) { 26 // Load the Disqus comments. 27 if (settings.disqus || false) { 28 29 // Ensure that the Disqus comments are only loaded once. 30 once('disqus', 'body', context).forEach((el) => { 31 32 // Setup the global JavaScript variables for Disqus. 33 disqus_shortname = settings.disqus.domain; 34 disqus_url = settings.disqus.url; 35 disqus_title = settings.disqus.title; 36 disqus_identifier = settings.disqus.identifier; 37 disqus_def_name = settings.disqus.name || ''; 38 disqus_def_email = settings.disqus.email || ''; 39 40 // Language and SSO settings are passed in through disqus_config(). 41 disqus_config = function () { 42 if (settings.disqus.language || false) { 43 el.language = settings.disqus.language; 44 } 45 if (settings.disqus.remote_auth_s3 || false) { 46 el.page.remote_auth_s3 = settings.disqus.remote_auth_s3; 47 } 48 if (settings.disqus.api_key || false) { 49 el.page.api_key = settings.disqus.api_key; 50 } 51 if (settings.disqus.sso || false) { 52 el.sso = settings.disqus.sso; 53 } 54 if (settings.disqus.callbacks || false) { 55 for (var key in settings.disqus.callbacks) { 56 for (var i = 0; i < settings.disqus.callbacks[key].length; i++) { 57 var callback = settings.disqus.callbacks[key][i].split('.'); 58 var fn = window; 59 for (var j = 0; j < callback.length; j++) { 60 fn = fn[callback[j]]; 61 } 62 if (typeof fn === 'function') { 63 el.callbacks[key].push(fn); 64 } 65 } 66 } 67 } 68 }; 69 70 // Make the AJAX call to get the Disqus comments. 71 jQuery.ajax({ 72 type: 'GET', 73 url: '//' + disqus_shortname + '.disqus.com/embed.js', 74 dataType: 'script', 75 cache: false 76 }); 77 }); 78 } 79 80 // Load the comment numbers JavaScript. 81 if (settings.disqusComments || false) { 82 // Ensure that comment numbers JavaScript is only loaded once. 83 once('disqusComments', 'body', context).forEach(function () { 84 disqus_shortname = settings.disqusComments; 85 // Make the AJAX call to get the number of comments. 86 jQuery.ajax({ 87 type: 'GET', 88 url: '//' + disqus_shortname + '.disqus.com/count.js', 89 dataType: 'script', 90 cache: false 91 }); 92 }); 93 } 94 } 95}; 96 97})(jQuery, once, Drupal);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.