1/** 2 * @file 3 * Attaches several event listener to a web page. 4 */ 5 6(function ($, drupalSettings) { 7 8 'use strict'; 9 10 $(document).ready(function () { 11 defaultBind(); 12 13 // Colorbox: This event triggers when the transition has completed and the 14 // newly loaded content has been revealed. 15 if (drupalSettings.matomo && drupalSettings.matomo.trackColorbox) { 16 $(document).bind('cbox_complete', function () { 17 var href = $.colorbox.element().attr('href'); 18 if (href) { 19 _paq.push(['setCustomUrl', href]); 20 if (drupalSettings.matomo.disableCookies) { 21 _paq.push(['disableCookies']); 22 } 23 _paq.push(['trackPageView']); 24 } 25 }); 26 } 27 28 }); 29 30 /** 31 * Default event binding. 32 * 33 * Attach mousedown, keyup, touchstart events to document only and catch 34 * clicks on all elements. 35 */ 36 function defaultBind() { 37 $(document.body).bind('mousedown keyup touchstart', function (event) { 38 39 // Catch the closest surrounding link of a clicked element. 40 $(event.target).closest('a,area').each(function () { 41 42 if (drupalSettings.matomo.trackMailto && $(this).is("a[href^='mailto:'],area[href^='mailto:']")) { 43 // Mailto link clicked. 44 _paq.push(['trackEvent', 'Mails', 'Click', this.href.substring(7)]); 45 } 46 47 }); 48 }); 49 } 50 51})(jQuery, drupalSettings);
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.