translate_c.js
来自「短消息服务( SMS )的定义是基于文本的服务」· JavaScript 代码 · 共 136 行 · 第 1/5 页
JS
136 行
tn_l.prototype.removeChild=function(a){var b=[];for(var c=0;c<this.childNodes.length;++c){var d=this.childNodes[c];if(d!=a)b.push(d);else{if(d.previousSibling)d.previousSibling.nextSibling=d.nextSibling;if(d.nextSibling)d.nextSibling.previousSibling=d.previousSibling;if(this.firstChild==d)this.firstChild=d.nextSibling;if(this.lastChild==d)this.lastChild=d.previousSibling}}this.childNodes=b};tn_l.prototype.hasAttributes=function(){return this.attributes.length>0};tn_l.prototype.setAttribute=function(a,b){for(var c=0;c<this.attributes.length;++c)if(this.attributes[c].nodeName==a){this.attributes[c].nodeValue=""+b;return}this.attributes.push(tn_l.create(2,a,b,this))};tn_l.prototype.getAttribute=function(a){for(var b=0;b<this.attributes.length;++b)if(this.attributes[b].nodeName==a)return this.attributes[b].nodeValue;return tn_b};tn_l.prototype.removeAttribute=function(a){var b=[];for(var c=0;c<this.attributes.length;++c)this.attributes[c].nodeName!=a&&b.push(this.attributes[c]);this.attributes=b};tn_l.prototype.getElementsByTagName=function(a){var b=[];tn_4a(this,function(c){c.nodeName==a&&b.push(c)},tn_b);return b};tn_l.prototype.getElementById=function(a){var b=tn_b;tn_4a(this,function(c){if(c.getAttribute("id")==a){b=c;return tn_a}},tn_b);return b};function tn_k(){tn_l.call(this,9,"#document",tn_b,tn_b);this.documentElement=tn_b}tn_k.prototype=new tn_l(9,"#document");tn_k.prototype.clear=function(){tn_l.recycle(this.documentElement);this.documentElement=tn_b};tn_k.prototype.appendChild=function(a){tn_l.prototype.appendChild.call(this,a);this.documentElement=this.childNodes[0]};tn_k.prototype.createElement=function(a){return tn_l.create(1,a,tn_b,this)};tn_k.prototype.createDocumentFragment=function(){return tn_l.create(11,"#document-fragment",tn_b,this)};tn_k.prototype.createTextNode=function(a){return tn_l.create(3,"#text",a,this)};tn_k.prototype.createAttribute=function(a){return tn_l.create(2,a,tn_b,this)};tn_k.prototype.createComment=function(a){return tn_l.create(8,"#comment",a,this)};tn_k.prototype.createCDATASection=function(a){return tn_l.create(4,"#cdata-section",a,this)};function tn_5a(a,b){tn_6a(new tn_m(a,b),b)}function tn_6a(a,b){var c=b.getAttribute("select");if(c){b.removeAttribute("select");tn_7a(a,b,c)}else{var d=b.getAttribute("display");if(d)if(tn_8a(d,a).d())b.removeAttribute("display");else{b.parentNode.removeChild(b);return}var e=b.getAttribute("values");if(e){b.removeAttribute("values");tn_9a(a,b,e)}var f=b.getAttribute("transclude");if(f){var h=tn_$a(f,b.ownerDocument);if(h){b.parentNode.replaceChild(h,b);tn_6a(a,h)}else b.parentNode.removeChild(b);tn_l.recycle(b)}else{var i=b.getAttribute("content");if(i){b.removeAttribute("content");tn_ab(a,b,i)}else{var k=[];for(var j=0;j<b.childNodes.length;++j)b.childNodes[j].nodeType==1&&k.push(b.childNodes[j]);for(var j=0;j<k.length;++j)tn_6a(a,k[j])}}}}function tn_7a(a,b,c){var d=c.split(/;/),e=tn_8a(d[0],a).c();if(e.length>0){var f=[];for(var h=1;h<e.length;++h){var i=tn_La(b.ownerDocument,b);f.push(i);b.parentNode.insertBefore(i,b)}f.push(b);var k=[];for(var j=1;j<d.length;++j){var g=d[j],l=0,o;if(g.charAt(l)=="#"){o="number";l++}else o="text";var q;if(g.charAt(l)=="-"){q="descending";l++}else q="ascending";var s=tn_bb(d[j].substr(l));k.push({expr:s,type:o,order:q})}var r=a.clone(e[0],0,e);tn_cb(r,k);for(var h=0;h<r.r();++h)r.nodelist[h].nodeType==1&&tn_6a(r.clone(r.nodelist[h],h),f[h])}else b.parentNode.removeChild(b)}function tn_9a(a,b,c){var d=c.split(/;/);for(var e=0;e<d.length;++e){var f=d[e].indexOf(":");if(!(f<0)){var h=d[e].substr(0,f),i=tn_8a(d[e].substr(f+1),a);if(h.charAt(0)=="$")a.ka(h.substr(1),i);else h&&tn_Va(b,h,i.a())}}}function tn_ab(a,b,c){while(b.firstChild)b.removeChild(b.firstChild);var d=tn_8a(c,a);if(d.type=="node-set")for(var e=0;e<d.value.length;++e){var f=d.value[e];if(f.nodeType==1)for(var h=f.firstChild;h;h=h.nextSibling){var i=tn_La(b.ownerDocument,h);b.appendChild(i)}else if(f.nodeType==2){var k=b.ownerDocument.createTextNode(f.nodeValue);b.appendChild(k)}}else{var k=tn_Xa(b.ownerDocument,d.a());b.appendChild(k)}}function tn_8a(a,b){var c=tn_bb(a),d=c.evaluate(b);return d}function tn_$a(a,b){var c=b.getElementById(a);if(c){var d=tn_La(b,c);return d}else return tn_b};function tn_bb(a){tn_db();var b=tn_eb[a];if(b)return b;if(a.match(/^(\$|@)?\w+$/i)){var c=tn_fb(a);return tn_eb[a]=c}if(a.match(/^\w+(\/\w+)*$/i)){var c=tn_gb(a);return tn_eb[a]=c}var d=a,e=[],f=tn_b,h=tn_b,i=tn_a,k=0,j=0,g=0;while(!i){k++;a=a.replace(/^\s*/,"");h=f;var l=f=tn_b,o="";for(var q=0;q<tn_hb.length;++q){var s=tn_hb[q].re.exec(a);j++;if(s&&s.length>0&&s[0].length>o.length){l=tn_hb[q];o=s[0];break}}if(l&&(l==tn_ib||l==tn_jb||l==tn_kb||l==tn_lb)&&(!h||h.tag==tn_mb||h.tag==tn_n||h.tag==tn_o||h.tag==tn_nb||h.tag==tn_ob))l=tn_pb;if(l){a=a.substr(o.length);f={tag:l,match:o,prec:l.prec?l.prec:0,expr:new tn_qb(o)}}else i=tn_;while(tn_rb(e,f)){g++;tn_Ka("stack: "+tn_sb(e))}}tn_Ka("stack: "+tn_sb(e));e.length!=1&&tn_g("XPath parse error "+d+":\n"+tn_sb(e));var s=e[0].expr;return tn_eb[d]=s}var tn_eb={};function tn_rb(a,b){var c=tn_b;if(a.length>0){var d=a[a.length-1],e=tn_tb[d.tag.key];if(e)for(var f=0;f<e.length;++f){var h=e[f],i=tn_ub(a,h[1]);if(i.length){c={tag:h[0],rule:h,match:i};c.prec=tn_vb(c);break}}}var k;if(c&&(!b||c.prec>b.prec||b.tag.left&&c.prec>=b.prec)){for(var f=0;f<c.match.matchlength;++f)a.pop();var j=tn_Oa(c.match,function(g){return g.expr});c.expr=c.rule[3].apply(tn_b,j);a.push(c);k=tn_}else{b&&a.push(b);k=tn_a}return k}function tn_ub(a,b){var c=a.length,d=b.length,e,f,h=[];var i=h.matchlength=0;for(e=d-1,f=c-1;e>=0&&f>=0;--e,f-=i){i=0;var k=[];if(b[e]==tn_wb){e-=1;h.push(k);while(f-i>=0&&a[f-i].tag==b[e]){k.push(a[f-i]);i+=1;h.matchlength+=1}}else if(b[e]==tn_xb){e-=1;h.push(k);while(f-i>=0&&i<2&&a[f-i].tag==b[e]){k.push(a[f-i]);i+=1;h.matchlength+=1}}else if(b[e]==tn_yb){e-=1;h.push(k);if(a[f].tag==b[e])while(f-i>=0&&a[f-i].tag==b[e]){k.push(a[f-i]);i+=1;h.matchlength+=1}else return[]}else if(a[f].tag==b[e]){h.push(a[f]);i+=1;h.matchlength+=1}else return[];tn_Pa(k);k.expr=tn_Oa(k,function(j){return j.expr})}tn_Pa(h);return e==-1?h:[]}function tn_vb(a){var b=0;if(a.rule)if(a.rule.length>=3&&a.rule[2]>=0)b=a.rule[2];else for(var c=0;c<a.rule[1].length;++c){var d=a.rule[1][c].prec||2;b=Math.max(b,d)}else if(a.tag)b=a.tag.prec||2;else if(a.length)for(var e=0;e<a.length;++e){var d=tn_vb(a[e]);b=Math.max(b,d)}return b}function tn_sb(a){var b="";for(var c=0;c<a.length;++c){if(b)b+="\n";b+=a[c].tag.label}return b}function tn_m(a,b,c,d,e){this.node=a;this.stylesheet=b||tn_b;this.position=c||0;this.nodelist=d||[a];this.variables={};this.parent=e||tn_b;this.root=e?e.root:this.node.nodeType==9?a:a.ownerDocument}tn_m.prototype.clone=function(a,b,c){return new tn_m(a||this.node,this.stylesheet,typeof b!="undefined"?b:this.position,c||this.nodelist,this)};tn_m.prototype.ka=function(a,b){this.variables[a]=b};tn_m.prototype.G=function(a){return typeof this.variables[a]!="undefined"?this.variables[a]:this.parent?this.parent.G(a):tn_b};tn_m.prototype.Ma=function(a){this.node=this.nodelist[a];this.position=a};tn_m.prototype.r=function(){return this.nodelist.length};function tn_p(a){this.value=a;this.type="string"}tn_p.prototype.a=function(){return this.value};tn_p.prototype.d=function(){return this.value.length>0};tn_p.prototype.b=function(){return this.value-0};tn_p.prototype.c=function(){tn_g(this)};function tn_q(a){this.value=a;this.type="boolean"}tn_q.prototype.a=function(){return""+this.value};tn_q.prototype.d=function(){return this.value};tn_q.prototype.b=function(){return this.value?1:0};tn_q.prototype.c=function(){tn_g(this)};function tn_r(a){this.value=a;this.type="number"}tn_r.prototype.a=function(){return""+this.value};tn_r.prototype.d=function(){return!!this.value};tn_r.prototype.b=function(){return this.value-0};tn_r.prototype.c=function(){tn_g(this)};function tn_s(a){this.value=a;this.type="node-set"}tn_s.prototype.a=function(){return this.value.length==0?"":tn_j(this.value[0])};tn_s.prototype.d=function(){return this.value.length>0};tn_s.prototype.b=function(){return this.a()-0};tn_s.prototype.c=function(){return this.value};function tn_qb(a){this.value=a}tn_qb.prototype.evaluate=function(){return new tn_p(this.value)};function tn_t(){this.absolute=tn_a;this.rootExpr=tn_b;this.steps=[]}tn_t.prototype.j=function(a){this.steps.push(a)};tn_t.prototype.ia=function(a){this.steps.unshift(a)};tn_t.prototype.evaluate=function(a){var b;b=this.rootExpr?this.rootExpr.evaluate(a).c():this.absolute?[a.root]:[a.node];var c=[];for(var d=0;d<b.length;++d){var e=b[d];tn_zb(c,this.steps,0,e,a)}return new tn_s(c)};function tn_zb(a,b,c,d,e){var f=b[c],h=e.clone(d),i=f.evaluate(h).c();for(var k=0;k<i.length;++k)c==b.length-1?a.push(i[k]):tn_zb(a,b,c+1,i[k],e)}function tn_u(a,b,c){this.axis=a;this.nodetest=b;this.predicate=c||[]}tn_u.prototype.qa=function(a){this.predicate.push(a)};tn_u.prototype.evaluate=function(a){var b=a.node,c=[];if(this.axis==tn_v.ANCESTOR_OR_SELF){c.push(b);for(var d=b.parentNode;d;d=d.parentNode)c.push(d)}else if(this.axis==tn_v.ANCESTOR)for(var d=b.parentNode;d;d=d.parentNode)c.push(d);else if(this.axis==tn_v.ATTRIBUTE)tn_Qa(c,b.attributes);else if(this.axis==tn_v.CHILD)tn_Qa(c,b.childNodes);else if(this.axis==tn_v.DESCENDANT_OR_SELF){c.push(b);tn_Ab(c,b)}else if(this.axis==tn_v.DESCENDANT)tn_Ab(c,b);else if(this.axis==tn_v.FOLLOWING)for(var d=b;d;d=d.parentNode)for(var e=d.nextSibling;e;e=e.nextSibling){c.push(e);tn_Ab(c,e)}else if(this.axis==tn_v.FOLLOWING_SIBLING)for(var d=b.nextSibling;d;d=d.nextSibling)c.push(d);else if(this.axis==tn_v.NAMESPACE)tn_g("not implemented: axis namespace");else if(this.axis==tn_v.PARENT)b.parentNode&&c.push(b.parentNode);else if(this.axis==tn_v.PRECEDING)for(var d=b;d;d=d.parentNode)for(var e=d.previousSibling;e;e=e.previousSibling){c.push(e);tn_Bb(c,e)}else if(this.axis==tn_v.PRECEDING_SIBLING)for(var d=b.previousSibling;d;d=d.previousSibling)c.push(d);else this.axis==tn_v.SELF?c.push(b):tn_g("ERROR -- NO SUCH AXIS: "+this.axis);var f=c;c=[];for(var h=0;h<f.length;++h){var d=f[h];this.nodetest.evaluate(a.clone(d,h,f)).d()&&c.push(d)}for(var h=0;h<this.predicate.length;++h){var f=c;c=[];for(var i=0;i<f.length;++i){var d=f[i];this.predicate[h].evaluate(a.clone(d,i,f)).d()&&c.push(d)}}return new tn_s(c)};function tn_Cb(){this.value=new tn_q(tn_)}tn_Cb.prototype.evaluate=function(){return this.value};function tn_Db(){}tn_Db.prototype.evaluate=function(a){return new tn_q(a.node.nodeType==1||a.node.nodeType==2)};function tn_Eb(){}tn_Eb.prototype.evaluate=function(a){return new tn_q(a.node.nodeType==3)};function tn_Fb(){}tn_Fb.prototype.evaluate=function(a){return new tn_q(a.node.nodeType==8)};function tn_Gb(a){this.target=a}tn_Gb.prototype.evaluate=function(a){return new tn_q(a.node.nodeType==7&&(!this.target||a.node.nodeName==this.target))};function tn_Hb(a){this.regex=new RegExp("^"+a+":");this.nsprefix=a}tn_Hb.prototype.evaluate=function(a){var b=a.node;return new tn_q(this.regex.test(b.nodeName))};function tn_Ib(a){this.name=a}tn_Ib.prototype.evaluate=function(a){var b=a.node;return new tn_q(b.nodeName==this.name)};function tn_Jb(a){this.expr=a}tn_Jb.prototype.evaluate=function(a){var b=this.expr.evaluate(a);return b.type=="number"?new tn_q(a.position==b.b()-1):new tn_q(b.d())};function tn_Kb(a){this.name=a;this.args=[]}tn_Kb.prototype.W=function(a){this.args.push(a)};tn_Kb.prototype.evaluate=function(a){var b=""+this.name.value,c=this.xpathfunctions[b];return c?c.call(this,a):new tn_q(tn_a)};tn_Kb.prototype.xpathfunctions={last:function(a){tn_f(this.args.length==0);return new tn_r(a.r())},position:function(a){tn_f(this.args.length==0);return new tn_r(a.position+1)},count:function(a){tn_f(this.args.length==1);var b=this.args[0].evaluate(a);return new tn_r(b.c().length)},id:function(a){tn_f(this.args.length==1);var b=this.args[0].evaluate(a),c=[],d;if(b.type=="node-set"){d=[];var e=b.c();for(var f=0;f<e.length;++f){var h=tn_j(e[f]).split(/\s+/);for(var i=0;i<h.length;++i)d.push(h[i])}}else d=
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?