1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10var QuickSearch = { 11 minimum_length: 3, 12 search_delay: 125, 13 cache: new Object(), 14 init: function() 15 { 16 $('#search_query').bind("keydown", QuickSearch.on_keydown); 17 $('#search_query').bind("keyup", QuickSearch.on_keyup); 18 $('#search_query').bind("change", QuickSearch.on_change); 19 $('#search_query').blur(QuickSearch.on_blur); 20 $('#search_query').attr('autocomplete', 'off'); 21 22 }, 23 24 on_blur: function(event) 25 { 26 if(!QuickSearch.item_selected && !QuickSearch.over_all) 27 { 28 QuickSearch.hide_popup(); 29 } 30 }, 31 32 on_keydown: function(event) 33 { 34 if(event.keyCode == 13 && !event.altKey) 35 { 36 if(QuickSearch.selected) 37 { 38 try { 39 event.preventDefault(); 40 event.stopPropagation(); 41 } catch(e) { } 42 window.location = QuickSearch.selected.url; 43 return false; 44 } 45 else 46 { 47 QuickSearch.hide_popup(); 48 } 49 } 50 else if(event.keyCode == 27) 51 { 52 if(document.getElementById('QuickSearch')) 53 { 54 try { 55 event.preventDefault(); 56 event.stopPropagation(); 57 } catch(e) { } 58 } 59 QuickSearch.hide_popup(); 60 } 61 }, 62 63 on_keyup: function(event) 64 { 65 if(QuickSearch.timeout) 66 { 67 clearTimeout(QuickSearch.timeout); 68 } 69 70 // Down key was pressed 71 if(event.keyCode == 40 && QuickSearch.results) 72 { 73 if(QuickSearch.selected && QuickSearch.results.length >= QuickSearch.selected.index+1) 74 { 75 QuickSearch.highlight_item(QuickSearch.selected.index+1, true); 76 } 77 if(!QuickSearch.selected && QuickSearch.results.length > 0) 78 { 79 QuickSearch.highlight_item(0, true); 80 } 81 try { 82 event.preventDefault(); 83 event.stopPropagation(); 84 } catch(e) { } 85 return false; 86 } 87 else if(event.keyCode == 38 && QuickSearch.results) 88 { 89 if(QuickSearch.selected && QuickSearch.selected.index > 0) 90 { 91 QuickSearch.highlight_item(QuickSearch.selected.index-1, true); 92 } 93 try { 94 event.preventDefault(); 95 event.stopPropagation(); 96 } catch(e) { } 97 } 98 else if(event.keyCode == 27) 99 { 100 QuickSearch.hide_popup(); 101 } 102 else 103 { 104 if($('#search_query').val() == QuickSearch.last_query) 105 { 106 return false; 107 } 108 QuickSearch.selected = false; 109 if($('#search_query').val().replace(/^\s+|\s+$/g, '').length >= QuickSearch.minimum_length) 110 { 111 QuickSearch.last_query = $('#search_query').val().replace(/^\s+|\s+$/g, ''); 112 if(QuickSearch.timeout) 113 { 114 window.clearTimeout(QuickSearch.timeout); 115 } 116 QuickSearch.timeout = window.setTimeout(QuickSearch.do_search, QuickSearch.search_delay); 117 } 118 else { 119 if(document.getElementById('QuickSearch')) 120 { 121 $('#QuickSearch').remove(); 122 } 123 } 124 } 125 }, 126 127 on_change: function(event) 128 { 129 return (QuickSearch.on_keydown(event) && QuickSearch.on_keyup(event)); 130 }, 131 132 do_search: function() 133 { 134 var cache_name = $('#search_query').val().length+$('#search_query').val(); 135 if(QuickSearch.cache[cache_name]) 136 { 137 QuickSearch.search_done(QuickSearch.cache[cache_name]); 138 } 139 else 140 { 141 $.ajax({ 142 type: 'GET', 143 dataType: 'xml', 144 url: '/search.php?action=AjaxSearch&search_query='+encodeURIComponent($('#search_query').val()), 145 success: function(response) { QuickSearch.search_done(response); } 146 }); 147 } 148 }, 149 150 search_done: function(response) 151 { 152 // Cache results 153 var cache_name = $('#search_query').val().length+$('#search_query').val(); 154 QuickSearch.cache[cache_name] = response; 155 156 if(document.getElementById('QuickSearch')) { 157 $('#QuickSearch').remove(); 158 } 159 160 if ($('result', response).length > 0) { 161 var popup_container = document.createElement('TABLE'); 162 popup_container.className = 'QuickSearch'; 163 popup_container.id = 'QuickSearch'; 164 popup_container.cellPadding = "0"; 165 popup_container.cellSpacing = "0"; 166 popup_container.border = "0"; 167 168 var popup = document.createElement('TBODY');
169 popup_container.appendChild(popup); 170 171 var counter = 0; 172 173 $('result', response).each( 174 function() 175 { 176 var tr = $($(this).text()); 177 var url = $('.QuickSearchResultName a', tr).attr('href'); 178 var tmpCounter = counter; 179 180 $(tr).attr('id', 'QuickSearchResult' + tmpCounter); 181 $(tr).bind('mouseover', function() { QuickSearch.item_selected = true; QuickSearch.highlight_item(tmpCounter, false); }); 182 $(tr).bind('mouseup', function() { window.location = url; }); 183 $(tr).bind('mouseout', function() { QuickSearch.item_selected = false; QuickSearch.unhighlight_item(tmpCounter) }); 184 $(popup).append(tr); 185 186 counter++; 187 } 188 ); 189 190 // More results than we're showing? 191 var all_results_count = $('viewmoreurl', response).size(); 192 193 if(all_results_count) 194 { 195 var tr = document.createElement('TR'); 196 var td = document.createElement('TD'); 197 tr.className = "QuickSearchAllResults"; 198 tr.onmouseover = function() { QuickSearch.over_all = true; }; 199 tr.onmouseout = function() { QuickSearch.over_all = false; }; 200 td.colSpan = 2; 201 td.innerHTML = $('viewmoreurl', response).text(); 202 tr.appendChild(td); 203 popup.appendChild(tr); 204 } 205 206 var clone = popup.cloneNode(true); 207 document.body.appendChild(clone); 208 clone.style.top = "10px"; 209 clone.style.left = "10px"; 210 offset_height = clone.offsetHeight; 211 offset_width = clone.offsetWidth; 212 clone.parentNode.removeChild(clone); 213 214 var offset_top = offset_left = 0; 215 var element = document.getElementById('search_query'); 216 if(typeof(QuickSearchAlignment) != 'undefined' && QuickSearchAlignment == 'left') { 217 offset_left = 0; 218 } 219 else { 220 offset_left += element.offsetWidth - $('#SearchForm').width(); 221 } 222 223 offset_top = -3; 224 do 225 { 226 offset_top += element.offsetTop || 0; 227 offset_left += element.offsetLeft || 0; 228 element = element.offsetParent; 229 } while(element); 230 231 popup_container.style.position = "absolute"; 232 popup_container.style.left = offset_left + 1 + "px"; 233 popup_container.style.top = offset_top + document.getElementById('search_query').offsetHeight + "px"; 234 if(typeof(QuickSearchWidth) != 'undefined') { 235 popup_container.style.width = QuickSearchWidth; 236 } 237 else { 238 popup_container.style.width = document.getElementById('SearchForm').offsetWidth - 2 + "px"; 239 } 240 if($('#QuickSearch')) 241 { 242 $('#QuickSearch').remove(); 243 } 244 document.body.appendChild(popup_container); 245 popup_container.style.display = ''; 246 } 247 else 248 { 249 if(document.getElementById('QuickSearch')) 250 { 251 $('#QuickSearch').remove(); 252 } 253 } 254 }, 255 256 257 hide_popup: function() 258 { 259 $('#QuickSearch').remove(); 260 QuickSearch.selected = null; 261 }, 262 263 highlight_item: function(index, keystroke) 264 { 265 element = $('#QuickSearchResult'+index); 266 if(keystroke == true) 267 { 268 if(QuickSearch.selected) QuickSearch.selected.className = 'QuickSearchResult'; 269 QuickSearch.selected = document.getElementById('QuickSearchResult'+index); 270 } 271 element.addClass("QuickSearchHover"); 272 }, 273 274 unhighlight_item: function(index) 275 { 276 element = $('#QuickSearchResult'+index); 277 element.removeClass('QuickSearchHover'); 278 } 279}; 280 281$(document).ready(function() 282{ 283 QuickSearch.init(); 284}); 285 286}
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.