1jQuery(document).ready( 2 function ($) { 3 4 function getCookie(cname) { 5 var name = cname + "="; 6 var decodedCookie = decodeURIComponent(document.cookie); 7 var ca = decodedCookie.split(';'); 8 for(var i = 0; i <ca.length; i++) { 9 var c = ca[i]; 10 while (c.charAt(0) == ' ') { 11 c = c.substring(1); 12 } 13 if (c.indexOf(name) == 0) { 14 return c.substring(name.length, c.length); 15 } 16 } 17 return ""; 18 } 19 20 var visited_cookie = getCookie("affwp_visit_id"); 21 var affiliate_id = getCookie("affwp_affiliate_id") 22 var campaign_cookie = getCookie("affwp_campaign") 23 24 if ( affiliate_id ) { 25 var url = awp_track_visit_var.url; 26 if(url.substr(-1) == '/') { 27 url = url.substr(0, url.length - 1); 28 } 29 target_urls = $("a[href^='" + url + "']"); 30 var referral_variable = awp_track_visit_var.referral_variable; 31 $(target_urls).each( 32 function () { 33 current_url = $(this).attr("href"); 34 current_url = updateQueryStringParameter(current_url, referral_variable, affiliate_id); 35 if ( visited_cookie ) { 36 current_url = current_url + "&visit=" + visited_cookie; 37 } 38 if ( campaign_cookie ) { 39 current_url = current_url + "&campaign=" + campaign_cookie; 40 } 41 $(this).attr("href", current_url ); 42 } 43 ); 44 } 45 46 function updateQueryStringParameter(uri, ref_var, aff_id
46) 47 { 48 var re = new RegExp("([?|&])" + ref_var + "=.*?(&|#|$)", "i"); 49 if (uri.match(re)) { return uri.replace(re, "$1" + ref_var + "=" + aff_id + "$2"); 50 } 51 var hash = "", separator = -1 !== uri.indexOf("?") ? "&" : "?"; 52 return -1 !== uri.indexOf("#") && (hash = uri.replace(/.*#/, "#"), uri = uri.replace(/#.*/, "")), uri + separator + ref_var + "=" + aff_id + hash 53 } 54 55 56 } 57);
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.