1(function ($, Drupal) { 2 'use strict'; 3 4 Drupal.behaviors.mixpanel_button = { 5 attach: function (context, settings) { 6 const button = $('button'); 7 const hyperLink = $('a'); 8 const form = $("form"); 9 10 const entityType = settings.ifw_mixpanel?.entity?.type ?? null; 11 const entityId = settings.ifw_mixpanel?.entity?.id ?? null; 12 13 form.submit(function (event) { 14 // Get the submit button element 15 const button = $(this).find("input[type=submit]:focus" ); 16 window.mixpanel.track('Link click', { 17 'Link text': button.attr('name'), 18 'Link type': 'submit', 19 'Entity type': entityType, 20 'Entity ID': entityId 21 }); 22 }); 23 24 button.click(function (event) { 25 const name = $(this).attr('aria-label'); 26 window.mixpanel.track('Link click', { 27 'Link text': name, 28 'Link type': 'button', 29 'Entity type': entityType, 30 'Entity ID': entityId 31 }); 32 }); 33 34 hyperLink.click(function (event) { 35 const text = $(this).text(); 36 const target = $(this).attr('href'); 37 38 window.mixpanel.track('Link click', { 39 'Link text': text, 40 'Link type': 'hyperlink', 41 'Link target': target, 42 'Entity type': entityType, 43 'Entity ID': entityId 44 }); 45 }); 46 } 47 }; 48 49})(jQuery, 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.