1; 2; 3/** 4 * @file 5 * Add entity view statistic. 6 */ 7 8(function ($) { 9 'use strict'; 10 Drupal.behaviors.entity_statistics = { 11 attach: function (context, settings) { 12 $('body', context).once('entity-statistics', function () { 13 $.ajax({ 14 type: 'POST', 15 cache: false, 16 url: Drupal.settings.entity_statistics.url, 17 data: Drupal.settings.entity_statistics.data 18 }); 19 }); 20 } 21 }; 22}(jQuery)); 23; 24/** 25 * @file 26 * AddThis javascript actions. 27 */ 28 29(function ($) { 30 Drupal.behaviors.addthis = { 31 scriptLoaded: false, 32 33 attach: function(context, settings) { 34 35 // The addthis configuration is not loaded but the settings are passed 36 // to do so. 37 if (!this.isConfigLoaded() && this.isSettingsLoaded()) { 38 // Initialize config. 39 this.initConfig(); 40 41 // Load widget js. 42 if (!this.scriptLoaded) { 43 this.loadDomready(); 44 } 45 } 46 // The addthis configuration is not loaded but no setting are available 47 // to load anything. 48 else if(!this.isConfigLoaded() && !this.isSettingsLoaded()) { 49 // Do nothing 50 } 51 52 // Trigger ready on ajax attach. 53 if (context != window.document) { 54 Drupal.behaviors.addthis.ajaxLoad(context, settings); 55 } 56 57 }, 58 59 // Returns if the settings defined by the addthis module are loaded. 60 isSettingsLoaded: function () { 61 if (typeof Drupal.settings.addthis == 'undefined') { 62 return false; 63 } 64 return true; 65 }, 66 67 // Returns if the configuration variables needed for widget.js are defined. 68 isConfigLoaded: function() { 69 if (typeof addthis_config == 'undefined' || typeof addthis_share == 'undefined') { 70 return false; 71 } 72 return true; 73 }, 74 75 initConfig: function () { 76 addthis_config = Drupal.settings.addthis.addthis_config; 77 addthis_share = Drupal.settings.addthis.addthis_share; 78 }, 79 80 // Load the js library when the dom is ready. 81 loadDomready: function() { 82 // If settings asks for loading the script after the dom is loaded, then 83 // load the script here. 84 if (!this.scriptLoaded && 85 this.isConfigLoaded() && 86 Drupal.settings.addthis.domready) { 87 $.getScript(Drupal.settings.addthis.widget_url, Drupal.behaviors.addthis.scriptReady); 88 } 89 }, 90 91 // Callback for loading the widget.js dynamically. 92 scriptReady: function () { 93 this.scriptLoaded = true; 94 }, 95 96 // Called when a ajax request returned. 97 ajaxLoad: function(context, settings) { 98 if (typeof window.addthis != 'undefined' && 99 typeof window.addthis.toolbox == 'function') 100 { 101 window.addthis.toolbox('.addthis_toolbox'); 102 } 103 } 104 105 }; 106 107 // This load the config in time to run any addthis functionality. 108 if (Drupal.behaviors.addthis.isConfigLoaded()) { 109 addthis_config = Drupal.settings.addthis.addthis_config; 110 addthis_share = Drupal.settings.addthis.addthis_share; 111 } 112 113 // Document ready in case we want to load AddThis into the dom after every 114 // thing is loaded. 115 // 116 // Is executed once after the attach happened. 117 $(document).ready(function() { 118 Drupal.behaviors.addthis.loadDomready(); 119 }); 120 121}(jQuery)); 122;
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.