1var requestAccepted; 2var status; 3var isResults; 4var isAfd = false; 5 6function google_callback(google_requestAccepted, google_status) 7{ 8 requestAccepted = google_requestAccepted; 9 status = google_status; 10 isResults = parkingData.pageType == 2; 11 isAfd = google_status.feed != "afs"; 12 13 if (!requestAccepted) 14 { 15 failover(); 16 return; 17 } 18 19 recordGoogleCallbackInfo(isAfd); 20 21 if ((!isAfd) && (isResults)) 22 { 23 $("<div class='resultLinks' id='ads2'></div>").insertAfter("#webResults"); 24 } 25} 26 27function failover() 28{ 29 var location = window.location.href; 30 if (location.indexOf('?') == -1) 31 { 32 location += '?ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); 33 } 34 else 35 { 36 var split = location.split('?'); 37 location = split[0]; 38 var query = split[1]; 39 var params = query.split('&'); 40 var itemsWritten = 0; 41 for (i = 0; i < params.length; i++) 42 { 43 if (params[i].indexOf('ai=') == -1) 44 { 45 if (itemsWritten == 0) 46 location += '?' + params[i]; 47 else 48 location += '&' + params[i]; 49 itemsWritten++; 50 } 51 } 52 if (itemsWritten == 0) 53 location += '?ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); 54 else 55 location += '&ai=' + (parseInt(parkingData.apiIteration) + parseInt(1)); 56 itemsWritten++; 57 } 58 59 if (location != window.location.href) 60 window.location = location; 61} 62 63function exists(x) 64{ 65 if (typeof (x) == 'undefined') 66 return false; 67 if (x == null) 68 return false; 69 if (x === '') 70 return false; 71 return true; 72} 73 74function setCookie(name, value) 75{ 76 var argumentCount; 77 var argumentValues; 78 var domain; 79 var expires; 80 var path; 81 var secure; 82 83 argumentValues = setCookie.arguments; 84 argumentCount = setCookie.arguments.length; 85 86 expires = (argumentCount > 2) ? argumentValues[2] : null; 87 path = (argumentCount > 3) ? argumentValues[3] : null; 88 domain = (argumentCount > 4) ? argumentValues[4] : null; 89 secure = (argumentCount > 5) ? argumentValues[5] : false; 90 91 document.cookie = name + '=' + escape(value) + 92 ((expires == null) ? '' : ('; expires=' + expires.toGMTString())) + 93 ((path == null) ? '' : ('; path=' + path)) + 94 ((domain == null) ? '' : ('; domain=' + domain)) + 95 ((secure == true) ? '; secure' : ''); 96} 97 98function getCookie(name) 99{ 100 var argument; 101 var argumentLength; 102 var cookieLength; 103 var endString; 104 var i; 105 var j; 106 107 argument = name + '='; 108 argumentLength = argument.length; 109 cookieLength = document.cookie.length; 110 i = 0; 111 while (i < cookieLength) 112 { 113 j = i + argumentLength; 114 if (document.cookie.substring(i, j) == argument) 115 { 116 endString = document.cookie.indexOf(';', j); 117 if (endString == -1) 118 endString = document.cookie.length; 119 return unescape(document.cookie.substring(j, endString)); 120 } 121 i = document.cookie.indexOf(' ', i) + 1; 122 if (i == 0) 123 break; 124 } 125 return (null); 126} 127 128function deleteCookie(name) 129{ 130 var cookieValue; 131 var expirationDate; 132 133 expirationDate = new Date(); 134 expirationDate.setTime(expirationDate.getTime() - 1); 135 136 cookieValue = getCookie(name); 137 if (cookieValue != null) 138 setCookie(name, '', expirationDate, '/'); 139} 140 141function stripHtml(input) 142{ 143 var output = ''; 144 var inTag = false; 145 for (var i = 0; i < input.length; i++) 146 { 147 if (input.charAt(i) == '<') 148 inTag = true; 149 if (input.charAt(i) == '>') 150 { 151 if (input.charAt(i + 1) == '<') 152 { 153 } 154 else 155 { 156 inTag = false; 157 i++; 158 } 159 } 160 if (!inTag) 161 output += input.charAt(i); 162 } 163 164 return output; 165} 166 167function buildWebResultLoggingUrl(rank, sponsoredCount, resultLinkType, visibleUrl) 168{ 169 var url = '/clickLog?ck=' + encodeURIComponent(parkingData.cacheKey) 170 + '&d=' + encodeURIComponent(parkingData.domainName) 171 + '&aid=' + encodeURIComponent(parkingData.adNetworkID) 172 + '&r=' + encodeURIComponent(rank) 173 + '&rc=' + encodeURIComponent(sponsoredCount) 174 + '&rlt=' + encodeURIComponent(resultLinkType) 175 + '&du=' + encodeURIComponent(stripHtml(visibleUrl)) 176 + '&afd=' + isAfd 177 + '&rid=' + encodeURIComponent(parkingData.requestGuid); 178 return url; 179} 180 181function createRequest() 182{ 183 try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch (e) { } 184 try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch (e) { } 185 try { return new XMLHttpRequest(); } catch (e) { } 186 return null; 187} 188 189function fetchWebResults() 190{ 191 var request = "/interface/6/?mode=wr&outputType=json"
192 + "&dn=" + encodeURIComponent(parkingData.domainName) 193 + "&st=" + encodeURIComponent(parkingData.searchText) 194 + "&num=" + encodeURIComponent("10") 195 + "&ia=" + encodeURIComponent(parkingData.adultTag) 196 + "&hl=" + encodeURIComponent(parkingData.hl) 197 + "&cip=" + encodeURIComponent(parkingData.cip) 198 + "&ref=" + encodeURIComponent(document.referrer) 199 + "&ua=" + encodeURIComponent(navigator.userAgent); 200 201 var http = createRequest(); 202 if (http != null) 203 { 204 http.open('GET', request, true); 205 http.setRequestHeader('Connection', 'close'); 206 207 http.onreadystatechange = function () 208 { 209 if (http.readyState == 4) 210 { 211 var webResults = eval("(" + http.responseText + ")"); 212 renderWebResults(webResults); 213 } 214 } 215 216 http.send(null); 217 } 218} 219 220function renderWebResults(webResults) 221{ 222 //have web results? 223 if ((webResults) && (webResults.webResults) && (webResults.webResults.length > 0)) 224 { 225 //find output div 226 var div = document.getElementById("webResults"); 227 if (div) 228 { 229 //daughter window? 230 var dw = " target='_blank'"; 231 232 //write header 233 var html = "<h2>Web Results</h2>"; 234 235 //open list 236 html += "<ul>"; 237 238 //loop through web results 239 for (var i = 0; i < webResults.webResults.length; i++) 240 { 241 //determine link class 242 var linkClass = ""; 243 if (i == 0) 244 linkClass += "first"; 245 else if (i == (webResults.webResults.length - 1)) 246 linkClass += "last"; 247 html += "<li class='" + linkClass + "'>"; 248 249 //build click url 250 var loggingUrl = buildWebResultLoggingUrl(i + 1, 10, webResults.webResults[i].resultLinkType, webResults.webResults[i].displayUrl, false); 251 252 //title 253 html += "<a class='title'" + dw + " onclick='return trackClick(\"" + loggingUrl + "\");' href='" + webResults.webResults[i].clickUrl + "' " + ">" + webResults.webResults[i].title + "</a>"; 254 255 //two line or three? 256 if (parkingData.wClass != "wr") 257 { 258 //url 259 html += "<a class='url'" + dw + " onclick='return trackClick(\"" + loggingUrl + "\");' href='" + webResults.webResults[i].clickUrl + "'>" + webResults.webResults[i].displayUrl + "</a>"; 260 261 //abstract 262 html += "<p class='abstract'>" + webResults.webResults[i].abs + "</p>"; 263 } 264 else 265 { 266 //abstract 267 html += "<p class='abstract'>" + webResults.webResults[i].abs + "</p>"; 268 269 //url 270 html += "<a class='url'" + dw + " onclick='return trackClick(\"" + loggingUrl + "\");' href='" + webResults.webResults[i].clickUrl + "'>" + webResults.webResults[i].displayUrl + "</a>"; 271 } 272 273 html += "</li>"; 274 } 275 html += "</ul>"; 276 div.innerHTML = html; 277 } 278 } 279} 280 281function recordGoogleCallbackInfo(isAfd) 282{ 283 var request = "/googleCallback" 284 + "?rid=" + encodeURIComponent(parkingData.requestGuid) 285 + "&isAfd=" + encodeURIComponent(isAfd ? "1" : "0") 286 287 var http = createRequest(); 288 if (http != null) { 289 http.open('GET', request, false); 290 http.setRequestHeader('Connection', 'close'); 291 292// http.onreadystatechange = function () { 293// if (http.readyState == 4) { 294// //var webResults = eval("(" + http.responseText + ")"); 295// //renderWebResults(webResults); 296// } 297// } 298 299 http.send(null); 300 } 301}
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.