1// jquery.cookies - https://github.com/carhartl/jquery-cookie 2 3var $ = jQuery.noConflict(); 4 5(function (factory) { 6 if (typeof define === 'function' && define.amd) { 7 // AMD 8 define(['jquery'], factory); 9 } else if (typeof exports === 'object') { 10 // CommonJS 11 factory(require('jquery')); 12 } else { 13 // Browser globals 14 factory(jQuery); 15 } 16}(function ($) { 17 18 var pluses = /\+/g; 19 20 function encode(s) { 21 return config.raw ? s : encodeURIComponent(s); 22 } 23 24 function decode(s) { 25 return config.raw ? s : decodeURIComponent(s); 26 } 27 28 function stringifyCookieValue(value) { 29 return encode(config.json ? JSON.stringify(value) : String(value)); 30 } 31 32 function parseCookieValue(s) { 33 if (s.indexOf('"') === 0) { 34 // This is a quoted cookie as according to RFC2068, unescape... 35 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 36 } 37 38 try { 39 // Replace server-side written pluses with spaces. 40 // If we can't decode the cookie, ignore it, it's unusable. 41 // If we can't parse the cookie, ignore it, it's unusable. 42 s = decodeURIComponent(s.replace(pluses, ' ')); 43 return config.json ? JSON.parse(s) : s; 44 } catch (e) {} 45 } 46 47 function read(s, converter) { 48 var value = config.raw ? s : parseCookieValue(s); 49 return $.isFunction(converter) ? converter(value) : value; 50 } 51 52 var config = $.cookie = function (key, value, options) { 53 54 // Write 55 56 if (value !== undefined && !$.isFunction(value)) { 57 options = $.extend({}, config.defaults, options); 58 59 if (typeof options.expires === 'number') { 60 var days = options.expires, 61 t = options.expires = new Date(); 62 t.setTime(+t + days * 864e+5); 63 } 64 65 return (document.cookie = [ 66 encode(key), '=', stringifyCookieValue(value), 67 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 68 options.path ? '; path=' + options.path : '', 69 options.domain ? '; domain=' + options.domain : '', 70 options.secure ? '; secure' : '' 71 ].join('')); 72 } 73 74 // Read 75 76 var result = key ? undefined : {}; 77 78 // To prevent the for loop in the first place assign an empty array 79 // in case there are no cookies at all. Also prevents odd result when 80 // calling $.cookie(). 81 var cookies = document.cookie ? document.cookie.split('; ') : []; 82 83 for (var i = 0, l = cookies.length; i < l; i++) { 84 var parts = cookies[i].split('='); 85 var name = decode(parts.shift()); 86 var cookie = parts.join('='); 87 88 if (key && key === name) { 89 // If second argument (value) is a function it's a converter... 90 result = read(cookie, value); 91 break; 92 } 93 94 // Prevent storing a cookie that we couldn't decode. 95 if (!key && (cookie = read(cookie)) !== undefined) { 96 result[name] = cookie; 97 } 98 } 99 100 return result; 101 }; 102 103 config.defaults = {}; 104 105 $.removeCookie = function (key, options) { 106 if ($.cookie(key) === undefined) { 107 return false; 108 } 109 110 // Must not alter options, thus extending a fresh object... 111 $.cookie(key, '', $.extend({}, options, { 112 expires: -1 113 })); 114 return !$.cookie(key); 115 }; 116 117})); 118 119//setup our cookies 120$(document).ready(function () { 121 //set variable for document referrer 122 var visitor_referrer = document.referrer; 123 //set long term referrer cookie 124 if ($.cookie('pc_r') == null) { 125 $.cookie('pc_r', visitor_referrer, { 126 expires: 360, 127 path: '/' 128 }); 129 } 130 //set session cookie 131 if ($.cookie('pc_sr') == null) { 132 $.cookie('pc_sr', visitor_referrer, { 133 path: '/' 134 }); 135 } 136 //set landing page cookie 137 var landing = window.location['href']; 138 if ($.cookie('pc_lp') == null) { 139 $.cookie('pc_lp', landing, { 140 expires: 360, 141 path: '/' 142 }); 143 } 144 145 // set keyword cookies from referrer 146 var url = window.location; 147 url = url['href']; 148 if (url.indexOf('?keyword=') > -1) { 149 var keyword_url = url.split('?keyword='); 150 if (keyword_url[1].indexOf('&gclid=') > -1) { 151 var keyword = keyword_url[1].split('&gclid='); 152 keyword = keyword[0]; 153 keyword = keyword.replace(/\+|%20/g,' '); 154 } 155 else { 156 var keyword = keyword_url[1]; 157 keyword = keyword.replace(/\+|%20/g,' '); 158 } 159 } 160 var kw = keyword; 161 if ($.cookie('pc_keyword') == null) { 162 $.cookie('pc_keyword', kw, { 163 expires: 360, 164 path: '/' 165 }); 166 } 167}); 168 169// Google Analytics Tracking for cookies 170var _gaq = _gaq || []; 171_gaq.push(['_gat._forceSSL']); 172 173$(window).load(function() { 174 var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 175 $.ajax({ 176 url: gaJsHost+'google-analytics.com/ga.js', type: 'get', dataType: '
176script', cache: true, 177 success:function() { try { _gat._getTracker("_your_tracking_code_here_")._trackPageview(); } catch(err) {} } 178 }); 179})
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.