1(function ($) { 2 'use strict'; 3 4 $(document).ajaxSend(function (event, jqxhr, settings) { 5 // Function to check if action contains 'xag' 6 function actionContainsXag(data) { 7 if (typeof data === 'string') { 8 // Check if the action parameter contains 'xag' 9 return data.includes('action=xag'); 10 } else if (data instanceof FormData) { 11 // Check if the FormData has 'action' containing 'xag' 12 for (var pair of data.entries()) { 13 if (pair[0] === 'action' && pair[1].includes('xag')) { 14 return true; 15 } 16 } 17 } 18 return false; 19 } 20 21 // If the action contains 'xag', append the nonce 22 if (actionContainsXag(settings.data)) { 23 if (settings.data instanceof FormData) { 24 // Append the nonce directly to the FormData object 25 settings.data.append('_xagio_nonce', xagio_data.nonce); 26 } else { 27 // If it's a URL-encoded string, append the nonce 28 settings.data += '&_xagio_nonce=' + xagio_data.nonce; 29 } 30 } 31 }); 32 33 let actions = { 34 trackAffiliateClicks: function () { 35 $(document).on('click', '.xagio-tracking', function (e) { 36 let id = $(this).data('id'); 37 let ms = $(this).hasClass('masked') ? '&masked=yes' : ''; 38 $.post(xagio_data.wp_post, 'action=xagio_trackShortcode&id=' + id + ms); 39 }); 40 } 41 }; 42 43 /** 44 * Global doc.ready function 45 */ 46 $(document).ready(function () { 47 actions.trackAffiliateClicks(); 48 }); 49 50})(jQuery);
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.