1function aqsGetParameterByName(name, url) { 2 if (!url) { 3 url = window.location.href; 4 } 5 name = name.replace(/[\[\]]/g, "\\$&"); 6 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"), 7 results = regex.exec(url); 8 if (!results) 9 return null; 10 if (!results[2]) 11 return ''; 12 return decodeURIComponent(results[2].replace(/\+/g, " ")); 13} 14 15//the name of the cookie to look for 16var napco_aqs_cookie_name = 'aqs'; 17 18//will store any key-values already in the cookie 19var aqs_cookie_vars = {}; 20 21//the value of the cookie 22var aqs_cookie = jQuery.cookie(napco_aqs_cookie_name); 23 24//the keys we care about 25var aqs_keys = [ 26 "utm_source", 27 "utm_medium", 28 "utm_campaign", 29 "utm_content", 30 "utm_name", 31 "utm_term", 32 "utm_id", 33 "src", 34 "InvitesVIP", 35]; 36 37//if the cookie has a value, decode it and parse it into an object 38if (aqs_cookie !== undefined) { 39 aqs_cookie_vars = JSON.parse(atob(aqs_cookie)); 40} 41 42//if (!jQuery.cookie(napco_aqs_cookie_name)) { 43 //the object to store key-values to update the cookie 44 var dough = {}; 45 46 //loop through the keys and add anything from the url into the dough 47 jQuery.each(aqs_keys, function (k, v) { 48 if (x = aqsGetParameterByName(v)) { 49 dough[v] = x; 50 } 51 52 //if not in the url see if it already exists in the cookie and add if so add it to the dough 53 else if (aqs_cookie_vars[v]) { 54 dough[v] = aqs_cookie_vars[v]; 55 } 56 }); 57 58 //bake the dough into a cookie 59 jQuery.cookie(napco_aqs_cookie_name, btoa(JSON.stringify(dough)), { 60 expires: 1, //expires in 1 day 61 path: '/' 62 }); 63//} 64 65 66//automatically attach to key-values to compusystems links 67jQuery(document).ready(function ($) { 68 69 //if (jQuery.cookie(napco_aqs_cookie_name)) { 70 $('a[href*="compusystems"]').each(function () { 71 href = $(this).attr('href'); 72 73 $.each(aqs_keys, function (k, v) { 74 if (href.indexOf('?') == -1) url_char = '?'; 75 else url_char = '&'; 76 77 if (dough[v] !== undefined) { 78 href = href + url_char + v + '=' + encodeURIComponent(dough[v]); 79 } 80 }); 81 $(this).attr('href', href); 82 $('#results').html(href); 83 }); 84 //} 85});
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.