1// attach event listener for hijack 2if(window.addEventListener) { window.addEventListener('load', lwp_hijack_search, false); } 3else { window.attachEvent('onload', lwp_hijack_search); } 4// Prep WP search form for Lijit functionality 5 6function lwp_pnode( objNode, strTagName ){ 7 for ( 8 objNode = objNode.parentNode ; 9 ( 10 objNode && ( 11 (objNode.tagName && (objNode.tagName.toLowerCase() != strTagName)) || 12 (!objNode.tagName && (objNode.nodeType != 3)) 13 ) 14 ); 15 objNode = objNode.parentNode 16 ){} 17 return( objNode ); 18} 19 20function lwp_findElem(lwp_el_type,lwp_method){ 21 22 if (lwp_el_type == 'FORM') 23 { 24 lwp_search_id = new Array('searchform','searchForm','search_form','search','Search','search-form','searchform2'); 25 } 26 else if (lwp_el_type == 'INPUT') 27 { 28 lwp_search_id = new Array('s','search','search-text','search-input','Search','searchbox','q'); 29 30 } 31 32 for (var i in lwp_search_id) 33 { 34 35 if (document.getElementById(lwp_search_id[i]) && document.getElementById(lwp_search_id[i]).tagName == lwp_el_type) 36 { 37 if (lwp_el_type == 'INPUT'&& lwp_method == 'id') 38 { 39 lwp_obj = document.getElementById(lwp_search_id[i]); 40 if (!lwp_obj) 41 { 42 lwp_obj = document.getElementsByName(lwp_search_id[i])[0]; 43 } 44 var lwp_both = new Array(lwp_obj,lwp_pnode(lwp_obj,'form')); 45 return lwp_both; 46 } 47 else 48 { 49 return document.getElementById(lwp_search_id[i]); 50 } 51 52 } 53 else 54 { 55 if (lwp_el_type == 'INPUT'&& lwp_method == 'id') 56 { 57 58 lwp_obj = document.getElementsByName(lwp_search_id[i])[0]; 59 var lwp_both = new Array(lwp_obj,lwp_pnode(lwp_obj,'form')); 60 return lwp_both; 61 } 62 else if (lwp_el_type == 'INPUT' && lwp_method == '') 63 { 64 65 lwp_obj = document.getElementsByName(lwp_search_id[i])[0]; 66 return lwp_obj; 67 } 68 } 69 } 70 71 return false; 72} 73 74function lwp_hijack_search() { 75 76 var lwp_formId = lwp_findElem('FORM','id'); 77 if (!lwp_formId) 78 { 79 var lwp_finder= lwp_findElem('INPUT','id'); 80 inputText = lwp_finder[0]; 81 lwp_formId = lwp_finder[1]; 82 inputText.value = 'Lijit Search'; 83 inputText.onblur = function(){if (inputText.value == ''){inputText.value = 'Lijit Search';}}; 84 inputText.onfocus = function(){if (inputText.value == 'Lijit Search'){inputText.value = '';}}; 85 86 try 87 { 88 lwp_formId.onsubmit = lwp_hijack_submit; 89 } 90 catch(err) 91 { 92 93 } 94 } 95 else 96 { 97 var inputText= lwp_findElem('INPUT',''); 98 inputText.value = 'Lijit Search'; 99 inputText.onblur = function(){if (inputText.value == ''){inputText.value = 'Lijit Search';}}; 100 inputText.onfocus = function(){if (inputText.value = 'Lijit Search'){inputText.value = '';}}; 101 102 try 103 { 104 105 lwp_formId.onsubmit = lwp_hijack_submit; 106 } 107 catch(err) 108 { 109 110 } 111 } 112 113} 114// do the search 115function lwp_hijack_submit(e) { 116 var lwp_inputText = lwp_findElem('INPUT',''); 117 lwp_dosearch(lwp_inputText.value); 118 return false; 119} 120
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.