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