WebPortal_TongZhou/02.UI/script/xheditor-1.1.11/xheditor-1.1.11-en.min.js

(开头部分) 58KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

(function(e,ha){if(window.xheditor)return false;var eb=navigator.userAgent.toLowerCase(),yb=eb.indexOf("mobile")!==-1,qa=e.browser,Ca=parseFloat(qa.version),y=qa.msie,Da=qa.mozilla,Y=qa.safari,fb=qa.opera,zb=eb.indexOf(" adobeair/")>-1;e.fn.xheditor=function(B){if(yb)return false;var A=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(B===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(this.xheditor)A.push(this.xheditor);else{var J=/({.*})/.exec(e(this).attr("class"));
if(J){try{J=eval("("+J[1]+")")}catch(Qa){}B=e.extend({},J,B)}J=new Ea(this,B);if(J.init()){this.xheditor=J;A.push(J)}}});if(A.length===0)A=false;if(A.length===1)A=A[0];return A};var ia=0,Z=false,Fa=true,Ga=false,gb=false,M,ra,sa,ja,S,Ra,ka,Sa,Ta,Ua,T;e("script[src*=xheditor]").each(function(){var B=this.src;if(B.match(/xheditor[^\/]*\.js/i)){T=B.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});if(y)try{document.execCommand("BackgroundImageCache",false,true)}catch(Mb){}var Ab=
{27:"esc",9:"tab",32:"space",13:"enter",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},hb=["#FFFFFF","#CCCCCC","#C0C0C0","#999999","#666666","#333333","#000000","#FFCCCC","#FF6666","#FF0000","#CC0000","#990000","#660000","#330000","#FFCC99","#FF9966","#FF9900","#FF6600",
"#CC6600","#993300","#663300","#FFFF99","#FFFF66","#FFCC66","#FFCC33","#CC9933","#996633","#663333","#FFFFCC","#FFFF33","#FFFF00","#FFCC00","#999900","#666600","#333300","#99FF99","#66FF99","#33FF33","#33CC00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366",
"#330033"],Bb=[{n:"p",t:"Paragraph"},{n:"h1",t:"Heading 1"},{n:"h2",t:"Heading 2"},{n:"h3",t:"Heading 3"},{n:"h4",t:"Heading 4"},{n:"h5",t:"Heading 5"},{n:"h6",t:"Heading 6"},{n:"pre",t:"Preformatted"},{n:"address",t:"Address"}],Cb=[{n:"Arial"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],$=[{n:"x-small",s:"10px",t:"1"},{n:"small",s:"13px",t:"2"},{n:"medium",s:"16px",t:"3"},{n:"large",s:"18px",t:"4"},{n:"x-large",s:"24px",t:"5"},
{n:"xx-large",s:"32px",t:"6"},{n:"-webkit-xxx-large",s:"48px",t:"7"}],Db=[{s:"Align left",v:"justifyleft"},{s:"Align center",v:"justifycenter"},{s:"Align right",v:"justifyright"},{s:"Align full",v:"justifyfull"}],Eb=[{s:"Ordered list",v:"insertOrderedList"},{s:"Unordered list",v:"insertUnorderedList"}],Fb={"default":{name:"Default",width:24,height:24,line:7,list:{smile:"Smile",tongue:"Tongue",titter:"Titter",laugh:"Laugh",sad:"Sad",wronged:"Wronged",fastcry:"Fast cry",cry:"Cry",wail:"Wail",mad:"Mad",
knock:"Knock",curse:"Curse",crazy:"Crazy",angry:"Angry",ohmy:"Oh my",awkward:"Awkward",panic:"Panic",shy:"Shy",cute:"Cute",envy:"Envy",proud:"Proud",struggle:"Struggle",quiet:"Quiet",shutup:"Shut up",doubt:"Doubt",despise:"Despise",sleep:"Sleep",bye:"Bye"}}},ta={Cut:{t:"Cut (Ctrl+X)"},Copy:{t:"Copy (Ctrl+C)"},Paste:{t:"Paste (Ctrl+V)"},Pastetext:{t:"Paste as plain text",h:y?0:1},Blocktag:{t:"Block tag",h:1},Fontface:{t:"Font family",h:1},FontSize:{t:"Font size",h:1},Bold:{t:"Bold (Ctrl+B)",s:"Ctrl+B"},
Italic:{t:"Italic (Ctrl+I)",s:"Ctrl+I"},Underline:{t:"Underline (Ctrl+U)",s:"Ctrl+U"},Strikethrough:{t:"Strikethrough"},FontColor:{t:"Select text color",h:1},BackColor:{t:"Select background color",h:1},SelectAll:{t:"SelectAll (Ctrl+A)"},Removeformat:{t:"Remove formatting"},Align:{t:"Align",h:1},List:{t:"List",h:1},Outdent:{t:"Outdent"},Indent:{t:"Indent"},Link:{t:"Insert/edit link (Ctrl+L)",s:"Ctrl+L",h:1},Unlink:{t:"Unlink"},Anchor:{t:"Anchor",h:1},Img:{t:"Insert/edit image",h:1},Flash:{t:"Insert/edit flash",
h:1},Media:{t:"Insert/edit media",h:1},Hr:{t:"Horizontal rule"},Emot:{t:"Emotions",s:"ctrl+e",h:1},Table:{t:"Insert a new table",h:1},Source:{t:"Edit source code"},Preview:{t:"Preview"},Print:{t:"Print (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"Toggle fullscreen (Esc)",s:"Esc"},About:{t:"About xhEditor"}},Va={mini:"Bold,Italic,Underline,Strikethrough,|,Align,List,|,Link,Img",simple:"Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,|,Align,List,Outdent,Indent,|,Link,Img,Emot",
full:"Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Media,Hr,Emot,Table,|,Source,Preview,Print,Fullscreen"};Va.mfull=Va.full.replace(/\|(,Align)/i,"/$1");var Gb={a:"Link",img:"Img",embed:"Embed"},Hb={"<":"&lt;",">":"&gt;",'"':"&quot;","\u00ae":"&reg;","\u00a9":"&copy;"},Ib=/[<>"\u00ae\u00a9]/g,Ea=function(B,A){function J(a){a=a.target;var b=Gb[a.tagName.toLowerCase()];
if(b){if(b==="Embed")b={"application/x-shockwave-flash":"Flash","application/x-mplayer2":"Media"}[a.type.toLowerCase()];d.exec(b)}}function Qa(a){if(a.which===27){if(Ga)d.removeModal();else Z&&d.hidePanel();return false}}function ib(){setTimeout(d.setSource,10)}function aa(){d.getSource()}function jb(a){var b,c,g;if(a&&(b=a.originalEvent.clipboardData)&&(c=b.items)&&(g=c[0])&&g.kind=="file"&&g.type.match(/^image\//i)){a=g.getAsFile();b=new FileReader;b.onload=function(){var j='<img src="'+event.target.result+
'">';j=kb(j);d.pasteHTML(j)};b.readAsDataURL(a);return false}var m=p.cleanPaste;if(m===0||G||Wa)return true;Wa=true;d.saveBookmark();a=y?"pre":"div";var n=e("<"+a+' class="xhe-paste">\ufeff\ufeff</'+a+">",v).appendTo(v.body);a=n[0];b=d.getSel();c=d.getRng(true);n.css("top",ba.scrollTop());if(y){c.moveToElementText(a);c.select()}else{c.selectNodeContents(a);b.removeAllRanges();b.addRange(c)}setTimeout(function(){var j=m===3,i;if(j)i=n.text();else{var l=[];e(".xhe-paste",v.body).each(function(f,h){e(h).find(".xhe-paste").length==
0&&l.push(h.innerHTML)});i=l.join("<br />")}n.remove();d.loadBookmark();if(j)d.pasteText(i);else{i=d.cleanHTML(i);i=d.cleanWord(i);i=d.formatXHTML(i);if(!p.onPaste||p.onPaste&&(i=p.onPaste(i))!==false){i=kb(i);d.pasteHTML(i)}}Wa=false},0)}function kb(a){var b=p.localUrlTest,c=p.remoteImgSaveUrl;if(b&&c){var g=[],m=0;a=a.replace(/(<img)((?:\s+[^>]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig,function(n,j,i,l,f){if(/^(https?|data:image)/i.test(l)&&!b.test(l)){g[m]=l;i=i.replace(/\s+(width|height)="[^"]*"/ig,
"").replace(/\s+src="[^"]*"/ig,' src="'+Ha+'img/waiting.gif" remoteimg="'+m++ +'"')}return j+i+f});g.length>0&&e.post(c,{urls:g.join("|")},function(n){n=n.split("|");e("img[remoteimg]",d.doc).each(function(){var j=e(this);U(j,"src",n[j.attr("remoteimg")]);j.removeAttr("remoteimg")})})}return a}function Xa(a){try{d._exec("styleWithCSS",a,true)}catch(b){try{d._exec("useCSS",!a,true)}catch(c){}}}function Ya(){if(Za&&!G){Xa(false);try{d._exec("enableObjectResizing",true,true)}catch(a){}if(y)try{d._exec("BackgroundImageCache",
true,true)}catch(b){}}}function Jb(a){if(G||a.which!==13||a.shiftKey||a.ctrlKey||a.altKey)return true;a=d.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(p.forcePtag)a.length===0&&d._exec("formatblock","<p>");else{d.pasteHTML("<br />");y&&a.length>0&&d.getRng().parentElement().childNodes.length===2&&d.pasteHTML("<br />");return false}}function $a(){if(!Da&&!Y){ua&&O.height("100%").css("height",O.outerHeight()-C.outerHeight());y&&C.hide().show()}}function Kb(a){a=a.target;
if(a.tagName.match(/(img|embed)/i)){var b=d.getSel(),c=d.getRng(true);c.selectNode(a);b.removeAllRanges();b.addRange(c)}}function U(a,b,c){if(!b)return false;var g="_xhe_"+b;if(c){if(Ia)c=ca(c,Ia,P);a.attr(b,P?ca(c,"abs",P):c).removeAttr(g).attr(g,c)}return a.attr(g)||a.attr(b)}function ab(){Fa&&d.hidePanel()}function Lb(a){if(G)return true;var b=a.which,c=Ab[b];b=c?c:String.fromCharCode(b).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=
b;a=va[sKey];for(var g in a){g=a[g];if(e.isFunction(g)){if(g.call(d)===false)return false}else{d.exec(g);return false}}}function V(a,b){var c=typeof a;if(!b)return c!="undefined";if(b==="array"&&a.hasOwnProperty&&a instanceof Array)return true;return c===b}function ca(a,b,c){if(a.match(/^(\w+):\/\//i)&&!a.match(/^https?:/i)||/^#/i.test(a)||/^data:/i.test(a))return a;var g=c?e('<a href="'+c+'" />')[0]:location;c=g.protocol;var m=g.host,n=g.hostname,j=g.port;g=g.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,
"");if(j==="")j="80";if(g==="")g="/";else if(g.charAt(0)!=="/")g="/"+g;a=e.trim(a);if(b!=="abs")a=a.replace(RegExp(c+"\\/\\/"+n.replace(/\./g,"\\.")+"(?::"+j+")"+(j==="80"?"?":"")+"(/|$)","i"),"/");if(b==="rel")a=a.replace(RegExp("^"+g.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(b!=="rel"){a.match(/^(https?:\/\/|\/)/i)||(a=g+a);if(a.charAt(0)==="/"){n=[];a=a.split("/");var i=a.length;for(g=0;g<i;g++){j=a[g];if(j==="..")n.pop();else j!==""&&j!=="."&&n.push(j)}a[i-1]===""&&n.push("");a="/"+n.join("/")}}if(b===
"abs"&&!a.match(/^https?:\/\//i))a=c+"//"+m+a;return a=a.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,"$1$2")}function lb(a,b){if(b==="*"||a.match(RegExp(".("+b.replace(/,/g,"|")+")$","i")))return true;else{alert("Upload file extension required for this: "+b);return false}}function mb(a){var b=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,Math.floor(b))).toFixed(2)+["Byte","KB","MB","GB","TB","PB"][b]}function W(){return false}var d=this,Q=e(B),nb=Q.closest("form"),C,O,la,ba,v,ma,na,
Za=false,G=false,ua=false,Wa=false,bb,wa=false,ob="",N=null,Ja,xa=false,cb=false,oa=null,da=null,X=0,p=d.settings=e.extend({},Ea.settings,A),Ka=p.plugins,La=[];if(Ka){ta=e.extend({},ta,Ka);e.each(Ka,function(a){La.push(a)});La=La.join(",")}if(p.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var pb=Va[e.trim(p.tools)];p.tools=p.tools.match(/m?full/i)&&Ka?pb.replace("Table","Table,"+La):pb}p.tools.match(/(^|,)\s*About\s*(,|$)/i)||(p.tools+=",About");p.tools=p.tools.split(",");if(p.editorRoot)T=p.editorRoot;
if(zb===false)T=ca(T,"abs");if(p.urlBase)p.urlBase=ca(p.urlBase,"abs");var qb="xheCSS_"+p.skin,ya="xhe"+ia+"_container",rb="xhe"+ia+"_Tool",sb="xhe"+ia+"_iframearea",tb="xhe"+ia+"_iframe",Ma="xhe"+ia+"_fixffcursor",za="",pa="",Ha=T+"xheditor_skin/"+p.skin+"/",Na=Fb,Ia=p.urlType,P=p.urlBase,ea=p.emotPath;ea=ea?ea:T+"xheditor_emot/";var db="";Na=e.extend({},Na,p.emots);ea=ca(ea,"rel",P?P:null);if(wa=p.showBlocktag)pa+=" showBlocktag";var va=[];this.init=function(){e("#"+qb).length===0&&e("head").append('<link id="'+
qb+'" rel="stylesheet" type="text/css" href="'+Ha+'ui.css" />');var a=Q.outerWidth(),b=Q.outerHeight();a=p.width||B.style.width||(a>10?a:0);X=p.height||B.style.height||(b>10?b:150);if(V(a,"number"))a+="px";if(V(X,"string"))X=X.replace(/[^\d]+/g,"");b=p.background||B.style.background;var c=['<span class="xheGStart"/>'],g,m,n=/\||\//i;e.each(p.tools,function(f,h){h.match(n)&&c.push('<span class="xheGEnd"/>');if(h==="|")c.push('<span class="xheSeparator"/>');else if(h==="/")c.push("<br />");else{g=ta[h];
if(!g)return;m=g.c?g.c:"xheIcon xheBtn"+h;c.push('<span><a href="#" title="'+g.t+'" cmd="'+h+'" class="xheButton xheEnabled" tabindex="-1" role="button"><span class="'+m+'" unselectable="on" style="font-size:0;color:transparent;text-indent:-999px;">'+g.t+"</span></a></span>");g.s&&d.addShortcuts(g.s,h)}h.match(n)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');Q.after(e('<input type="text" id="'+Ma+'" style="position:absolute;display:none;" /><span id="'+ya+'" class="xhe_'+
p.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="'+(a!="0px"?"width:"+a+";":"")+"height:"+X+'px;" role="presentation"><tr><td id="'+rb+'" class="xheTool" unselectable="on" style="height:1px;" role="presentation"></td></tr><tr><td id="'+sb+'" class="xheIframeArea" role="presentation"><iframe frameborder="0" id="'+tb+'" src="javascript:;" style="width:100%;"></iframe></td></tr></table></span>'));C=e("#"+rb);O=e("#"+sb);za='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><link rel="stylesheet" href="'+
Ha+'iframe.css"/>';if(a=p.loadCSS)if(V(a,"array"))for(var j in a)za+='<link rel="stylesheet" href="'+a[j]+'"/>';else za+=a.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?a:'<link rel="stylesheet" href="'+a+'"/>';j="<html><head>"+za+"<title>WYSIWYG Editor,press alt+1-9,toogle to tool area,press tab,select button,press esc,return editor "+(p.readTip?p.readTip:"")+"</title>";if(b)j+="<style>body{background:"+b+";}</style>";j+='</head><body spellcheck="0" class="editMode'+pa+'"></body></html>';
d.win=la=e("#"+tb)[0].contentWindow;ba=e(la);try{this.doc=v=la.document;ma=e(v);v.open();v.write(j);v.close();if(y)v.body.contentEditable="true";else v.designMode="On"}catch(i){}setTimeout(Ya,300);d.setSource();la.setInterval=null;C.append(c.join("")).bind("mousedown contextmenu",W).click(function(f){var h=e(f.target).closest("a");if(h.is(".xheEnabled")){clearTimeout(Ja);C.find("a").attr("tabindex","-1");N=f;d.exec(h.attr("cmd"))}return false});C.find(".xheButton").hover(function(f){var h=e(this),
o=p.hoverExecDelay,k=da;da=null;if(o===-1||xa||!h.is(".xheEnabled"))return false;if(k&&k>10){xa=true;setTimeout(function(){xa=false},100);return false}var q=h.attr("cmd");if(ta[q].h!==1){d.hidePanel();return false}if(cb)o=0;if(o>=0)Ja=setTimeout(function(){N=f;oa={x:N.clientX,y:N.clientY};d.exec(q)},o)},function(){oa=null;Ja&&clearTimeout(Ja)}).mousemove(function(f){if(oa){var h={x:f.clientX-oa.x,y:f.clientY-oa.y};if(Math.abs(h.x)>1||Math.abs(h.y)>1){if(h.x>0&&h.y>0){h=Math.round(Math.atan(h.y/h.x)/
0.017453293);da=da?(da+h)/2:h}else da=null;oa={x:f.clientX,y:f.clientY}}}});M=e("#xhePanel");ra=e("#xheShadow");sa=e("#xheCntLine");if(M.length===0){M=e('<div id="xhePanel"></div>').mousedown(function(f){f.stopPropagation()});ra=e('<div id="xheShadow"></div>');sa=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(M).append(ra).append(sa)},10)}e("#"+ya).show();Q.hide();O.css("height",X-C.outerHeight());y&Ca<8&&setTimeout(function(){O.css("height",X-C.outerHeight())},1);
Q.focus(d.focus);nb.submit(aa).bind("reset",ib);p.submitID&&e("#"+p.submitID).click(aa);e(window).bind("unload beforeunload",aa).bind("resize",$a);e(document).mousedown(ab);if(!gb){e(document).keydown(Qa);gb=true}ba.focus(function(){p.focus&&p.focus()}).blur(function(){p.blur&&p.blur()});Y&&ba.click(Kb);ma.mousedown(ab).keydown(Lb).keypress(Jb).dblclick(J).bind("mousedown click",function(f){Q.trigger(f.type)});if(y){ma.keydown(function(f){var h=d.getRng();if(f.which===8&&h.item){e(h.item(0)).remove();
return false}});var l=function(f){f=e(f.target);var h;if(h=f.css("width"))f.css("width","").attr("width",h.replace(/[^0-9%]+/g,""));if(h=f.css("height"))f.css("height","").attr("height",h.replace(/[^0-9%]+/g,""))};ma.bind("controlselect",function(f){f=f.target;e.nodeName(f,"IMG")&&e(f).unbind("resizeend",l).bind("resizeend",l)})}ma.keydown(function(f){var h=f.which;if(f.altKey&&h>=49&&h<=57){C.find("a").attr("tabindex","0");C.find(".xheGStart").eq(h-49).next().find("a").focus();v.title="\ufeff\ufeff";
return false}}).click(function(){C.find("a").attr("tabindex","-1")});C.keydown(function(f){var h=f.which;if(h==27){C.find("a").attr("tabindex","-1");d.focus()}else if(f.altKey&&h>=49&&h<=57){C.find(".xheGStart").eq(h-49).next().find("a").focus();return false}});j=e(v.documentElement);fb?j.bind("keydown",function(f){f.ctrlKey&&f.which===86&&jb()}):j.bind(y?"beforepaste":"paste",jb);p.disableContextmenu&&j.bind("contextmenu",W);p.html5Upload&&j.bind("dragenter dragover",function(f){var h;if((h=f.originalEvent.dataTransfer.types)&&
e.inArray("Files",h)!==-1)return false}).bind("drop",function(f){f=f.originalEvent.dataTransfer;var h;if(f&&(h=f.files)&&h.length>0){var o,k;f=["Link","Img","Flash","Media"];var q=[],r;for(o in f){k=f[o];p["up"+k+"Url"]&&p["up"+k+"Url"].match(/^[^!].*/i)&&q.push(k+":,"+p["up"+k+"Ext"])}if(q.length===0)return false;else r=q.join(",");k=function(t){var s,w;for(o=0;o<t.length;o++){s=t[o].name.replace(/.+\./,"");if(s=r.match(RegExp("(\\w+):[^:]*,"+s+"(?:,|$)","i")))if(w){if(w!==s[1])return 2}else w=s[1];
else return 1}return w}(h);if(k===1)alert("Upload file extension required for this: "+r.replace(/\w+:,/g,""));else if(k===2)alert("You can only drag and drop the same type of file.");else k&&d.startUpload(h,p["up"+k+"Url"],"*",function(t){var s=[],w;(w=p.onUpload)&&w(t);for(var E=0,L=t.length;E<L;E++){w=t[E];url=V(w,"string")?w:w.url;if(url.substr(0,1)==="!")url=url.substr(1);s.push(url)}d.exec(k);e("#xhe"+k+"Url").val(s.join(" "));e("#xheSave").click()});return false}});(j=p.shortcuts)&&e.each(j,
function(f,h){d.addShortcuts(f,h)});ia++;Za=true;if(p.fullscreen)d.toggleFullscreen();else p.sourceMode&&setTimeout(d.toggleSource,20);return true};this.remove=function(){d.hidePanel();aa();Q.unbind("focus",d.focus);nb.unbind("submit",aa).unbind("reset",ib);p.submitID&&e("#"+p.submitID).unbind("mousedown",aa);e(window).unbind("unload beforeunload",aa).unbind("resize",$a);e(document).unbind("mousedown",ab);e("#"+ya).remove();e("#"+Ma).remove();Q.show();Za=false};this.saveBookmark=function(){if(!G){d.focus();
var a=d.getRng();a=a.cloneRange?a.cloneRange():a;na={top:ba.scrollTop(),rng:a}}};this.loadBookmark=function(){if(!(G||!na)){d.focus();var a=na.rng;if(y)a.select();else{var b=d.getSel();b.removeAllRanges();b.addRange(a)}ba.scrollTop(na.top);na=null}};this.focus=function(){G?e("#sourceCode",v).focus():ba.focus();if(y){var a=d.getRng();a.parentElement&&a.parentElement().ownerDocument!==v&&d.setTextCursor()}return false};this.setTextCursor=function(a){var b=d.getRng(true),c=v.body;if(y)b.moveToElementText(c);
else{for(var g=a?"lastChild":"firstChild";c.nodeType!=3&&c[g];)c=c[g];b.selectNode(c)}b.collapse(a?false:true);if(y)b.select();else{a=d.getSel();a.removeAllRanges();a.addRange(b)}};this.getSel=function(){return v.selection?v.selection:la.getSelection()};this.getRng=function(a){var b,c;try{if(!a){b=d.getSel();c=b.createRange?b.createRange():b.rangeCount>0?b.getRangeAt(0):null}c||(c=v.body.createTextRange?v.body.createTextRange():v.createRange())}catch(g){}return c};this.getParent=function(a){var b=
d.getRng(),c;if(y)c=b.item?b.item(0):b.parentElement();else{c=b.commonAncestorContainer;if(!b.collapsed)if(b.startContainer===b.endContainer&&b.startOffset-b.endOffset<2&&b.startContainer.hasChildNodes())c=b.startContainer.childNodes[b.startOffset]}a=a?a:"*";c=e(c);c.is(a)||(c=e(c).closest(a));return c};this.getSelect=function(a){var b=d.getSel(),c=d.getRng(),g=true;g=!c||c.item?false:!b||c.boundingWidth===0||c.collapsed;if(a==="text")return g?"":c.text||(b.toString?b.toString():"");if(c.cloneContents){a=
e("<div></div>");(c=c.cloneContents())&&a.append(c);c=a.html()}else c=V(c.item)?c.item(0).outerHTML:V(c.htmlText)?c.htmlText:c.toString();if(g)c="";c=d.processHTML(c,"read");c=d.cleanHTML(c);return c=d.formatXHTML(c)};this.pasteHTML=function(a,b){if(G)return false;d.focus();a=d.processHTML(a,"write");var c=d.getSel(),g=d.getRng();if(b!==ha){if(g.item){var m=g.item(0);g=d.getRng(true);g.moveToElementText(m);g.select()}g.collapse(b)}a+="<"+(y?"img":"span")+' id="_xhe_temp" width="0" height="0" />';
if(g.insertNode){if(e(g.startContainer).closest("style,script").length>0)return false;g.deleteContents();g.insertNode(g.createContextualFragment(a))}else{if(c.type.toLowerCase()==="control"){c.clear();g=d.getRng()}g.pasteHTML(a)}m=e("#_xhe_temp",v);var n=m[0];if(y){g.moveToElementText(n);g.select()}else{g.selectNode(n);c.removeAllRanges();c.addRange(g)}m.remove()};this.pasteText=function(a,b){a||(a="");a=d.domEncode(a);a=a.replace(/\r?\n/g,"<br />");d.pasteHTML(a,b)};this.appendHTML=function(a){if(G)return false;
d.focus();a=d.processHTML(a,"write");e(v.body).append(a);d.setTextCursor(true)};this.domEncode=function(a){return a.replace(Ib,function(b){return Hb[b]})};this.setSource=function(a){na=null;if(typeof a!=="string"&&a!=="")a=B.value;if(G)e("#sourceCode",v).val(a);else{if(p.beforeSetSource)a=p.beforeSetSource(a);a=d.cleanHTML(a);a=d.formatXHTML(a);a=d.processHTML(a,"write");if(y){v.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+a+"\n";e("#_xhe_temp",v).remove()}else v.body.innerHTML=a}};
this.processHTML=function(a,b){if(b==="write"){a=a.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(n,j,i,l,f,h,o){l=l.toLowerCase();if(Da)if(l==="strong")l="b";else{if(l==="em")l="i"}else if(Y)if(l==="strong"){l="span";i||(f+=' class="Apple-style-span" style="font-weight: bold;"')}else if(l==="em"){l="span";i||(f+=' class="Apple-style-span" style="font-style: italic;"')}else if(l==="u"){l="span";i||(f+=' class="Apple-style-span" style="text-decoration: underline;"')}else if(l===
"strike"){l="span";i||(f+=' class="Apple-style-span" style="text-decoration: line-through;"')}var k,q="";if(l==="del")l="strike";else if(l==="img")f=f.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(t,s){k=s.match(/^(["']?)(.*)\1/)[2];k=k.split(",");if(!k[1]){k[1]=k[0];k[0]=""}if(k[0]==="default")k[0]="";return p.emotMark?t:""});else if(l==="a"){if(!f.match(/ href=[^ ]/i)&&f.match(/ name=[^ ]/i))q+=" xhe-anchor";if(o)h="></a>"}else if(l==="table"&&!i){n=f.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i);
if(!n||n[1].match(/^(["']?)\s*0\s*\1$/))q+=" xhe-border"}var r;f=f.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(t,s,w){s=s.toLowerCase();w=w.match(/^(["']?)(.*)\1/)[2];aft="";if(y&&s.match(/^(disabled|checked|readonly|selected)$/)&&w.match(/^(false|0)$/i))return"";if(l==="img"&&k&&s==="src")return"";if(s.match(/^(src|href)$/)){aft=" _xhe_"+s+'="'+w+'"';if(P)w=ca(w,"abs",P)}if(q&&s==="class"){w+=" "+q;q=""}if(Y&&s==="style")if(l==="span"&&w.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))r=
true;return" "+s+'="'+w+'"'+aft});if(k){n=ea+(k[0]?k[0]:"default")+"/"+k[1]+".gif";f+=' src="'+n+'" _xhe_src="'+n+'"'}if(r)f+=' class="Apple-style-span"';if(q)f+=' class="'+q+'"';return"<"+i+l+f+h});if(y)a=a.replace(/&apos;/ig,"&#39;");if(!Y){var c=function(n,j,i,l){j="";var f,h;if(f=i.match(/font-family\s*:\s*([^;"]+)/i))j+=' face="'+f[1]+'"';if(f=i.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var o=0;o<$.length;o++)if(f===$[o].n||f===$[o].s){h=o+1;break}if(h){j+=' size="'+h+'"';
i=i.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(h=i.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=h[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){h[1]="#";for(o=1;o<=3;o++)h[1]+=(f[o]-0).toString(16)}h[1]=h[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");j+=' color="'+h[1]+'"'}i=i.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(j!==""){if(i)j+=' style="'+i+'"';return"<font"+j+">"+l+"</font>"}else return n};a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
c);a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,c);a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,c)}a=a.replace(/<(td|th)(\s+[^>]*?)?>(\s|&nbsp;)*<\/\1>/ig,"<$1$2>"+(y?"":"<br />")+"</$1>")}else{if(Y){var g=[{r:/font-weight:\sbold/ig,
t:"strong"},{r:/font-style:\sitalic/ig,t:"em"},{r:/text-decoration:\sunderline/ig,t:"u"},{r:/text-decoration:\sline-through/ig,t:"strike"}];c=function(n,j,i,l,f){j=i+l;i="";if(!j)return f;for(l=0;l<g.length;l++)if(j.match(g[l].r)){i=g[l].t;break}return i?"<"+i+">"+f+"</"+i+">":n};for(var m=0;m<2;m++){a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
c);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,c);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,c)}}a=a.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g,function(n,j,i,l,f){i=i.toLowerCase();var h;l=l.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(o,
k){h=k.match(/^(["']?)(.*)\1/)[2];return""});if(h&&Ia)h=ca(h,Ia,P);l=l.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(o,k,q){k=k.toLowerCase();q=q.match(/^(["']?)(.*)\1/)[2];if(k==="class"){if(q.match(/^["']?(apple|webkit)/i))return"";q=q.replace(/\s?xhe-[a-z]+/ig,"");if(q==="")return""}else if(k.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return"";else if(h&&k.match(/^(src|href)$/i))return" "+k+'="'+h+'"';else if(k==="style")q=q.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,
function(r,t,s,w,E){for(var L,D=0;D<$.length;D++){r=$[D];if(w===r.n){L=r.s;break}}return t+s+":"+L+E});return" "+k+'="'+q+'"'});if(i==="img"&&!l.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))l+=' alt=""';return j+l+f});a=a.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(n,j,i,l){return j+(l?l:"&nbsp;")+"</"+i+">"});a=a.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>|&nbsp;)*\s*(?:<\/\1>)?\s*$/i,"")}return a=a.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,
function(n,j,i,l){return j+i.replace(/<br\s*\/?>/ig,"\r\n")+l})};this.getSource=function(a){var b,c=p.beforeGetSource;if(G){b=e("#sourceCode",v).val();c||(b=d.formatXHTML(b,false))}else{b=d.processHTML(v.body.innerHTML,"read");b=d.cleanHTML(b);b=d.formatXHTML(b,a);if(c)b=c(b)}return B.value=b};this.cleanWord=function(a){var b=p.cleanPaste;if(b>0&&b<3&&a.match(/mso(-|normal)|WordDocument|<table\s+[^>]*?x:str/i)){a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,
"");a=a.replace(/\r?\n/ig,"");a=a.replace(/(<(\/?)([\w\-:]+))((?:\s+[\w\-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(g,m,n,j,i,l){j=j.toLowerCase();if(j.match(/^(link|img)$/)&&i.match(/file:\/\//i)||j.match(/:/)||j==="span"&&b===2)return"";n||(i=i.replace(/\s([\w\-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(f,h,o){h=h.toLowerCase();o=o.match(/^(["']?)(.*)\1/)[2];if(h.match(/:/))return"";else if(h.match(/^(class|lang|language|span)$/))return"";else if(j==="td"&&(h===
"height"||h==="width"&&!i.match(/\scolspan="\d+"/i)))return"";else if(h==="style"){if(b===2)return"";return(o=e.trim(o.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,"")))?" "+h+'="'+o.replace(/"/g,"'")+'"':""}return f}));return m+i+l});for(var c=0;c<3;c++)a=a.replace(/<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,function(g,m){return m.match(/^a$/i)?g:""})}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,
"");var b;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(c,g){b=g.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return""});if(b)a=b.join("")+a;a=a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig,"");p.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,""));p.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));if(!p.linkTag||!p.inlineScript||!p.inlineStyle)a=a.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,
function(c,g,m,n,j){if(!p.linkTag&&m.toLowerCase()==="link")return"";p.inlineScript||(n=n.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,""));p.inlineStyle||(n=n.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,""));return g+n+j});return a=a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>|&nbsp;)*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,
b){function c(u){var x={};u=u.split(",");for(var z=0;z<u.length;z++)x[u[z]]=true;return x}function g(u){u=u.toLowerCase();var x=w[u];return x?x:u}function m(u,x,z){if(k[u])for(;H.last()&&q[H.last()];)n(H.last());r[u]&&H.last()===u&&n(u);(z=o[u]||!!z)||H.push(u);var K=[];K.push("<"+u);x.replace(L,function(ub,Aa,vb,wb,xb){Aa=Aa.toLowerCase();K.push(" "+Aa+'="'+(vb?vb:wb?wb:xb?xb:t[Aa]?Aa:"").replace(/"/g,"'")+'"')});K.push((z?" /":"")+">");l(K.join(""),u,true);if(u==="pre")Oa=true}function n(u){if(u)for(x=
H.length-1;x>=0;x--){if(H[x]===u)break}else var x=0;if(x>=0){for(var z=H.length-1;z>=x;z--)l("</"+H[z]+">",H[z]);H.length=x}if(u==="pre"){Oa=false;fa--}}function j(u){l(d.domEncode(u))}function i(u){D.push(u.replace(/^[\s\r\n]+|[\s\r\n]+$/g,""))}function l(u,x,z){Oa||(u=u.replace(/(\t*\r?\n\t*)+/g,""));if(!Oa&&b===true)if(u.match(/^\s*$/))D.push(u);else{var K=k[x],ub=K?x:"";if(K){z&&fa++;Pa===""&&fa--}else Pa&&fa++;if(ub!==Pa||K)f();D.push(u);x==="br"&&f();if(K&&(o[x]||!z))fa--;Pa=K?x:""}else D.push(u)}
function f(){D.push("\r\n");if(fa>0)for(var u=fa;u--;)D.push("\t")}function h(u,x,z,K){if(!z)return K;u="";if(x=z.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))u+="font-family:"+x[1]+";";if(x=z.match(/ size\s*=\s*"\s*(\d+)\s*"/i))u+="font-size:"+$[(x[1]>7?7:x[1]<1?1:x[1])-1].s+";";if(x=z.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))u+="color:"+x[1]+";";if(z=z.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))u+=z[1];if(u)K='<span style="'+u+'">'+K+"</span>";return K}var o=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),
k=c("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,table,tbody,td,tfoot,th,thead,tr,ul,script"),q=c("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),r=c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),t=c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),
s=c("script,style"),w={b:"strong",i:"em",s:"del",strike:"del"},E=/<(?:\/([^\s>]+)|!([^>]*?)|([\w\-:]+)((?:"[^"]*"|'[^']*'|[^"'<>])*)\s*(\/?))>/g,L=/\s*([\w\-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g,D=[],H=[];H.last=function(){return this[this.length-1]};for(var F,I,R=0,ga,Ba,fa=-1,Pa="body",Oa=false;F=E.exec(a);){I=F.index;if(I>R){R=a.substring(R,I);ga?Ba.push(R):j(R)}R=E.lastIndex;if(I=F[1]){I=g(I);if(ga&&I===ga){i(Ba.join(""));Ba=ga=null}if(!ga){n(I);continue}}if(ga)Ba.push(F[0]);else if(I=
后面还有 49 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。