1//æ¤ç´¢ãµã¤ã 2var engines = { 3 'google' : 'http://www.google.co.jp/search', 4 'yahoo' : 'http://search.yahoo.co.jp/search', 5 'msn' : 'http://search.live.com/results.aspx' 6} 7 8//æ¤ç´¢ãã©ã¼ã è¨ç½®ãã¼ã¸ã®æåã³ã¼ã 9//var code = 'UTF-8'; 10var code = 'UTF-8'; 11 12//ãµã¤ãå æ¤ç´¢æã®URL 13//ãµã¤ãå æ¤ç´¢ã®ã¿ã«ãããå ´åã¯ããã«è¨è¿° 14//crossSearch()ãå¼ã³åºãæã®æå®ãåªå ããã¾ã 15var searchUrl = ''; 16 17//ã¨ã³ã¸ã³æ¯ã®å¤ãæ ¼ç´ããBOX 18//ä»ã®IDã¨ãã¶ããªããããªæååã«ãã 19var boxName = 'crossSearchBoxHidden'; 20 21 22//æ¤ç´¢èªæªå ¥åæã®ã¢ã©ã¼ã 23//nullã«ããã¨ã¢ã©ã¼ããåºããªã 24//var nonSearchValue = null; 25var nonSearchValue = 'æ¤ç´¢å 容ãå ¥åãã¦ãã ããã'; 26 27 28var engine; 29var searchValue; 30var box; 31 32function crossSearch(formElm, target, searchElm, siteURL) 33{ 34 //crossSearch()å¼ã³åºãæã®ä¾å¤å¦ç 35 if (!engines[target]) { 36 alert('æ¤ç´¢ãµã¤ããæ£ããæå®ãã¦ãã ããã'); 37 return false; 38 } 39 engine = target; 40 //actionã®ã»ãã 41 formElm.action = engines[engine]; 42 var elem = document.getElementById(searchElm); 43 //æ¤ç´¢å 容ãã»ãããã¦ãå ã¯ç©ºã«ãã 44 searchValue = elem.value; 45// elem.value = null; 46 // 47 searchUrl = (siteURL)? siteURL: ''; 48 49 //æªå ¥åã®å¦ç 50 if (searchValue == '' && nonSearchValue) { 51 alert(nonSearchValue); 52 return false; 53 } 54 55 //ãã©ã¼ã ã«Boxãã»ãã ãã§ã«ããå ´åã¯childNodesãåé¤ 56 box = document.getElementById(boxName); 57 if (box) { 58 if (box.childNodes) { 59 while (box.firstChild) 60 { 61 box.removeChild(box.firstChild); 62 }; 63 } 64 } else { 65 box = document.createElement('div'); 66 _setAttributes(box, {'id': 'crossSearchBoxHidden', 'style': 'display:none;'}); 67 formElm.appendChild(box); 68 } 69 _setSearchElements(); 70 formElm.submit(); 71} 72 73 74function _setAttributes(elm, obj) 75{ 76 var key; 77 for (key in obj) { 78 elm.setAttribute(key, obj[key]); 79 } 80} 81 82function _setSearchElements() 83{ 84 //google 85 if (engine == 'google') { 86 var qElm = document.createElement('input'); 87 _setAttributes(qElm, {'type': 'hidden', 'name': 'q', 'value': searchValue}); 88 box.appendChild(qElm); 89 var hlElm = document.createElement('input'); 90 _setAttributes(hlElm, {'type': 'hidden', 'name': 'hl', 'value': 'ja'}); 91 box.appendChild(hlElm); 92 if (searchUrl) { 93 var sitesearchElm = document.createElement('input'); 94 _setAttributes(sitesearchElm, {'type': 'hidden', 'name': 'sitesearch', 'value': searchUrl}); 95 box.appendChild(sitesearchElm); 96 var sitesearchDElm = document.createElement('input'); 97 _setAttributes(sitesearchDElm, {'type': 'hidden', 'name': 'domains', 'value': searchUrl}); 98 box.appendChild(sitesearchDElm); 99 } 100 var ieElm = document.createElement('input'); 101 _setAttributes(ieElm, {'type': 'hidden', 'name': 'ie', 'value': code}); 102 box.appendChild(ieElm); 103 var oeElm = document.createElement('input'); 104 _setAttributes(oeElm, {'type': 'hidden', 'name': 'oe', 'value': code}); 105 box.appendChild(oeElm); 106 } 107 108 //yahoo 109 if (engine == 'yahoo') { 110 var pElm = document.createElement('input'); 111 _setAttributes(pElm, {'type': 'hidden', 'name': 'p', 'value': searchValue}); 112 box.appendChild(pElm); 113 var eiElm = document.createElement('input'); 114 _setAttributes(eiElm, {'type': 'hidden', 'name': 'ei', 'value': code}); 115 box.appendChild(eiElm); 116 if (searchUrl) { 117 var vsElm = document.createElement('input'); 118 _setAttributes(vsElm, {'type': 'hidden', 'name': 'vs', 'value': searchUrl}); 119 box.appendChild(vsElm); 120 var frElm = document.createElement('input'); 121 _setAttributes(frElm, {'type': 'hidden', 'name': 'fr', 'value': 'ysin'}); 122 box.appendChild(frElm); 123 } else { 124 var frElm = document.createElement('input'); 125 _setAttributes(frElm, {'type': 'hidden', 'name': 'fr', 'value': 'yssn'}); 126 box.appendChild(frElm); 127 } 128 } 129 130 //msn 131 if (engine == 'msn') { 132 var qElm = document.createElement('input'); 133 _setAttributes(qElm, {'type': 'hidden', 'name': 'q', 'value': searchValue}); 134 box.appendChild(qElm); 135 var cpElm = document.createElement('input'); 136 _setAttributes(cpElm, {'type': 'hidden', 'name': 'cp', 'value': _getCodeMSN()}); 137 box.appendChild(cpElm); 138 if (searchUrl) { 139 var q1Elm = document.createElement('input'); 140 _setAttributes(q1Elm, {'type': 'hidden', 'name': 'q1', 'value': 'q1=site:' + searchUrl}); 141 box.appendChild(q1Elm); 142 } 143 } 144 145} 146 147function _getCodeMSN() 148{ 149 var cp; 150 if (code == 'UTF-8') cp = 65001; 151 if (code == 'Shift_JIS') cp = 932; 152 return cp; 153} 154 155 156 157/* 158yahooæ¤ç´¢ã®ãã©ã¡ã¼ã¿ãfrãã«ã¤ã㦠1592008.07.28ç¾å¨ãfrã«æ¸¡ãå¤ã¯ä»¥ä¸ã®ãã®ãããã 160ãããã¯ãè¨ç½®ããæ¤ç´¢ããã¯ã¹ã®ã¿ã¤ãã«å¯¾å¿
160ãã¦ããã 161frã®æç¡ã«ãã£ã¦æ¤ç´¢çµæã¯å¤ãããªãæ§åã 162æ¤ç´¢æã«ç»é¢ã«è¡¨ç¤ºããã³ã³ãã³ããå¤åããã®ããªï¼ 163http://search.yahoo.co.jp/promo/searchbox.html 164 165ã¦ã§ãæ¤ç´¢ 166 ysswb æ¨æºãµã¤ãºï¼Yahoo! JAPANæ¨æºã¹ã¿ã¤ã«ï¼ 167 yssw æ¨æºãµã¤ãº 168 yssnb ãµã¤ããã¼ãµã¤ãºï¼Yahoo! JAPANæ¨æºã¹ã¿ã¤ã«ï¼ 169 yssn ãµã¤ããã¼ãµã¤ãº 170 171ãµã¤ãå æ¤ç´¢ 172 ysiwb æ¨æºãµã¤ãºï¼Yahoo! JAPANæ¨æºã¹ã¿ã¤ã«ï¼ 173 ysiw æ¨æºãµã¤ãº 174 ysinb ãµã¤ããã¼ãµã¤ãºï¼Yahoo! JAPANæ¨æºã¹ã¿ã¤ã«ï¼ 175 ysin ãµã¤ããã¼ãµã¤ãº 176 177ãã«ãæ¤ç´¢ 178 ysvw æ¨æºãµã¤ãº 179 ysvn ãµã¤ããã¼ãµã¤ãº 180 181 182 183*/ 184
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.