1(function ($) { 2 Drupal.behaviors.recaptcha = { 3 attach: function (context) { 4 Recaptcha.create(Drupal.settings.recaptcha.public_key, Drupal.settings.recaptcha.container, {theme: Drupal.settings.recaptcha.theme}); 5 }, 6 detach: function (context) {} 7 }; 8}(jQuery)); 9; 10(function ($) { 11 12$(document).ready(function() { 13 14 // Expression to check for absolute internal links. 15 var isInternal = new RegExp("^(https?):\/\/" + window.location.host, "i"); 16 17 // Attach onclick event to document only and catch clicks on all elements. 18 $(document.body).click(function(event) { 19 // Catch the closest surrounding link of a clicked element. 20 $(event.target).closest("a,area").each(function() { 21 22 var ga = Drupal.settings.googleanalytics; 23 // Expression to check for special links like gotwo.module /go/* links. 24 var isInternalSpecial = new RegExp("(\/go\/.*)$", "i"); 25 // Expression to check for download links. 26 var isDownload = new RegExp("\\.(" + ga.trackDownloadExtensions + ")$", "i"); 27 28 // Is the clicked URL internal? 29 if (isInternal.test(this.href)) { 30 // Skip 'click' tracking, if custom tracking events are bound. 31 if ($(this).is('.colorbox')) { 32 // Do nothing here. The custom event will handle all tracking. 33 } 34 // Is download tracking activated and the file extension configured for download tracking? 35 else if (ga.trackDownload && isDownload.test(this.href)) { 36 // Download link clicked. 37 var extension = isDownload.exec(this.href); 38 _gaq.push(["_trackEvent", "Downloads", extension[1].toUpperCase(), this.href.replace(isInternal, '')]); 39 } 40 else if (isInternalSpecial.test(this.href)) { 41 // Keep the internal URL for Google Analytics website overlay intact. 42 _gaq.push(["_trackPageview", this.href.replace(isInternal, '')]); 43 } 44 } 45 else { 46 if (ga.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 47 // Mailto link clicked. 48 _gaq.push(["_trackEvent", "Mails", "Click", this.href.substring(7)]); 49 } 50 else if (ga.trackOutbound && this.href.match(/^\w+:\/\//i)) { 51 if (ga.trackDomainMode == 2 && isCrossDomain(this.hostname, ga.trackCrossDomains)) { 52 // Top-level cross domain clicked. document.location is handled by _link internally. 53 event.preventDefault(); 54 _gaq.push(["_link", this.href]); 55 } 56 else { 57 // External link clicked. 58 _gaq.push(["_trackEvent", "Outbound links", "Click", this.href]); 59 } 60 } 61 } 62 }); 63 }); 64 65 // Colorbox: This event triggers when the transition has completed and the 66 // newly loaded content has been revealed. 67 $(document).bind("cbox_complete", function() { 68 var href = $.colorbox.element().attr("href"); 69 if (href) { 70 _gaq.push(["_trackPageview", href.replace(isInternal, '')]); 71 } 72 }); 73 74}); 75 76/** 77 * Check whether the hostname is part of the cross domains or not. 78 * 79 * @param string hostname 80 * The hostname of the clicked URL. 81 * @param array crossDomains 82 * All cross domain hostnames as JS array. 83 * 84 * @return boolean 85 */
86function isCrossDomain(hostname, crossDomains) { 87 /** 88 * jQuery < 1.6.3 bug: $.inArray crushes IE6 and Chrome if second argument is 89 * `null` or `undefined`, http://bugs.jquery.com/ticket/10076, 90 * https://github.com/jquery/jquery/commit/a839af034db2bd934e4d4fa6758a3fed8de74174 91 * 92 * @todo: Remove/Refactor in D8 93 */ 94 if (!crossDomains) { 95 return false; 96 } 97 else { 98 return $.inArray(hostname, crossDomains) > -1 ? true : false; 99 } 100} 101 102})(jQuery); 103;
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.