1 2// what is the URL query string parameter to look for? 3var napco_promo_code_parameter = 'src'; 4 5// referenced by php, including in the napco gravity forms plugin 6var napco_promo_code_cookie = 'napco_src'; 7 8function getParameterByName(name, url) { 9 if (!url) { 10 url = window.location.href; 11 } 12 name = name.replace(/[\[\]]/g, "\\$&"); 13 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"), 14 results = regex.exec(url); 15 if (!results) 16 return null; 17 if (!results[2]) 18 return ''; 19 return decodeURIComponent(results[2].replace(/\+/g, " ")); 20} 21 22//set the cookie if the url has "src" 23url_promo_code = getParameterByName(napco_promo_code_parameter); 24if (url_promo_code) { 25 jQuery.cookie(napco_promo_code_cookie, url_promo_code, { 26 expires: 10, //expires in 10 days 27 path: '/' 28 }); 29} 30 31jQuery(document).ready(function () { 32//automatically attach to cvent links 33 if (jQuery.cookie(napco_promo_code_cookie)) { 34 jQuery('a[href*="cvent"]').each(function () { 35 href = jQuery(this).attr('href'); 36 if (href.indexOf('?') == -1) 37 url_char = '?'; 38 else 39 url_char = '&'; 40 jQuery(this).attr('href', href + url_char + 'refid=' + jQuery.cookie(napco_promo_code_cookie)); 41 }); 42 } 43});
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.