1jQuery(document).ready(function($) { 2 // Loop through all the intentclicks tags and request their content 3 $('.ta-intentclicks-section-config').each(function() { 4 // Get data from shortcode output 5 let attr = $(this).data('intentclicks-attributes'); 6 let content = $(this).data('intentclicks-content'); 7 let postid = $(this).data('intentclicks-postid'); 8 9 // Make AJAX request to get rendered layout 10 $.ajax({ 11 url: intentclicks_ajax.url, 12 type: 'POST', 13 data: { 14 'action': 'intentclicks_build_layout', 15 'attr': JSON.stringify(attr), 16 'content': JSON.stringify(content), 17 'referrer': document.referrer, 18 'postid': parseInt(postid) 19 }, 20 success: (response) => { 21 // Replace the placeholder with the result returned from AJAX 22 $(this).replaceWith('<!-- ICP Plugin: loaded with ajax -->\n' + response); 23 }, 24 error: (request, status, error) => { 25 // Insert an error message in the placeholder, leaving the config attributes intact for review 26 $(this).html('<!-- ICP Plugin: ajax request failed -->'); 27 } 28 }); 29 }); 30 31 // Add referrer to intentclicks links 32 let icpReferrer = document.referrer.length > 0 ? document.referrer : 0; 33 $('.icp-list-item a, .lp-product a').attr('href', function(i, urlStr) { 34 // check if referrer is not already in url, and url has existing query params 35 if(urlStr.indexOf('&referrer') === -1 && urlStr.indexOf('?') !== -1) { 36 urlStr += '&referrer=' + encodeURIComponent(icpReferrer); 37 } 38 return urlStr; 39 }); 40 41 // Open modal on button press 42 $(document).on('click', '.icp-list-cta .cta-action-btn', function(e) { 43 e.preventDefault(); 44 let target = $(this).data('modal'); 45 46 $(target).toggleClass('open'); 47 }); 48 49 // Close modal on close button or overlay click 50 $(document).on('click', '.icp-list-modal > .icp-overlay, .icp-list-modal .modal-close', function(e) { 51 e.preventDefault(); 52 53 $(this).closest('.icp-list-modal').toggleClass('open'); 54 }); 55 56 // PST Layout 57 document.getElementById('ta-disclaimer-jump')?.addEventListener('click', function(e) { 58 e.preventDefault(); 59 $('html, body').animate({ 60 scrollTop: $("#ta-disclaimer").offset().top - 80 61 }, 'slow'); 62 }); 63 64});
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.