1/* 22017-11-10 æå¥æ©ä¸èªªå¯ä»¥éç¼jsççæ¬ 3ä½¿ç¨æ¹å¼ 4<script type="text/javascript"> 5 var ml_key = 'en'; // ç¶åèªç³» 6</script> 7<script src="t.js"></script> 8<script type="text/javascript"> 9 alert(t.get('å¯ä»¥ä¸çäºåï¼','tw')); 10</script> 11 */ 12 13// https://stackoverflow.com/questions/8567114/how-to-make-an-ajax-call-without-jquery#18078705 14var ttx = {}; 15ttx.x = function () { 16 if (typeof XMLHttpRequest !== 'undefined') { 17 return new XMLHttpRequest(); 18 } 19 var versions = [ 20 "MSXML2.XmlHttp.6.0", 21 "MSXML2.XmlHttp.5.0", 22 "MSXML2.XmlHttp.4.0", 23 "MSXML2.XmlHttp.3.0", 24 "MSXML2.XmlHttp.2.0", 25 "Microsoft.XmlHttp" 26 ]; 27 28 var xhr; 29 for (var i = 0; i < versions.length; i++) { 30 try { 31 xhr = new ActiveXObject(versions[i]); 32 break; 33 } catch (e) { 34 } 35 } 36 return xhr; 37}; 38 39ttx.send = function (url, callback, method, data, async) { 40 if (async === undefined) { 41 async = true; 42 } 43 var x = ttx.x(); 44 x.open(method, url, async); 45 x.onreadystatechange = function () { 46 if (x.readyState == 4) { 47 callback(x.responseText) 48 } 49 }; 50 if (method == 'POST') { 51 x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); 52 } 53 x.send(data) 54 return x.responseText; 55}; 56 57ttx.get = function (url, data, callback, async) { 58 var query = []; 59 for (var key in data) { 60 query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key])); 61 } 62 ttx.send(url + (query.length ? '?' + query.join('&') : ''), callback, 'GET', null, async) 63}; 64 65ttx.post = function (url, data, callback, async) { 66 var query = []; 67 for (var key in data) { 68 query.push(encodeURIComponent(key) + '=' + encodeURIComponent(data[key])); 69 } 70 return ttx.send(url, callback, 'POST', query.join('&'), async) 71}; 72function Languageb(multilanguage){ 73 this.ml_key = multilanguage; 74 this.get = getb; 75} 76function getb(text, source){ 77 // var ggg = labels2[this.ml_key][text.toLowerCase()]; 78 // if(source == this.ml_key){ 79 // return text; 80 // } else if(ggg == undefined){ 81 // var aaa = ttx.post('/translate.php', { 82 // t:'', 83 // text: text, 84 // source: source, 85 // target: this.ml_key 86 // }, 87 // function(responseText) { 88 // return responseText; 89 // }, 90 // false // non async 91 // ); 92 // return aaa; 93 // } else { 94 // return text; 95 // } 96 97 // var aaa = ttx.post('/translate.php', { 98 // t:'', 99 // text: text, 100 // source: source, 101 // target: this.ml_key 102 // }, 103 // function(responseText) { 104 // return responseText; 105 // }, 106 // false // non async 107 // ); 108 // return aaa; 109 110 var ggg = labels2[this.ml_key][text.toLowerCase()]; 111 if(source == this.ml_key){ 112 return text; 113 } else if(ggg == undefined){ 114 return text; 115 } else { 116 return ggg; 117 } 118 119} 120var t = new Languageb(ml_key); 121 122// alert(t.get('åç'));
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.