(function(e){if(e.xheditor)return false;e.fn.xheditor=function(B){var E=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(B===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(this.xheditor)E.push(this.xheditor);else{var H=/({.*})/.exec(e(this).attr("class"));if(H){try{H=eval("("+H[1]+")")}catch(Va){}B=e.extend({},H,B)}H=new e.xheditor(this,B);if(H.init()){this.xheditor=H;E.push(H)}}});if(E.length==0)E=false;if(E.length==1)E=E[0];return E};var ca=0,Fa=e.browser.version,
y=e.browser.msie,wa=e.browser.mozilla,da=e.browser.safari,lb=e.browser.opera,O=false,xa=true,ya=false,Wa=false,L,la,ma,ea,W,Ga,fa,Ha,Ia,Ja,T;e("script[src*=xheditor]").each(function(){var B=this.src;if(B.match(/xheditor[^\/]*\.js/i)){T=B.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var mb={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"},nb=["#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"],ob=[{n:"p",t:"\u666e\u901a\u6bb5\u843d"},{n:"h1",t:"\u6807\u98981"},{n:"h2",t:"\u6807\u98982"},{n:"h3",t:"\u6807\u98983"},{n:"h4",t:"\u6807\u98984"},{n:"h5",t:"\u6807\u98985"},
{n:"h6",t:"\u6807\u98986"},{n:"pre",t:"\u5df2\u7f16\u6392\u683c\u5f0f"},{n:"address",t:"\u5730\u5740"}],pb=[{n:"\u5b8b\u4f53",c:"SimSun"},{n:"\u4eff\u5b8b\u4f53",c:"FangSong_GB2312"},{n:"\u9ed1\u4f53",c:"SimHei"},{n:"\u6977\u4f53",c:"KaiTi_GB2312"},{n:"\u5fae\u8f6f\u96c5\u9ed1",c:"Microsoft YaHei"},{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],P=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"\u6781\u5c0f"},
{n:"x-small",wkn:"small",s:"10pt",t:"\u7279\u5c0f"},{n:"small",wkn:"medium",s:"12pt",t:"\u5c0f"},{n:"medium",wkn:"large",s:"14pt",t:"\u4e2d"},{n:"large",wkn:"x-large",s:"18pt",t:"\u5927"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"\u7279\u5927"},{n:"xx-large",wkn:"-webkit-xxx-large",s:"36pt",t:"\u6781\u5927"}],qb=[{s:"\u5de6\u5bf9\u9f50",v:"justifyleft"},{s:"\u5c45\u4e2d",v:"justifycenter"},{s:"\u53f3\u5bf9\u9f50",v:"justifyright"},{s:"\u4e24\u7aef\u5bf9\u9f50",v:"justifyfull"}],rb=[{s:"\u6570\u5b57\u5217\u8868",
v:"insertOrderedList"},{s:"\u7b26\u53f7\u5217\u8868",v:"insertUnorderedList"}],sb={qq:{name:"QQ",count:64,width:24,height:24,line:6}},na={Cut:{t:"\u526a\u5207 (Ctrl+X)"},Copy:{t:"\u590d\u5236 (Ctrl+C)"},Paste:{t:"\u7c98\u8d34 (Ctrl+V)"},Pastetext:{t:"\u7c98\u8d34\u6587\u672c",h:y?0:1},Blocktag:{t:"\u6bb5\u843d\u6807\u7b7e",h:1},Fontface:{t:"\u5b57\u4f53",h:1},FontSize:{t:"\u5b57\u4f53\u5927\u5c0f",h:1},Bold:{t:"\u52a0\u7c97 (Ctrl+B)",s:"Ctrl+B"},Italic:{t:"\u659c\u4f53 (Ctrl+I)",s:"Ctrl+I"},Underline:{t:"\u4e0b\u5212\u7ebf (Ctrl+U)",
s:"Ctrl+U"},Strikethrough:{t:"\u5220\u9664\u7ebf (Ctrl+S)",s:"Ctrl+S"},FontColor:{t:"\u5b57\u4f53\u989c\u8272",h:1},BackColor:{t:"\u80cc\u666f\u989c\u8272",h:1},SelectAll:{t:"\u5168\u9009 (Ctrl+A)"},Removeformat:{t:"\u5220\u9664\u6587\u5b57\u683c\u5f0f"},Align:{t:"\u5bf9\u9f50",h:1},List:{t:"\u5217\u8868",h:1},Outdent:{t:"\u51cf\u5c11\u7f29\u8fdb (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"\u589e\u52a0\u7f29\u8fdb (Tab)",s:"Tab"},Link:{t:"\u8d85\u94fe\u63a5 (Ctrl+K)",s:"Ctrl+K",h:1},Unlink:{t:"\u53d6\u6d88\u8d85\u94fe\u63a5"},
Img:{t:"\u56fe\u7247",h:1},Flash:{t:"Flash\u52a8\u753b",h:1},Media:{t:"\u591a\u5a92\u4f53\u6587\u4ef6",h:1},Emot:{t:"\u8868\u60c5",s:"ctrl+e",h:1},Table:{t:"\u8868\u683c",h:1},Source:{t:"\u6e90\u4ee3\u7801"},Preview:{t:"\u9884\u89c8"},Print:{t:"\u6253\u5370 (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"\u5168\u5c4f\u7f16\u8f91 (Esc)",s:"Esc"},Artpage:{t:"Page"},About:{t:"\u5173\u4e8e xhEditor"}},Ka={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,Img,Flash,Media,Emot,Table,|,Source,Preview,Print,Fullscreen,Artpage"};Ka.mfull=Ka.full.replace(/\|(,Align)/i,"/$1");var tb={a:"Link",img:"Img",embed:"Embed"};e.xheditor=function(B,E){function H(a){a=a.target;var b=tb[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 Va(a){if(a.which==27){if(ya)d.removeModal();else O&&d.hidePanel();return false}}function Xa(){setTimeout(d.setSource,10)}function oa(){d.getSource()}function ub(a){if(F||La)return true;La=true;d.saveBookmark();var b=e('<div style="position:absolute;left:-1000px;top:'+X.scrollTop()+'px;overflow:hidden;width:1px;height:1px;" />',t),c=b[0],g=d.getSel(),k=d.getRng();e(t.body).append(b);if(y){k.moveToElementText(c);k.execCommand("Paste");a.preventDefault()}else{k.selectNodeContents(c);
g.removeAllRanges();g.addRange(k)}setTimeout(function(){var h;if(m.forcePasteText===true)h=b.text();else{h=c.innerHTML;h=d.cleanHTML(h);h=d.formatXHTML(h);h=d.cleanWord(h)}b.remove();d.loadBookmark();d.pasteHTML(h);La=false},0)}function Ma(a){try{d._exec("styleWithCSS",a,true)}catch(b){try{d._exec("useCSS",!a,true)}catch(c){}}}function Na(){if(Oa&&!F){Ma(false);try{d._exec("enableObjectResizing",true,true)}catch(a){}if(y)try{d._exec("BackgroundImageCache",true,true)}catch(b){}}}function vb(a){if(F||
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(m.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 Pa(){if(!wa&&!da){pa&&Q.height("100%").css("height",Q.outerHeight()-K.outerHeight());y&&K.hide().show()}}function wb(a){a=a.target;if(a.tagName.match(/(img|embed)/i)){var b=
d.getSel(),c=d.getRng();c.selectNode(a);b.removeAllRanges();b.addRange(c)}}function Y(a,b,c){if(!b)return false;var g="_xhe_"+b;if(c){if(za)c=ga(c,za,M);a.attr(b,M?ga(c,"abs",M):c).removeAttr(g).attr(g,c)}return a.attr(g)||a.attr(b)}function Qa(){xa&&d.hidePanel()}function xb(a){if(F)return true;var b=a.which,c=mb[b];b=c?c:String.fromCharCode(b).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=b;a=qa[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 Z(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 ga(a,b,c){var g=c?e('<a href="'+c+'" />')[0]:location;c=g.protocol;var k=g.hostname,h=g.port;g=g.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");h=h==""?"80":h;a=e.trim(a);if(b!="abs")a=a.replace(RegExp(c+"\\/\\/"+k.replace(/\./g,"\\.")+"(?::"+h+")"+(h=="80"?"?":"")+"(/|$)","i"),"/");if(b=="rel")a=a.replace(RegExp("^"+
g.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(b!="rel"){a.match(/^((https?|file):\/\/|\/)/i)||(a=g+a);if(a.charAt(0)=="/"){k=[];a=a.split("/");var l=a.length;for(g=0;g<l;g++){h=a[g];if(h=="..")k.pop();else h!==""&&h!="."&&k.push(h)}a[l-1]==""&&k.push("");a="/"+k.join("/")}}if(b=="abs")a.match(/(https?|file):\/\//i)||(a=c+"//"+location.host+a);return a}function Ya(a,b){if(b=="*"||a.match(RegExp(".("+b.replace(/,/g,"|")+")$","i")))return true;else{alert("\u4e0a\u4f20\u6587\u4ef6\u6269\u5c55\u540d\u5fc5\u9700\u4e3a: "+
b);return false}}function Za(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 U(){return false}var d=this,R=e(B),$a=R.closest("form"),K,Q,V,X,t,Aa,ha,Oa=false,F=false,pa=false,La=false,ab,ra=false,bb="",N=null,Ra,sa=false,Sa=false,ia=null,$=null,aa=0,m=d.settings=e.extend({},{skin:"default",tools:"full",clickCancelDialog:true,linkTag:false,internalScript:false,inlineScript:false,internalStyle:true,inlineStyle:true,
showBlocktag:false,forcePtag:true,upLinkExt:"zip,rar,txt",upImgExt:"jpg,jpeg,gif,png",upFlashExt:"swf",upMediaExt:"wmv,avi,wma,mp3,mid",modalWidth:350,modalHeight:220,modalTitle:true,defLinkText:"\u70b9\u51fb\u6253\u5f00\u94fe\u63a5",layerShadow:3,emotMark:false,upBtnText:"\u4e0a\u4f20",wordDeepClean:true,hoverExecDelay:100,html5Upload:true,upMultiple:99},E),Ba=m.plugins,Ca=[];if(Ba){na=e.extend({},na,Ba);e.each(Ba,function(a){Ca.push(a)});Ca=Ca.join(",")}if(m.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var cb=
Ka[e.trim(m.tools)];m.tools=m.tools.match(/m?full/i)&&Ba?cb.replace("Table","Table,"+Ca):cb}m.tools.match(/(^|,)\s*About\s*(,|$)/i)||(m.tools+=",About");m.tools=m.tools.split(",");if(m.editorRoot)T=m.editorRoot;T=ga(T,"abs");var db="xheCSS_"+m.skin,ta="xhe"+ca+"_container",eb="xhe"+ca+"_Tool",fb="xhe"+ca+"_iframearea",gb="xhe"+ca+"_iframe",Da="xhe"+ca+"_fixffcursor",ua="",ja="",Ta=T+"xheditor_skin/"+m.skin+"/",Ea=sb,za=m.urlType,M=m.urlBase,ba=m.emotPath;ba=ba?ba:T+"xheditor_emot/";var Ua="";Ea=e.extend({},
Ea,m.emots);ba=ga(ba,"rel",M?M:null);if(ra=m.showBlocktag)ja+=" showBlocktag";var qa=[];this.init=function(){e("#"+db).length==0&&e("head").append('<link id="'+db+'" rel="stylesheet" type="text/css" href="'+Ta+'ui.css" />');var a=m.width||B.style.width||R.outerWidth();aa=m.height||B.style.height||R.outerHeight();if(Z(aa,"string"))aa=aa.replace(/[^\d]+/g,"");if(a<=0||aa<=0){alert("\u5f53\u524dtextarea\u5904\u4e8e\u9690\u85cf\u72b6\u6001\uff0c\u8bf7\u5c06\u4e4b\u663e\u793a\u540e\u518d\u521d\u59cb\u5316xhEditor\uff0c\u6216\u8005\u76f4\u63a5\u8bbe\u7f6etextarea\u7684width\u548cheight\u6837\u5f0f");
return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var b=m.background||B.style.background,c=['<span class="xheGStart"/>'],g,k,h=/\||\//i;e.each(m.tools,function(f,i){i.match(h)&&c.push('<span class="xheGEnd"/>');if(i=="|")c.push('<span class="xheSeparator"/>');else if(i=="/")c.push("<br />");else{g=na[i];if(!g)return;k=g.c?g.c:"xheIcon xheBtn"+i;c.push('<span><a href="javascript:void(0);" title="'+g.t+'" name="'+i+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+k+'" unselectable="on" /></a></span>');
g.s&&d.addShortcuts(g.s,i)}i.match(h)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');R.after(e('<input type="text" id="'+Da+'" style="position:absolute;display:none;" /><span id="'+ta+'" class="xhe_'+m.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+a+';height:26px;"><tbody><tr><td id="'+eb+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+fb+'" class="xheIframeArea"><iframe frameborder="0" id="'+
gb+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));K=e("#"+eb);Q=e("#"+fb);ua='<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+Ta+'iframe.css"/>';if(a=m.loadCSS)if(Z(a,"array"))for(var l in a)ua+='<link rel="stylesheet" href="'+a[l]+'"/>';else ua+=a.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?a:'<link rel="stylesheet" href="'+a+'"/>';l="<html><head>"+ua;if(b)l+="<style>body{background:"+b+";}</style>";
l+='</head><body spellcheck="false" class="editMode'+ja+'"></body></html>';d.win=V=e("#"+gb)[0].contentWindow;X=e(V);try{this.doc=t=V.document;Aa=e(t);t.open();t.write(l);t.close();if(y)t.body.contentEditable="true";else t.designMode="On"}catch(j){}setTimeout(Na,300);d.setSource();V.setInterval=null;K.append(c.join("")).bind("mousedown contextmenu",U).click(function(f){var i=e(f.target).closest("a");if(i.is(".xheEnabled")){N=f;d.exec(i.attr("name"))}return false});K.find(".xheButton").hover(function(f){var i=
e(this),o=m.hoverExecDelay,p=$;$=null;if(o==-1||sa||!i.is(".xheEnabled"))return false;if(p&&p>10){sa=true;setTimeout(function(){sa=false},100);return false}var q=i.attr("name");if(na[q].h!=1){d.hidePanel();return false}if(Sa)o=0;if(o>=0)Ra=setTimeout(function(){N=f;ia={x:N.clientX,y:N.clientY};d.exec(q)},o)},function(){ia=null;Ra&&clearTimeout(Ra)}).mousemove(function(f){if(ia){var i={x:f.clientX-ia.x,y:f.clientY-ia.y};if(Math.abs(i.x)>1||Math.abs(i.y)>1){if(i.x>0&&i.y>0){i=Math.round(Math.atan(i.y/
i.x)/0.017453293);$=$?($+i)/2:i}else $=null;ia={x:f.clientX,y:f.clientY}}}});L=e("#xhePanel");la=e("#xheShadow");ma=e("#xheCntLine");if(L.length==0){L=e('<div id="xhePanel"></div>').mousedown(function(f){f.stopPropagation()});la=e('<div id="xheShadow"></div>');ma=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(L).append(la).append(ma)},10)}e("#"+ta).show();R.hide();Q.css("height",aa-K.outerHeight());R.focus(d.focus);$a.submit(oa).bind("reset",Xa);e(window).bind("unload beforeunload",
oa).bind("resize",Pa);e(document).mousedown(Qa);if(!Wa){e(document).keydown(Va);Wa=true}X.focus(function(){m.focus&&m.focus()}).blur(function(){m.blur&&m.blur()});da&&X.click(wb);Aa.mousedown(Qa).keydown(xb).keypress(vb).dblclick(H).bind("mousedown click",function(f){R.trigger(f.type)});if(y){Aa.keydown(function(f){var i=d.getRng();if(f.which==8&&i.item){e(i.item(0)).remove();return false}});var n=function(f){f=e(f.target);var i;if(i=f.css("width"))f.css("width","").attr("width",i.replace(/[^0-9%]+/g,
""));if(i=f.css("height"))f.css("height","").attr("height",i.replace(/[^0-9%]+/g,""))};Aa.bind("controlselect",function(f){f=f.target;e.nodeName(f,"IMG")&&e(f).unbind("resizeend",n).bind("resizeend",n)})}b=e(t.documentElement);b.bind("paste",ub);m.disableContextmenu&&b.bind("contextmenu",U);m.html5Upload&&b.bind("dragenter dragover",function(f){var i;if((i=f.originalEvent.dataTransfer.types)&&e.inArray("Files",i)!=-1)return false}).bind("drop",function(f){f=f.originalEvent.dataTransfer;var i;if(f&&
(i=f.files)&&i.length>0){var o,p;f=["Link","Img","Flash","Media"];var q=[],r;for(o in f){p=f[o];m["up"+p+"Url"]&&m["up"+p+"Url"].match(/^[^!].*/i)&&q.push(p+":,"+m["up"+p+"Ext"])}if(q.length==0)return false;else r=q.join(",");p=function(u){var v,w;for(o=0;o<u.length;o++){v=u[o].fileName.replace(/.+\./,"");if(v=r.match(RegExp("(\\w+):[^:]*,"+v+"(?:,|$)","i")))if(w){if(w!=v[1])return 2}else w=v[1];else return 1}return w}(i);if(p==1)alert("\u4e0a\u4f20\u6587\u4ef6\u7684\u6269\u5c55\u540d\u5fc5\u9700\u4e3a\uff1a"+
r.replace(/\w+:,/g,""));else if(p==2)alert("\u6bcf\u6b21\u53ea\u80fd\u62d6\u653e\u4e0a\u4f20\u540c\u4e00\u7c7b\u578b\u6587\u4ef6");else p&&d.startUpload(i,m["up"+p+"Url"],"*",function(u){var v=[],w;(w=m.onUpload)&&w(u);for(o in u){w=u[o];url=Z(w,"string")?w:w.url;if(url.substr(0,1)=="!")url=url.substr(1);v.push(url)}d.exec(p);e("#xhe"+p+"Url").val(v.join(" "));e("#xheSave").click()});return false}});(b=m.shortcuts)&&e.each(b,function(f,i){d.addShortcuts(f,i)});ca++;Oa=true;if(m.fullscreen)d.toggleFullscreen();
else m.sourceMode&&setTimeout(d.toggleSource,20);return true};this.remove=function(){d.hidePanel();oa();R.unbind("focus",d.focus);$a.unbind("submit",oa).unbind("reset",Xa);e(window).unbind("unload beforeunload",oa).unbind("resize",Pa);e(document).unbind("mousedown",Qa);e("#"+ta+",#"+Da).remove();R.show();Oa=false};this.saveBookmark=function(){if(!F){var a=d.getRng();a=a.cloneRange?a.cloneRange():a;ha={top:X.scrollTop(),rng:a}}};this.loadBookmark=function(){if(!(F||!ha)){d.focus();var a=ha.rng;if(y)a.select();
else{var b=d.getSel();b.removeAllRanges();b.addRange(a)}X.scrollTop(ha.top);ha=null}};this.focus=function(){F?e("#sourceCode",t).focus():X.focus();return false};this.setCursorFirst=function(a){d.focus();V.scrollTo(0,0);var b=d.getRng(),c=t.body,g=c,k;if(a&&g.firstChild&&(k=g.firstChild.tagName)&&k.match(/^p|div|h[1-6]$/i))g=c.firstChild;y?b.moveToElementText(g):b.setStart(g,0);b.collapse(true);if(y)b.select();else{a=d.getSel();a.removeAllRanges();a.addRange(b)}};this.getSel=function(){return V.getSelection?
V.getSelection():t.selection};this.getRng=function(){var a=d.getSel(),b;try{b=a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():t.createRange?t.createRange():t.body.createTextRange()}catch(c){}return b};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=Z(c.item)?c.item(0).outerHTML:Z(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(F)return false;
d.focus();a=d.processHTML(a,"write");var c=d.getSel(),g=d.getRng();if(b!=undefined){if(g.item){var k=g.item(0);g=t.body.createTextRange();g.moveToElementText(k);g.select()}g.collapse(b)}a+="<"+(y?"img":"span")+' id="_xhe_temp" style="display:none" />';if(g.insertNode){g.deleteContents();g.insertNode(g.createContextualFragment(a))}else{if(c.type.toLowerCase()=="control"){c.clear();g=d.getRng()}g.pasteHTML(a)}k=e("#_xhe_temp",t);var h=k[0];if(y){g.moveToElementText(h);g.select()}else{g.selectNode(h);
c.removeAllRanges();c.addRange(g)}k.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(F)return false;d.focus();a=d.processHTML(a,"write");e(t.body).append(a)};this.domEncode=function(a){return a.replace(/[<>]/g,function(b){return{"<":"&lt;",">":"&gt;"}[b]})};this.setSource=function(a){ha=null;if(typeof a!="string"&&a!="")a=B.value;if(F)e("#sourceCode",t).val(a);else{if(m.beforeSetSource)a=m.beforeSetSource(a);
a=d.cleanHTML(a);a=d.formatXHTML(a);a=d.cleanWord(a);a=d.processHTML(a,"write");if(y){t.body.innerHTML='<img id="_xhe_temp" style="display:none" />'+a;e("#_xhe_temp",t).remove()}else t.body.innerHTML=a}};this.processHTML=function(a,b){if(b=="write"){a=a.replace(/<img(?:\s+[^>]*?)?(\s+emot\s*=\s*(["']?)\s*(.*?)\s*\2)(?:\s+[^>]*?)?\/?>/ig,function(k,h,l,j){j=j.split(",");if(!j[1]){j[1]=j[0];j[0]=""}if(j[0]=="default")j[0]="";return k.replace(/\s+src\s*=\s*(["']?).*?\1(\s|$|\/|>)/i,"$2").replace(h,' src="'+
ba+(j[0]?j[0]:"default")+"/"+j[1]+'.gif"'+(m.emotMark?' emot="'+(j[0]?j[0]+",":"")+j[1]+'"'+(k.match(/\s+alt\s*=\s*(["']?)\s*(.*?)\s*\1[\s\/>]/i)?"":' alt="'+j[1]+'"'):""))});a=a.replace(/<(\w+(?:\:\w+)?)(?:\s+[^>]*?)?(\s+(src|href)\s*=\s*(["']?)\s*(.*?)\s*\4)(?:\s+[^>]*?)?\/?>/ig,function(k,h,l,j,n,f){return k.replace(l,(M?" "+j+'="'+ga(f,"abs",M)+'"':l)+" _xhe_"+j+'="'+f+'"')});a=a.replace(/<(\/?)del(\s+[^>]*?)?>/ig,"<$1strike$2>");if(wa){a=a.replace(/<(\/?)strong(\s+[^>]*?)?>/ig,"<$1b$2>");a=a.replace(/<(\/?)em(\s+[^>]*?)?>/ig,
"<$1i$2>")}else if(da){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(k,h,l,j){for(var n,f=0;f<P.length;f++){k=P[f];if(l==k.n){n=k.wkn;break}}return h+"font-size:"+n+j});a=a.replace(/<strong(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-weight: bold;"$1>');a=a.replace(/<em(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="font-style: italic;"$1>');a=a.replace(/<u(\s+[^>]*?)?>/ig,'<span class="Apple-style-span" style="text-decoration: underline;"$1>');a=a.replace(/<strike(\s+[^>]*?)?>/ig,
'<span class="Apple-style-span" style="text-decoration: line-through;"$1>');a=a.replace(/<\/(strong|em|u|strike)>/ig,"</span>");a=a.replace(/<span((?:\s+[^>]*?)?\s+style="([^"]*;)*\s*(font-family|font-size|color|background-color)\s*:\s*[^;"]+\s*;?"[^>]*)>/ig,'<span class="Apple-style-span"$1>')}else if(y){a=a.replace(/&apos;/ig,"&#39;");a=a.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/ig,"")}a=a.replace(/<a(\s+[^>]*?)?\/>/,"<a$1></a>");if(!da){var c=function(k,h,
l,j){h="";var n,f;if(n=l.match(/font-family\s*:\s*([^;"]+)/i))h+=' face="'+n[1]+'"';if(n=l.match(/font-size\s*:\s*([^;"]+)/i)){n=n[1].toLowerCase();for(var i=0;i<P.length;i++)if(n==P[i].n||n==P[i].s){f=i+1;break}if(f){h+=' size="'+f+'"';l=l.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(f=l.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(n=f[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){f[1]="#";for(i=1;i<=3;i++)f[1]+=(n[i]-0).toString(16)}f[1]=f[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,
"#$1$1$2$2$3$3");h+=' color="'+f[1]+'"'}l=l.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(h!=""){if(l)h+=' style="'+l+'"';return"<font"+h+">"+j+"</font>"}else return k};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(/<(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(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,c)}}else{a=a.replace(/<(?:\w+(?:\:\w+)?)(?:\s+[^>]*?)?\s+_xhe_(src|href)\s*=\s*(["']?)\s*(.*?)\s*\2(?:\s+[^>]*?)?\/?>/ig,function(k,h,l,j){if(za)j=ga(j,za,M);return k.replace(RegExp("\\s+"+h+"\\s*=\\s*([\"']?).*?\\1(\\s|/?>)","ig"),
" "+h+'="'+j.replace(/\$/g,"$$$$")+'"$2')});if(da){a=a.replace(/("|;)\s*font-size\s*:\s*([a-z-]+)(;?)/ig,function(k,h,l,j){for(var n,f=0;f<P.length;f++){k=P[f];if(l==k.wkn){n=k.n;break}}return h+"font-size:"+n+j});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(k,h,l,j,n){h=l+j;l="";if(!h)return n;for(j=0;j<g.length;j++)if(h.match(g[j].r)){l=g[j].t;break}return l?
"<"+l+">"+n+"</"+l+">":k};a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"Apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\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(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
c)}y||(a=a.replace(/(?:(?!<(?:script|style)(?:\s+[^>]*?)?>)[\s\S])+|<(script|style)(?:\s+[^>]*?)?>[\s\S]+<\/\1>/g,function(k){return k.match(/^<(script|style)(?:\s+[^>]*?)?>/i)?k:k.replace(/([^<>\r\n]?)((?:\r?\n)+)([^<>\r\n]?)/ig,function(h,l,j,n){return l||n?l+j.replace(/\r?\n/g,"<br />")+n:h})}));a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+(?:_xhe_|_moz_|_webkit_)[^=]+?\s*=\s*(["']?).*?\2(\s|\/?>)/ig,"$1$3");a=a.replace(/(<\w+[^>]*?)\s+class\s*=\s*(["']?)\s*(?:apple|webkit)\-.+?\s*\2(\s|\/?>)/ig,"$1$3");
a=a.replace(/<img(\s+[^>]+?)\/?>/ig,function(k,h){h.match(/\s+alt\s*(["']?).*?\1(\s|$)/i)||(h+=' alt=""');return"<img"+h+" />"});a=a.replace(/\s+jquery\d+="\d+"/ig,"")}return a};this.getSource=function(a){var b,c=m.beforeGetSource;if(F){b=e("#sourceCode",t).val();c||(b=b.replace(/(?:(?!<(?:script|style)(?:\s+[^>]*?)?>)[\s\S])+|<(script|style)(?:\s+[^>]*?)?>[\s\S]+<\/\1>/g,function(g){return g.match(/^<(script|style)(?:\s+[^>]*?)?>/i)?g:g.replace(/(\t*\r?\n\t*)+/g,"")}))}else{b=d.processHTML(t.body.innerHTML,
"read");b=b.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<br(?:\s+[^>]*?)?>)*\s*(?:<\/\1>)?\s*$/i,"");b=d.cleanHTML(b);b=d.formatXHTML(b,a);b=d.cleanWord(b);if(c)b=c(b)}return B.value=b};this.cleanWord=function(a){if(a.match(/mso(-|normal)|WordDocument/i)){var b=m.wordDeepClean;a=a.replace(/(<link(?:\s+[^>]*?)?)\s+href\s*=\s*(["']?)\s*file:\/\/.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"");a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,"");a=a.replace(/<\/?\w+:[^>]*>/ig,
"");if(b)a=a.replace(/<\/?(span|a|img)(\s+[^>]*?)?>/ig,"");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+class\s*=\s*(["']?)\s*mso.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+lang\s*=\s*(["']?)\s*.+?\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/(<\w+(?:\s+[^>]*?)?)\s+align\s*=\s*(["']?)\s*left\s*\2((?:\s+[^>]*?)?\s*\/?>)/ig,"$1$3");a=a.replace(/<\w+(?:\s+[^>]*?)?(\s+style\s*=\s*(["']?)\s*([\s\S]*?)\s*\2)(?:\s+[^>]*?)?\s*\/?>/ig,function(c,g,k,h){h=e.trim(h.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,
""));return c.replace(g,b?"":h?' style="'+h+'"':"")})}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,"");m.linkTag||(a=a.replace(/<link(\s+[^>]*?)?>/ig,""));m.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,
""));m.inlineScript||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+on(?:click|dblclick|mousedown|mouseup|mousemove|mouseover|mouseout|mouseenter|mouseleave|keydown|keypress|keyup|change|select|submit|reset|blur|focus|load|unload)\s*=\s*(["']?)[\s\S]*?\3((?:\s+[^>]*?)?\/?>)/ig,"$1$2$4"));m.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));m.inlineStyle||(a=a.replace(/(<\w+)(\s+[^>]*?)?\s+(style|class)\s*=\s*(["']?)[\s\S]*?\4((?:\s+[^>]*?)?\/?>)/ig,"$1$2$5"));return a=a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>|&nbsp;)*?)<\1(\s+[^>]*?)?>/ig,
"$2")};this.formatXHTML=function(a,b){function c(s){var x={};s=s.split(",");for(var D=0;D<s.length;D++)x[s[D]]=true;return x}function g(s){if(s){s=s.toLowerCase();var x=u[s];if(x)s=x}else s="";return s}function k(s,x,D){s=g(s);if(i[s])for(;z.last()&&o[z.last()];)h(z.last());p[s]&&z.last()==s&&h(s);(D=f[s]||!!D)||z.push(s);var I=[];I.push("<"+s);x.replace(J,function(hb,va,ib,jb,kb){va=va.toLowerCase();I.push(" "+va+'="'+(ib?ib:jb?jb:kb?kb:q[va]?va:"")+'"')});I.push((D?" /":"")+">");l(I.join(""),s,
true)}function h(s){if(s){s=g(s);for(x=z.length-1;x>=0;x--)if(z[x]==s)break}else var x=0;if(x>=0){for(s=z.length-1;s>=x;s--)l("</"+z[s]+">",z[s]);z.length=x}}function l(s,x,D){if(b==true){s=s.replace(/(\t*\r?\n\t*)+/g,"");if(!s.match(/^\s*$/)){var I=i[x],hb=I?x:"";if(I){D&&S++;ka==""&&S--}else ka&&S++;if(hb!=ka||I)j();G.push(s);x=="br"&&j();if(I&&(f[x]||!D))S--;ka=I?x:""}}else G.push(s)}function j(){G.push("\r\n");if(S>0)for(var s=S;s--;)G.push("\t")}function n(s,x,D,I){if(!D)return I;s="";if(x=D.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))s+=
"font-family:"+x[1]+";";if(x=D.match(/ size\s*=\s*"\s*(\d+)\s*"/i))s+="font-size:"+P[(x[1]>7?7:x[1]<1?1:x[1])-1].n+";";if(x=D.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))s+="color:"+x[1]+";";if(D=D.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))s+=D[1];if(s)I='<span style="'+s+'">'+I+"</span>";return I}var f=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param,embed"),i=c("address,applet,blockquote,button,center,dd,dir,div,dl,dt,fieldset,form,frameset,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),
o=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"),p=c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),q=c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),r=c("script,style"),u={b:"strong",i:"em",s:"del",strike:"del"},v=/^<\??(\w+(?:\:\w+)?)((?:\s+[\w-\:]*(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)\s*(\/?)>/,
w=/^<\/(\w+(?:\:\w+)?)[^>]*>/,J=/\s+([\w-]+(?:\:\w+)?)(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s]+)))?/g,A=0,z=[],C=a,G=[],S=-1,ka="body";for(z.last=function(){return this[this.length-1]};C.length>0;)if(!z.last()||!r[z.last()]){A=0;if(C.substring(0,4)=="<!--"){A=C.indexOf("--\>");if(A!=-1){A+=3;l(C.substring(0,A))}}else if(C.substring(0,2)=="</"){if(match=C.match(w)){h(match[1]);A=match[0].length}}else if(C.charAt(0)=="<")if(match=C.match(v)){k(match[1],match[2],match[3]);A=match[0].length}if(A==
0){A=C.indexOf("<");if(A==0)A=1;else if(A<0)A=C.length;l(d.domEncode(C.substring(0,A)))}C=C.substring(A)}else{C=C.replace(/^([\s\S]*?)<\/(style|script)>/i,function(s,x){G.push(x);return""});h(z.last())}h();a=G.join("");G=null;a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,n);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,n);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
n);a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"");return a=a.replace(/(\t*\r?\n)+/g,"\r\n")};this.toggleShowBlocktag=function(a){if(ra!==a){ra=!ra;a=e(t.body);if(ra){ja+=" showBlocktag";a.addClass("showBlocktag")}else{ja=ja.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(F!==a){K.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");var b=t.body,c=e(b),g,k,h='<span id="_xhe_cursor'+(new Date).getTime()+'"></span>';a=0;if(F){g=d.getSource();
c.html("").removeAttr("scroll").attr("class","editMode"+ja);if(y)b.contentEditable="true";else t.designMode="On";if(wa){d._exec("inserthtml","-");e("#"+Da).show().focus().hide()}}else{d.pasteHTML(h,true);g=d.getSource(true);a=g.indexOf(h);if(!lb)a=g.substring(0,a).replace(/\r/g,"").length;g=g.replace(h,"");if(y)b.contentEditable="false";else t.designMode="Off";c.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');k=e("#sourceCode",
c).blur(d.getSource)[0]}F=!F;d.setSource(g);if(F){d.focus();if(k.setSelectionRange)k.setSelectionRange(a,a);else{k=k.createTextRange();k.move("character",a);k.select()}}else d.setCursorFirst(true);K.find("[name=Source],[name=Preview]").toggleClass("xheEnabled");K.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");setTimeout(Na,300)}};this.showPreview=function(){var a=m.beforeSetSource,b=d.getSource();if(a)b=a(b);a="<html><head>"+ua+"<title>\u9884\u89c8</title>"+
(M?'<base href="'+M+'"/>':"")+"</head><body>"+b+"</body></html>";b=window.screen;b=window.open("","xhePreview","toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="+Math.round(b.width*0.9)+",height="+Math.round(b.height*0.8)+",left="+Math.round(b.width*0.05));var c=b.document;c.open();c.write(a);c.close();b.focus()};this.toggleFullscreen=function(a){if(pa!==a){a=e("#"+ta).find(".xheLayout");var b=e("#"+ta);if(pa){a.attr("style",bb);Q.height(aa-K.outerHeight());setTimeout(function(){e(window).scrollTop(ab)},
10)}else{ab=e(window).scrollTop();bb=a.attr("style");a.removeAttr("style");Q.height("100%");setTimeout(Pa,100)}if(wa){e("#"+Da).show().focus().hide();setTimeout(d.focus,1)}pa=!pa;b.toggleClass("xhe_Fullscreen");e("html").toggleClass("xhe_Fullfix");K.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Na,300)}};this.showMenu=function(a,b){var c=e('<div class="xheMenu"></div>'),g=[];e.each(a,function(k,h){g.push('<a href="javascript:void(0);" title="'+(h.t?h.t:h.s)+'" v="'+h.v+'">'+h.s+"</a>")});
c.append(g.join(""));c.click(function(k){b(e(k.target).closest("a").attr("v"));d.hidePanel();return false}).mousedown(U);d.showPanel(c)};this.showColor=function(a){var b=e('<div class="xheColor"></div>'),c=[],g=0;e.each(nb,function(k,h){if(g%7==0)c.push((g>0?"</div>":"")+"<div>");c.push('<a href="javascript:void(0);" xhev="'+h+'" title="'+h+'" style="background:'+h+'"></a>');g++});c.push("</div>");b.append(c.join(""));b.click(function(k){k=k.target;if(e.nodeName(k,"A")){a(e(k).attr("xhev"));d.hidePanel();
return false}}).mousedown(U);d.showPanel(b)};this.showPastetext=function(){var a=e('<div>\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u65b9\u6846\u91cc\uff0c\u6309 \u786e\u5b9a</div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),b=e("#xhePastetextValue",a);e("#xheSave",a).click(function(){d.loadBookmark();
var c=b.val();c&&d.pasteText(c);d.hidePanel();return false});d.showDialog(a)};this.showLink=function(){var a=e('<div>\u94fe\u63a5\u5730\u5740: <input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div>\u6253\u5f00\u65b9\u5f0f: <select id="xheLinkTarget"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u5f53\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option></select></div><div style="display:none">\u94fe\u63a5\u6587\u5b57: <input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
b=d.getParent("a"),c=e("#xheLinkText",a),g=e("#xheLinkUrl",a),k=e("#xheLinkTarget",a),h=e("#xheSave",a),l=d.getSelect();if(b.length==1){g.val(Y(b,"href"));k.attr("value",b.attr("target"))}else l==""&&c.val(m.defLinkText).closest("div").show();m.upLinkUrl&&d.uploadInit(g,m.upLinkUrl,m.upLinkExt);h.click(function(){var j=g.val();d.loadBookmark();if(j==""||b.length==0)d._exec("unlink");if(j!=""&&j!="http://"){var n=j.split(" "),f=k.val(),i=c.val();if(n.length>1){d._exec("unlink");l=d.getSelect();var o=
'<a href="xhe_tmpurl"',p=[];if(f!="")o+=' target="'+f+'"';o+=">xhe_tmptext</a>";i=l!=""?l:i?i:j;for(var q in n){j=n[q];if(j!=""){j=j.split("||");f=o;f=f.replace("xhe_tmpurl",j[0]);f=f.replace("xhe_tmptext",j[1]?j[1]:i);p.push(f)}}d.pasteHTML(p.join("&nbsp;"))}else{j=n[0].split("||");i||(i=j[0]);i=j[1]?j[1]:l!=""?"":i?i:j[0];if(b.length==0){i?d.pasteHTML('<a href="#xhe_tmpurl">'+i+"</a>"):d._exec("createlink","#xhe_tmpurl");b=e('a[href$="#xhe_tmpurl"]',t)}else i&&!da&&b.text(i);Y(b,"href",j[0]);f!=
""?b.attr("target",f):b.removeAttr("target")}}d.hidePanel();return false});d.showDialog(a)};this.showImg=function(){var a=e('<div>\u56fe\u7247\u6587\u4ef6: <input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div>\u66ff\u6362\u6587\u672c: <input type="text" id="xheImgAlt" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheImgAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="right">\u53f3\u5bf9\u9f50</option><option value="top">\u9876\u7aef</option><option value="middle">\u5c45\u4e2d</option><option value="baseline">\u57fa\u7ebf</option><option value="bottom">\u5e95\u8fb9</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheImgBorder" style="width:40px;" /></div><div>\u6c34\u5e73\u95f4\u8ddd: <input type="text" id="xheImgHspace" style="width:40px;" /> \u5782\u76f4\u95f4\u8ddd: <input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
b=d.getParent("img"),c=e("#xheImgUrl",a),g=e("#xheImgAlt",a),k=e("#xheImgAlign",a),h=e("#xheImgWidth",a),l=e("#xheImgHeight",a),j=e("#xheImgBorder",a),n=e("#xheImgVspace",a),f=e("#xheImgHspace",a),i=e("#xheSave",a);if(b.length==1){c.val(Y(b,"src"));g.val(b.attr("alt"));k.val(b.attr("align"));h.val(b.attr("width"));l.val(b.attr("height"));j.val(b.attr("border"));var o=b.attr("vspace"),p=b.attr("hspace");n.val(o<=0?"":o);f.val(p<=0?"":p)}m.upImgUrl&&d.uploadInit(c,m.upImgUrl,m.upImgExt);i.click(function(){d.loadBookmark();
var q=c.val();if(q!=""&&q!="http://"){var r=q.split(" "),u=g.val(),v=k.val(),w=h.val(),J=l.val(),A=j.val(),z=n.val(),C=f.val();if(r.length>1){var G='<img src="xhe_tmpurl"',S=[];if(u!="")G+=' alt="'+u+'"';if(v!="")G+=' align="'+v+'"';if(w!="")G+=' width="'+w+'"';if(J!="")G+=' height="'+J+'"';if(A!="")G+=' border="'+A+'"';if(z!="")G+=' vspace="'+z+'"';if(C!="")G+=' hspace="'+C+'"';G+=" />";for(var ka in r){q=r[ka];if(q!=""){q=q.split("||");u=G;u=u.replace("xhe_tmpurl",q[0]);if(q[1])u='<a href="'+q[1]+
'" target="_blank">'+u+"</a>";S.push(u)}}d.pasteHTML(S.join("&nbsp;"))}else if(r.length==1){q=r[0];if(q!=""){q=q.split("||");if(b.length==0){d.pasteHTML('<img src="'+q[0]+'#xhe_tmpurl" />');b=e('img[src$="#xhe_tmpurl"]',t)}Y(b,"src",q[0]);u!=""&&b.attr("alt",u);v!=""?b.attr("align",v):b.removeAttr("align");w!=""?b.attr("width",w):b.removeAttr("width");J!=""?b.attr("height",J):b.removeAttr("height");A!=""?b.attr("border",A):b.removeAttr("border");z!=""?b.attr("vspace",z):b.removeAttr("vspace");C!=
""?b.attr("hspace",C):b.removeAttr("hspace");if(q[1]){r=b.parent("a");if(r.length==0){b.wrap("<a></a>");r=b.parent("a")}Y(r,"href",q[1]);r.attr("target","_blank")}}}}else b.length==1&&b.remove();d.hidePanel();return false});d.showDialog(a)};this.showEmbed=function(a,b,c,g,k,h,l){b=e(b);var j=d.getParent('embed[type="'+c+'"],embed[classid="'+g+'"]'),n=e("#xhe"+a+"Url",b),f=e("#xhe"+a+"Width",b),i=e("#xhe"+a+"Height",b);a=e("#xheSave",b);h&&d.uploadInit(n,h,l);d.showDialog(b);if(j.length==1){n.val(Y(j,
"src"));f.val(j.attr("width"));i.val(j.attr("height"))}a.click(function(){d.loadBookmark();var o=n.val();if(o!=""&&o!="http://"){var p=f.val(),q=i.val(),r=/^[0-9]+$/;r.test(p)||(p=412);r.test(q)||(q=300);var u='<embed type="'+c+'" classid="'+g+'" src="xhe_tmpurl"'+k;r=o.split(" ");if(r.length>1){u=u+"";var v,w=[];u+=' width="xhe_width" height="xhe_height" />';for(var J in r){o=r[J].split("||");v=u;v=v.replace("xhe_tmpurl",o[0]);v=v.replace("xhe_width",o[1]?o[1]:p);v=v.replace("xhe_height",o[2]?o[2]:
q);o!=""&&w.push(v)}d.pasteHTML(w.join("&nbsp;"))}else if(r.length==1){o=r[0].split("||");if(j.length==0){d.pasteHTML(u.replace("xhe_tmpurl",o[0]+"#xhe_tmpurl")+" />");j=e('embed[src$="#xhe_tmpurl"]',t)}Y(j,"src",o[0]);j.attr("width",o[1]?o[1]:p);j.attr("height",o[2]?o[2]:q)}}else j.length==1&&j.remove();d.hidePanel();return false})};this.showEmot=function(a){var b=e('<div class="xheEmot"></div>');a=a?a:Ua?Ua:"qq";var c=Ea[a],g=ba+a+"/",k=0,h=[],l="";l=c.width;var j=c.height,n=c.line,f=c.count;c=
c.list;if(f)for(c=1;c<=f;c++){k++;h.push('<a href="javascript:void(0);" style="background-image:url('+g+c+'.gif);" emot="'+a+","+c+'" xhev="">&nbsp;</a>');k%n==0&&h.push("<br />")}else e.each(c,function(p,q){k++;h.push('<a href="javascript:void(0);" style="background-image:url('+g+p+'.gif);" emot="'+a+","+p+'" title="'+q+'" xhev="'+q+'">&nbsp;</a>');k%n==0&&h.push("<br />")});f=n*(l+12);c=f*0.75;if(Math.ceil(k/n)*(j+12)<=c)c="";l=e("<style>"+(c?".xheEmot div{width:"+(f+20)+"px;height:"+c+"px;}":"")+
".xheEmot div a{width:"+l+"px;height:"+j+"px;}</style><div>"+h.join("")+"</div>").click(function(p){p=p.target;var q=e(p);if(e.nodeName(p,"A")){d.pasteHTML('<img emot="'+q.attr("emot")+'" alt="'+q.attr("xhev")+'">');d.hidePanel();return false}}).mousedown(U);b.append(l);var i=0,o=["<ul>"];e.each(Ea,function(p,q){i++;o.push("<li"+(a==p?' class="cur"':"")+'><a href="javascript:void(0);" group="'+p+'">'+q.name+"</a></li>")});if(i>1){o.push('</ul><br style="clear:both;" />');l=e(o.join("")).click(function(p){Ua=
e(p.target).attr("group");d.exec("Emot");return false}).mousedown(U);b.append(l)}d.showPanel(b)};this.showTable=function(){var a=e('<div>\u884c\u6570\u5217\u6570: <input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>\u6807\u9898\u5355\u5143: <select id="xheTableHeaders"><option selected="selected" value="">\u65e0</option><option value="row">\u7b2c\u4e00\u884c</option><option value="col">\u7b2c\u4e00\u5217</option><option value="both">\u7b2c\u4e00\u884c\u548c\u7b2c\u4e00\u5217</option></select></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>\u8fb9\u6846\u5927\u5c0f: <input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>\u8868\u683c\u95f4\u8ddd: <input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> \u8868\u683c\u586b\u5145: <input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>\u5bf9\u9f50\u65b9\u5f0f: <select id="xheTableAlign"><option selected="selected" value="">\u9ed8\u8ba4</option><option value="left">\u5de6\u5bf9\u9f50</option><option value="center">\u5c45\u4e2d</option><option value="right">\u53f3\u5bf9\u9f50</option></select></div><div>\u8868\u683c\u6807\u9898: <input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>'),
b=e("#xheTableRows",a),c=e("#xheTableColumns",a),g=e("#xheTableHeaders",a),k=e("#xheTableWidth",a),h=e("#xheTableHeight",a),l=e("#xheTableBorder",a),j=e("#xheTableCellSpacing",a),n=e("#xheTableCellPadding",a),f=e("#xheTableAlign",a),i=e("#xheTableCaption",a);e("#xheSave",a).click(function(){d.loadBookmark();var o=i.val(),p=l.val(),q=b.val(),r=c.val(),u=g.val(),v=k.val(),w=h.val(),J=j.val(),A=n.val(),z=f.val();p="<table"+(p!=""?' border="'+p+'"':"")+(v!=""?' width="'+v+'"':"")+(w!=""?' width="'+w+
'"':"")+(J!=""?' cellspacing="'+J+'"':"")+(A!=""?' cellpadding="'+A+'"':"")+(z!=""?' align="'+z+'"':"")+">";if(o!="")p+="<caption>"+o+"</caption>";if(u=="row"||u=="both"){p+="<tr>";for(o=0;o<r;o++)p+='<th scope="col">&nbsp;</th>';p+="</tr>";q--}p+="<tbody>";for(o=0;o<q;o++){p+="<tr>";for(v=0;v<r;v++)p+=v==0&&(u=="col"||u=="both")?'<th scope="row">&nbsp;</th>':"<td>&nbsp;</td>";p+="</tr>"}p+="</tbody></table>";d.pasteHTML(p);d.hidePanel();return false});d.showDialog(a)};this.showArtpage=function(){if(F)return false;
d.focus();d.pasteHTML("<br/>##------[ART_PAGE]------##")};this.showAbout=function(){var a=e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.1 (build 101002)</p><p>xhEditor\u662f\u57fa\u4e8ejQuery\u5f00\u53d1\u7684\u8de8\u5e73\u53f0\u8f7b\u91cfXHTML\u7f16\u8f91\u5668\uff0c\u57fa\u4e8e<a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>\u5f00\u6e90\u534f\u8bae\u53d1\u5e03\u3002</p><p>Copyright \u00a9 <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
d.showDialog(a)};this.addShortcuts=function(a,b){a=a.toLowerCase();if(qa[a]==undefined)qa[a]=[];qa[a].push(b)};this.delShortcuts=function(a){delete qa[a]};this.uploadInit=function(a,b,c){function g(f){if(Z(f,"string"))f=[f];var i=false,o,p=f.length,q,r=[];(o=m.onUpload)&&o(f);for(o=0;o<p;o++){q=f[o];q=Z(q,"string")?q:q.url;if(q.substr(0,1)=="!"){i=true;q=q.substr(1)}r.push(q)}a.val(r.join(" "));i&&a.closest(".xheDialog").find("#xheSave").click()}var k=e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+
m.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),h=e(".xheBtn",k),l=m.html5Upload,j=l?m.upMultiple:1;a.after(k);h.before(a);b=b.replace(/{editorRoot}/ig,T);if(b.substr(0,1)=="!")h.click(function(){O=false;d.showIframeModal("\u4e0a\u4f20\u6587\u4ef6",b.substr(1),g,null,null,function(){O=true})});else{k.append('<input type="file"'+(j>1?' multiple=""':"")+' class="xheFile" size="13" name="filedata" tabindex="-1" />');var n=e(".xheFile",k);n.change(function(){d.startUpload(n[0],b,c,g)});setTimeout(function(){a.closest(".xheDialog").bind("dragenter dragover",
U).bind("drop",function(f){f=f.originalEvent.dataTransfer;var i;if(l&&f&&(i=f.files)&&i.length>0)d.startUpload(i,b,c,g);return false})},10)}};this.startUpload=function(a,b,c,g){function k(r,u){var v=Object,w=false;try{v=eval("("+r+")")}catch(J){}if(v.err==undefined||v.msg==undefined)alert(b+" \u4e0a\u4f20\u63a5\u53e3\u53d1\u751f\u9519\u8bef\uff01\r\n\r\n\u8fd4\u56de\u7684\u9519\u8bef\u5185\u5bb9\u4e3a: \r\n\r\n"+r);else if(v.err)alert(v.err);else{h.push(v.msg);w=true}if(!w||u)d.removeModal();u&&w&&
g(h);return w}var h=[],l=m.html5Upload,j=l?m.upMultiple:1,n,f,i=e('<div style="padding:22px 0;text-align:center;line-height:30px;">\u6587\u4ef6\u4e0a\u4f20\u4e2d\uff0c\u8bf7\u7a0d\u5019\u2026\u2026<br /></div>'),o='<img src="'+Ta+'img/loading.gif">';if(!l||a.nodeType&&!((f=a.files)&&f[0])){if(!Ya(a.value,c))return;i.append(o);n=new d.html4Upload(a,b,k)}else{f||(f=a);a=f.length;if(a>j){alert("\u8bf7\u4e0d\u8981\u4e00\u6b21\u4e0a\u4f20\u8d85\u8fc7"+j+"\u4e2a\u6587\u4ef6");return}for(j=0;j<a;j++)if(!Ya(f[j].fileName,
c))return;var p=e('<div class="xheProgress"><div><span>0%</span></div></div>');i.append(p);n=new d.html5Upload("filedata",f,b,k,function(r){if(r.loaded>=0){var u=Math.round(r.loaded*100/r.total)+"%";e("div",p).css("width",u);e("span",p).text(u+" ( "+Za(r.loaded)+" / "+Za(r.total)+" )")}else p.replaceWith(o)})}var q=O;if(q)O=false;d.showModal("\u6587\u4ef6\u4e0a\u4f20\u4e2d(Esc\u53d6\u6d88\u4e0a\u4f20)",i,320,150,function(){O=q;n.remove()});n.start()};this.html4Upload=function(a,b,c){var g="jUploadFrame"+
(new Date).getTime(),k=this,h=e('<iframe name="'+g+'" class="xheHideArea" />').appendTo("body"),l=e('<form action="'+b+'" target="'+g+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),j=e(a),n=j.clone().attr("disabled","true");j.before(n).appendTo(l);this.remove=function(){if(k!=null){n.before(j).remove();h.remove();l.remove();k=null}};this.onLoad=function(){c(e(h[0].contentWindow.document.body).text(),true)};this.start=function(){l.submit();h.load(k.onLoad)};
return this};this.html5Upload=function(a,b,c,g,k){function h(r,u,v,w){j=new XMLHttpRequest;upload=j.upload;j.onreadystatechange=function(){j.readyState==4&&v(j.responseText)};if(upload)upload.onprogress=function(J){w(J.loaded)};else w(-1);j.open("POST",u);j.setRequestHeader("Content-Type","application/octet-stream");j.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+r.fileName+'"');j.sendAsBinary?j.sendAsBinary(r.getAsBinary()):j.send(r)}function l(r){k&&k({loaded:i+r,
total:o})}for(var j,n=0,f=b.length,i=0,o=0,p=this,q=0;q<f;q++)o+=b[q].fileSize;this.remove=function(){if(j){j.abort();j=null}};this.uploadNext=function(r){if(r){i+=b[n-1].fileSize;l(0)}if((!r||r&&g(r,n==f)==true)&&n<f)h(b[n++],c,p.uploadNext,function(u){l(u)})};this.start=function(){p.uploadNext()}};this.showIframeModal=function(a,b,c,g,k,h){b=e('<iframe frameborder="0" src="'+b.replace(/{editorRoot}/ig,T)+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');var l=
e(b[0]),j=e(b[1]);d.showModal(a,b,g,k,h);l.load(function(){var n=l[0].contentWindow,f=e(n.document);n.callback=function(i){d.removeModal();c(i)};n.unloadme=d.removeModal;f.keydown(d.checkEsc);l.show();j.remove()})};this.showModal=function(a,b,c,g,k){if(ya)return false;fa=m.layerShadow;c=c?c:m.modalWidth;g=g?g:m.modalHeight;W=e('<div class="xheModal" style="width:'+(c-1)+"px;height:"+g+"px;margin-left:-"+Math.ceil(c/2)+"px;"+(y&&Fa<=7?"":"margin-top:-"+Math.ceil(g/2)+"px")+'">'+(m.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="\u5173\u95ed (Esc)"></span>'+
a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");Ha=e('<div class="xheModalOverlay"></div>').appendTo("body");if(fa>0)Ga=e('<div class="xheModalShadow" style="width:'+W.outerWidth()+"px;height:"+W.outerHeight()+"px;margin-left:-"+(Math.ceil(c/2)-fa-2)+"px;"+(y&&Fa<=7?"":"margin-top:-"+(Math.ceil(g/2)-fa-2)+"px")+'"></div>').appendTo("body");e(".xheModalContent",W).css("height",g-(m.modalTitle?e(".xheModalTitle").outerHeight():0)).html(b);if(y&&Fa==6)Ia=e("select:visible").css("visibility",
"hidden");e(".xheModalClose",W).click(d.removeModal);Ha.show();fa>0&&Ga.show();W.show();ya=true;Ja=k};this.removeModal=function(){Ia&&Ia.css("visibility","visible");W.html("").remove();fa>0&&Ga.remove();Ha.remove();Ja&&Ja();ya=false};this.showDialog=function(a){var b=e('<div class="xheDialog"></div>');a=e(a);var c=e("#xheSave",a);if(c.length==1){a.find("input[type=text],select").keypress(function(h){if(h.which==13){c.click();return false}});a.find("textarea").keydown(function(h){if(h.ctrlKey&&h.which==
13){c.click();return false}});c.after(' <input type="button" id="xheCancel" value="\u53d6\u6d88" />');e("#xheCancel",a).click(d.hidePanel);if(!m.clickCancelDialog){xa=false;var g=e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(U),k=Q.offset();g.css({left:k.left,top:k.top,width:Q.outerWidth(),height:Q.outerHeight()})}b.mousedown(function(){sa=true})}b.append(a);d.showPanel(b);y||setTimeout(function(){b.find("input[type=text],textarea").filter(":visible").filter(function(){return e(this).css("visibility")!=
"hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!N.target)return false;L.html("").append(a).css("left",-999).css("top",-999);ea=e(N.target).closest("a").addClass("xheActive");var b=ea.offset();a=b.left;b=b.top;b+=ea.outerHeight()-1;ma.css({left:a+1,top:b,width:ea.width()}).show();if(a+L.outerWidth()>document.body.clientWidth)a-=L.outerWidth()-ea.outerWidth();var c=m.layerShadow;c>0&&la.css({left:a+c,top:b+c,width:L.outerWidth(),height:L.outerHeight()}).show();L.css({left:a,top:b}).show();
Sa=O=true};this.hidePanel=function(){if(O){ea.removeClass("xheActive");la.hide();ma.hide();L.hide();O=false;if(!xa){e(".xheFixCancel").remove();xa=true}Sa=sa=false;$=null}};this.exec=function(a){d.hidePanel();d.saveBookmark();var b=na[a];if(!b)return false;if(N==null){N={};var c=K.find(".xheButton[name="+a+"]");if(c.length==1)N.target=c}if(b.e)b.e.call(d);else{a=a.toLowerCase();switch(a){case "cut":try{t.execCommand(a);if(!t.queryCommandSupported(a))throw"Error";}catch(g){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + X)\u6765\u5b8c\u6210")}break;
case "copy":try{t.execCommand(a);if(!t.queryCommandSupported(a))throw"Error";}catch(k){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + C)\u6765\u5b8c\u6210")}break;case "paste":try{t.execCommand(a);if(!t.queryCommandSupported(a))throw"Error";}catch(h){alert("\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u952e\u76d8\u5feb\u6377\u952e(Ctrl + V)\u6765\u5b8c\u6210")}break;
case "pastetext":window.clipboardData?d.pasteText(window.clipboardData.getData("Text",true)):d.showPastetext();break;case "blocktag":var l=[];e.each(ob,function(f,i){l.push({s:"<"+i.n+">"+i.t+"</"+i.n+">",v:"<"+i.n+">",t:i.t})});d.showMenu(l,function(f){d._exec("formatblock",f)});break;case "fontface":var j=[];e.each(pb,function(f,i){i.c=i.c?i.c:i.n;j.push({s:'<span style="font-family:'+i.c+'">'+i.n+"</span>",v:i.c,t:i.n})});d.showMenu(j,function(f){d._exec("fontname",f)});break;case "fontsize":var n=
[];e.each(P,function(f,i){n.push({s:'<span style="font-size:'+i.s+';">'+i.t+"("+i.s+")</span>",v:f+1,t:i.t})});d.showMenu(n,function(f){d._exec("fontsize",f)});break;case "fontcolor":d.showColor(function(f){d._exec("forecolor",f)});break;case "backcolor":d.showColor(function(f){if(y)d._exec("backcolor",f);else{Ma(true);d._exec("hilitecolor",f);Ma(false)}});break;case "align":d.showMenu(qb,function(f){d._exec(f)});break;case "list":d.showMenu(rb,function(f){d._exec(f)});break;case "link":d.showLink();
break;case "img":d.showImg();break;case "flash":d.showEmbed("Flash",'<div>\u52a8\u753b\u6587\u4ef6: <input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>',"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",
' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',m.upFlashUrl,m.upFlashExt);break;case "media":d.showEmbed("Media",'<div>\u5a92\u4f53\u6587\u4ef6: <input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div>\u5bbd\u5ea6\u9ad8\u5ea6: <input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="\u786e\u5b9a" /></div>',
"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',m.upMediaUrl,m.upMediaExt);break;case "emot":d.showEmot();break;case "table":d.showTable();break;case "source":d.toggleSource();break;case "preview":d.showPreview();break;case "print":V.print();break;case "fullscreen":d.toggleFullscreen();break;case "artpage":d.showArtpage();break;case "about":d.showAbout();break;default:d._exec(a)}}N=null};this._exec=function(a,b,c){c||d.focus();return b!=
undefined?t.execCommand(a,false,b):t.execCommand(a,false,null)}};e(function(){e.fn.oldVal=e.fn.val;e.fn.val=function(B){var E=this,H;if(B===undefined)return this[0]&&(H=this[0].xheditor)?H.getSource():E.oldVal(B);return this.each(function(){(H=this.xheditor)?H.setSource(B):E.oldVal(B)})};e("textarea").each(function(){var B=e(this),E=B.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i);if(E)B.xheditor(E[1]?{tools:E[1]}:null)})})})(jQuery);
