xheditor-1.1.7-en.min.js 53 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. (function(d,W){if(d.xheditor)return false;d.fn.xheditor=function(B){var A=[];this.each(function(){if(d.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 I=/({.*})/.exec(d(this).attr("class"));if(I){try{I=eval("("+I[1]+")")}catch(Ma){}B=d.extend({},I,B)}I=new d.xheditor(this,B);if(I.init()){this.xheditor=I;A.push(I)}}});if(A.length===0)A=false;if(A.length===1)A=A[0];return A};var ja=0,Aa=d.browser.version,
  2. y=d.browser.msie,Ba=d.browser.mozilla,X=d.browser.safari,cb=d.browser.opera,S=false,Ca=true,Da=false,db=false,M,pa,qa,ka,Y,Na,la,Oa,Pa,Qa,U;d("script[src*=xheditor]").each(function(){var B=this.src;if(B.match(/xheditor[^\/]*\.js/i)){U=B.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var tb={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",
  3. 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"},ub=["#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",
  4. "#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"],vb=[{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",
  5. t:"Preformatted"},{n:"address",t:"Address"}],wb=[{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"}],Z=[{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"}],xb=[{s:"Align left",v:"justifyleft",t:"Align left"},{s:"Align center",v:"justifycenter",t:"Align center"},
  6. {s:"Align right",v:"justifyright",t:"Align right"},{s:"Align full",v:"justifyfull",t:"Align full"}],yb=[{s:"Ordered list",v:"insertOrderedList",t:"Ordered list"},{s:"Unordered list",v:"insertUnorderedList",t:"Unordered list"}],zb={"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",
  7. 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"}}},ra={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"},
  8. 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 (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"Indent (Tab)",s:"Tab"},Link:{t:"Insert/edit link (Ctrl+K)",s:"Ctrl+K",h:1},Unlink:{t:"Unlink"},Img:{t:"Insert/edit image",h:1},Flash:{t:"Insert/edit flash",h:1},Media:{t:"Insert/edit media",h:1},Emot:{t:"Emotions",
  9. 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"}},Ra={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"};
  10. Ra.mfull=Ra.full.replace(/\|(,Align)/i,"/$1");var Ab={a:"Link",img:"Img",embed:"Embed"},Bb={"<":"&lt;",">":"&gt;",'"':"&quot;","\u00ae":"&reg;","\u00a9":"&copy;"},Cb=/[<>"\u00ae\u00a9]/g;d.xheditor=function(B,A){function I(a){a=a.target;var b=Ab[a.tagName.toLowerCase()];if(b){if(b==="Embed")b={"application/x-shockwave-flash":"Flash","application/x-mplayer2":"Media"}[a.type.toLowerCase()];e.exec(b)}}function Ma(a){if(a.which===27){if(Da)e.removeModal();else S&&e.hidePanel();return false}}function eb(){setTimeout(e.setSource,
  11. 10)}function $(){e.getSource()}function fb(a){var b=o.cleanPaste;if(b===0||H||Sa)return true;Sa=true;e.saveBookmark();var c=y?"pre":"div",h=d("<"+c+' class="xhe-paste" style="top:'+aa.scrollTop()+'px;">&nbsp;</'+c+">",w);c=h[0];var q=e.getSel(),m=e.getRng(true);d(w.body).append(h);if(y){m.moveToElementText(c);m.select();m.execCommand("Paste");a.preventDefault()}else{m.selectNodeContents(c);q.removeAllRanges();q.addRange(m)}setTimeout(function(){var n=b===3,i;if(n)i=h.text();else{i=d(".xhe-paste",
  12. h);var j=[];if(i.length===0)i=h;i.each(function(f,g){j.push(g.innerHTML)});i=j.join("<br />")}h.remove();e.loadBookmark();if(n)e.pasteText(i);else{i=e.cleanHTML(i);i=e.cleanWord(i);i=e.formatXHTML(i);e.pasteHTML(i)}Sa=false},0)}function Ta(a){try{e._exec("styleWithCSS",a,true)}catch(b){try{e._exec("useCSS",!a,true)}catch(c){}}}function Ua(){if(Va&&!H){Ta(false);try{e._exec("enableObjectResizing",true,true)}catch(a){}if(y)try{e._exec("BackgroundImageCache",true,true)}catch(b){}}}function Db(a){if(H||
  13. a.which!==13||a.shiftKey||a.ctrlKey||a.altKey)return true;a=e.getParent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(o.forcePtag)a.length===0&&e._exec("formatblock","<p>");else{e.pasteHTML("<br />");y&&a.length>0&&e.getRng().parentElement().childNodes.length===2&&e.pasteHTML("<br />");return false}}function Wa(){if(!Ba&&!X){sa&&N.height("100%").css("height",N.outerHeight()-K.outerHeight());y&&K.hide().show()}}function Eb(a){a=a.target;if(a.tagName.match(/(img|embed)/i)){var b=
  14. e.getSel(),c=e.getRng(true);c.selectNode(a);b.removeAllRanges();b.addRange(c)}}function ba(a,b,c){if(!b)return false;var h="_xhe_"+b;if(c){if(Ea)c=ca(c,Ea,O);a.attr(b,O?ca(c,"abs",O):c).removeAttr(h).attr(h,c)}return a.attr(h)||a.attr(b)}function Xa(){Ca&&e.hidePanel()}function Fb(a){if(H)return true;var b=a.which,c=tb[b];b=c?c:String.fromCharCode(b).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=b;a=ta[sKey];for(var h in a){h=a[h];if(d.isFunction(h)){if(h.call(e)===
  15. false)return false}else{e.exec(h);return false}}}function da(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))return a;var h=c?d('<a href="'+c+'" />')[0]:location;c=h.protocol;var q=h.host,m=h.hostname,n=h.port;h=h.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");if(n==="")n="80";if(h==="")h="/";else if(h.charAt(0)!=="/")h="/"+h;a=d.trim(a);if(b!=="abs")a=
  16. a.replace(RegExp(c+"\\/\\/"+m.replace(/\./g,"\\.")+"(?::"+n+")"+(n==="80"?"?":"")+"(/|$)","i"),"/");if(b==="rel")a=a.replace(RegExp("^"+h.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(b!=="rel"){a.match(/^(https?:\/\/|\/)/i)||(a=h+a);if(a.charAt(0)==="/"){m=[];a=a.split("/");var i=a.length;for(h=0;h<i;h++){n=a[h];if(n==="..")m.pop();else n!==""&&n!=="."&&m.push(n)}a[i-1]===""&&m.push("");a="/"+m.join("/")}}if(b==="abs"&&!a.match(/^https?:\/\//i))a=c+"//"+q+a;return a=a.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,
  17. "$1$2")}function gb(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 hb(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 V(){return false}var e=this,P=d(B),ib=P.closest("form"),K,N,ea,aa,w,Fa,ma,Va=false,H=false,sa=false,Sa=false,Ya,ua=false,jb="",Q=null,Za,va=false,$a=false,na=null,fa=null,T=
  18. 0,o=e.settings=d.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:"Click here",layerShadow:3,emotMark:false,upBtnText:"Upload",cleanPaste:2,hoverExecDelay:100,html5Upload:true,upMultiple:99},A),Ga=o.plugins,
  19. Ha=[];if(Ga){ra=d.extend({},ra,Ga);d.each(Ga,function(a){Ha.push(a)});Ha=Ha.join(",")}if(o.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var kb=Ra[d.trim(o.tools)];o.tools=o.tools.match(/m?full/i)&&Ga?kb.replace("Table","Table,"+Ha):kb}o.tools.match(/(^|,)\s*About\s*(,|$)/i)||(o.tools+=",About");o.tools=o.tools.split(",");if(o.editorRoot)U=o.editorRoot;U=ca(U,"abs");if(o.urlBase)o.urlBase=ca(o.urlBase,"abs");var lb="xheCSS_"+o.skin,wa="xhe"+ja+"_container",mb="xhe"+ja+"_Tool",nb="xhe"+ja+"_iframearea",
  20. ob="xhe"+ja+"_iframe",Ia="xhe"+ja+"_fixffcursor",xa="",oa="",ab=U+"xheditor_skin/"+o.skin+"/",Ja=zb,Ea=o.urlType,O=o.urlBase,ga=o.emotPath;ga=ga?ga:U+"xheditor_emot/";var bb="";Ja=d.extend({},Ja,o.emots);ga=ca(ga,"rel",O?O:null);if(ua=o.showBlocktag)oa+=" showBlocktag";var ta=[];this.init=function(){d("#"+lb).length===0&&d("head").append('<link id="'+lb+'" rel="stylesheet" type="text/css" href="'+ab+'ui.css" />');var a=o.width||B.style.width||P.outerWidth();T=o.height||B.style.height||P.outerHeight();
  21. if(da(T,"string"))T=T.replace(/[^\d]+/g,"");if(a<=0||T<=0){alert("Current textarea is hidden, please make it show before initialization xhEditor, or directly initialize the height.");return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var b=o.background||B.style.background,c=['<span class="xheGStart"/>'],h,q,m=/\||\//i;d.each(o.tools,function(f,g){g.match(m)&&c.push('<span class="xheGEnd"/>');if(g==="|")c.push('<span class="xheSeparator"/>');else if(g==="/")c.push("<br />");else{h=ra[g];if(!h)return;
  22. q=h.c?h.c:"xheIcon xheBtn"+g;c.push('<span><a href="javascript:void(0);" title="'+h.t+'" name="'+g+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+q+'" unselectable="on" /></a></span>');h.s&&e.addShortcuts(h.s,g)}g.match(m)&&c.push('<span class="xheGStart"/>')});c.push('<span class="xheGEnd"/><br />');P.after(d('<input type="text" id="'+Ia+'" style="position:absolute;display:none;" /><span id="'+wa+'" class="xhe_'+o.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+
  23. a+";height:"+T+'px;"><tbody><tr><td id="'+mb+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+nb+'" class="xheIframeArea"><iframe frameborder="0" id="'+ob+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));K=d("#"+mb);N=d("#"+nb);xa='<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+ab+'iframe.css"/>';if(a=o.loadCSS)if(da(a,"array"))for(var n in a)xa+='<link rel="stylesheet" href="'+
  24. a[n]+'"/>';else xa+=a.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?a:'<link rel="stylesheet" href="'+a+'"/>';n="<html><head>"+xa;if(b)n+="<style>body{background:"+b+";}</style>";n+='</head><body spellcheck="false" class="editMode'+oa+'"></body></html>';e.win=ea=d("#"+ob)[0].contentWindow;aa=d(ea);try{this.doc=w=ea.document;Fa=d(w);w.open();w.write(n);w.close();if(y)w.body.contentEditable="true";else w.designMode="On"}catch(i){}setTimeout(Ua,300);e.setSource();ea.setInterval=null;K.append(c.join("")).bind("mousedown contextmenu",
  25. V).click(function(f){var g=d(f.target).closest("a");if(g.is(".xheEnabled")){Q=f;e.exec(g.attr("name"))}return false});K.find(".xheButton").hover(function(f){var g=d(this),l=o.hoverExecDelay,k=fa;fa=null;if(l===-1||va||!g.is(".xheEnabled"))return false;if(k&&k>10){va=true;setTimeout(function(){va=false},100);return false}var p=g.attr("name");if(ra[p].h!==1){e.hidePanel();return false}if($a)l=0;if(l>=0)Za=setTimeout(function(){Q=f;na={x:Q.clientX,y:Q.clientY};e.exec(p)},l)},function(){na=null;Za&&clearTimeout(Za)}).mousemove(function(f){if(na){var g=
  26. {x:f.clientX-na.x,y:f.clientY-na.y};if(Math.abs(g.x)>1||Math.abs(g.y)>1){if(g.x>0&&g.y>0){g=Math.round(Math.atan(g.y/g.x)/0.017453293);fa=fa?(fa+g)/2:g}else fa=null;na={x:f.clientX,y:f.clientY}}}});M=d("#xhePanel");pa=d("#xheShadow");qa=d("#xheCntLine");if(M.length===0){M=d('<div id="xhePanel"></div>').mousedown(function(f){f.stopPropagation()});pa=d('<div id="xheShadow"></div>');qa=d('<div id="xheCntLine"></div>');setTimeout(function(){d(document.body).append(M).append(pa).append(qa)},10)}d("#"+
  27. wa).show();P.hide();N.css("height",T-K.outerHeight());y&Aa<8&&setTimeout(function(){N.css("height",T-K.outerHeight())},1);P.focus(e.focus);ib.submit($).bind("reset",eb);o.submitID&&d("#"+o.submitID).click($);d(window).bind("unload beforeunload",$).bind("resize",Wa);d(document).mousedown(Xa);if(!db){d(document).keydown(Ma);db=true}aa.focus(function(){o.focus&&o.focus()}).blur(function(){o.blur&&o.blur()});X&&aa.click(Eb);Fa.mousedown(Xa).keydown(Fb).keypress(Db).dblclick(I).bind("mousedown click",
  28. function(f){P.trigger(f.type)});if(y){Fa.keydown(function(f){var g=e.getRng();if(f.which===8&&g.item){d(g.item(0)).remove();return false}});var j=function(f){f=d(f.target);var g;if(g=f.css("width"))f.css("width","").attr("width",g.replace(/[^0-9%]+/g,""));if(g=f.css("height"))f.css("height","").attr("height",g.replace(/[^0-9%]+/g,""))};Fa.bind("controlselect",function(f){f=f.target;d.nodeName(f,"IMG")&&d(f).unbind("resizeend",j).bind("resizeend",j)})}b=d(w.documentElement);cb?b.bind("keydown",function(f){f.ctrlKey&&
  29. f.which===86&&fb()}):b.bind("paste",fb);o.disableContextmenu&&b.bind("contextmenu",V);o.html5Upload&&b.bind("dragenter dragover",function(f){var g;if((g=f.originalEvent.dataTransfer.types)&&d.inArray("Files",g)!==-1)return false}).bind("drop",function(f){f=f.originalEvent.dataTransfer;var g;if(f&&(g=f.files)&&g.length>0){var l,k;f=["Link","Img","Flash","Media"];var p=[],r;for(l in f){k=f[l];o["up"+k+"Url"]&&o["up"+k+"Url"].match(/^[^!].*/i)&&p.push(k+":,"+o["up"+k+"Ext"])}if(p.length===0)return false;
  30. else r=p.join(",");k=function(t){var s,u;for(l=0;l<t.length;l++){s=t[l].fileName.replace(/.+\./,"");if(s=r.match(RegExp("(\\w+):[^:]*,"+s+"(?:,|$)","i")))if(u){if(u!==s[1])return 2}else u=s[1];else return 1}return u}(g);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&&e.startUpload(g,o["up"+k+"Url"],"*",function(t){var s=[],u;(u=o.onUpload)&&u(t);for(l in t){u=t[l];url=da(u,"string")?
  31. u:u.url;if(url.substr(0,1)==="!")url=url.substr(1);s.push(url)}e.exec(k);d("#xhe"+k+"Url").val(s.join(" "));d("#xheSave").click()});return false}});(b=o.shortcuts)&&d.each(b,function(f,g){e.addShortcuts(f,g)});ja++;Va=true;if(o.fullscreen)e.toggleFullscreen();else o.sourceMode&&setTimeout(e.toggleSource,20);return true};this.remove=function(){e.hidePanel();$();P.unbind("focus",e.focus);ib.unbind("submit",$).unbind("reset",eb);o.submitID&&d("#"+o.submitID).unbind("mousedown",$);d(window).unbind("unload beforeunload",
  32. $).unbind("resize",Wa);d(document).unbind("mousedown",Xa);d("#"+wa).remove();d("#"+Ia).remove();P.show();Va=false};this.saveBookmark=function(){if(!H){var a=e.getRng();a=a.cloneRange?a.cloneRange():a;ma={top:aa.scrollTop(),rng:a}}};this.loadBookmark=function(){if(!(H||!ma)){e.focus();var a=ma.rng;if(y)a.select();else{var b=e.getSel();b.removeAllRanges();b.addRange(a)}aa.scrollTop(ma.top);ma=null}};this.focus=function(){H?d("#sourceCode",w).focus():aa.focus();if(y){var a=e.getRng();a.parentElement&&
  33. a.parentElement().ownerDocument!==w&&e.setCursorFirst()}return false};this.setCursorFirst=function(a){ea.scrollTo(0,0);var b=e.getRng(true),c=w.body,h=c,q;if(a&&h.firstChild&&(q=h.firstChild.tagName)&&q.match(/^p|div|h[1-6]$/i))h=c.firstChild;y?b.moveToElementText(h):b.setStart(h,0);b.collapse(true);if(y)b.select();else{a=e.getSel();a.removeAllRanges();a.addRange(b)}};this.getSel=function(){return w.selection?w.selection:ea.getSelection()};this.getRng=function(a){var b,c;try{if(!a){b=e.getSel();c=
  34. b.createRange?b.createRange():b.rangeCount>0?b.getRangeAt(0):null}c||(c=w.body.createTextRange?w.body.createTextRange():w.createRange())}catch(h){}return c};this.getParent=function(a){var b=e.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=d(c);c.is(a)||(c=d(c).closest(a));return c};this.getSelect=
  35. function(a){var b=e.getSel(),c=e.getRng(),h=true;h=!c||c.item?false:!b||c.boundingWidth===0||c.collapsed;if(a==="text")return h?"":c.text||(b.toString?b.toString():"");if(c.cloneContents){a=d("<div></div>");(c=c.cloneContents())&&a.append(c);c=a.html()}else c=da(c.item)?c.item(0).outerHTML:da(c.htmlText)?c.htmlText:c.toString();if(h)c="";c=e.processHTML(c,"read");c=e.cleanHTML(c);return c=e.formatXHTML(c)};this.pasteHTML=function(a,b){if(H)return false;e.focus();a=e.processHTML(a,"write");var c=e.getSel(),
  36. h=e.getRng();if(b!==W){if(h.item){var q=h.item(0);h=e.getRng(true);h.moveToElementText(q);h.select()}h.collapse(b)}a+="<"+(y?"img":"span")+' id="_xhe_temp" width="0" height="0" />';if(h.insertNode){h.deleteContents();h.insertNode(h.createContextualFragment(a))}else{if(c.type.toLowerCase()==="control"){c.clear();h=e.getRng()}h.pasteHTML(a)}q=d("#_xhe_temp",w);var m=q[0];if(y){h.moveToElementText(m);h.select()}else{h.selectNode(m);c.removeAllRanges();c.addRange(h)}q.remove()};this.pasteText=function(a,
  37. b){a||(a="");a=e.domEncode(a);a=a.replace(/\r?\n/g,"<br />");e.pasteHTML(a,b)};this.appendHTML=function(a){if(H)return false;e.focus();a=e.processHTML(a,"write");d(w.body).append(a)};this.domEncode=function(a){return a.replace(Cb,function(b){return Bb[b]})};this.setSource=function(a){ma=null;if(typeof a!=="string"&&a!=="")a=B.value;if(H)d("#sourceCode",w).val(a);else{if(o.beforeSetSource)a=o.beforeSetSource(a);a=e.cleanHTML(a);a=e.formatXHTML(a);a=e.processHTML(a,"write");if(y){w.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+
  38. a+"\n";d("#_xhe_temp",w).remove()}else w.body.innerHTML=a}};this.processHTML=function(a,b){if(b==="write"){a=a.replace(/(<(\/?)(\w+))((?:\s+[\w-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(m,n,i,j,f,g,l){j=j.toLowerCase();if(Ba)if(j==="strong")j="b";else{if(j==="em")j="i"}else if(X)if(j==="strong"){j="span";i||(f+=' class="Apple-style-span" style="font-weight: bold;"')}else if(j==="em"){j="span";i||(f+=' class="Apple-style-span" style="font-style: italic;"')}else if(j==="u"){j="span";
  39. i||(f+=' class="Apple-style-span" style="text-decoration: underline;"')}else if(j==="strike"){j="span";i||(f+=' class="Apple-style-span" style="text-decoration: line-through;"')}var k,p;if(j==="del")j="strike";else if(j==="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 o.emotMark?t:""});else if(j==="a"&&l)g="></a>";else if(j==="table"&&!i){m=f.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i);
  40. if(!m||m[1].match(/^(["']?)\s*0\s*\1$/))p="xhe-border"}var r;f=f.replace(/\s+([\w-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(t,s,u){s=s.toLowerCase();u=u.match(/^(["']?)(.*)\1/)[2];aft="";if(y&&s.match(/^(disabled|checked|readonly|selected)$/)&&u.match(/^(false|0)$/i))return"";if(j==="img"&&k&&s==="src")return"";if(s.match(/^(src|href)$/)){aft=" _xhe_"+s+'="'+u+'"';if(O)u=ca(u,"abs",O)}if(p&&s==="class"){u+=" "+p;p=""}if(X&&s==="style")if(j==="span"&&u.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))r=
  41. true;return" "+s+'="'+u+'"'+aft});if(k){m=ga+(k[0]?k[0]:"default")+"/"+k[1]+".gif";f+=' src="'+m+'" _xhe_src="'+m+'"'}if(r)f+=' class="Apple-style-span"';if(p)f+=' class="'+p+'"';return"<"+i+j+f+g});if(y)a=a.replace(/&apos;/ig,"&#39;");if(!X){var c=function(m,n,i,j){n="";var f,g;if(f=i.match(/font-family\s*:\s*([^;"]+)/i))n+=' face="'+f[1]+'"';if(f=i.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var l=0;l<Z.length;l++)if(f===Z[l].n||f===Z[l].s){g=l+1;break}if(g){n+=' size="'+g+'"';
  42. i=i.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(g=i.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=g[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){g[1]="#";for(l=1;l<=3;l++)g[1]+=(f[l]-0).toString(16)}g[1]=g[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");n+=' color="'+g[1]+'"'}i=i.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(n!==""){if(i)n+=' style="'+i+'"';return"<font"+n+">"+j+"</font>"}else return m};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,
  43. 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(X){var h=[{r:/font-weight:\sbold/ig,
  44. 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(m,n,i,j,f){n=i+j;i="";if(!n)return f;for(j=0;j<h.length;j++)if(n.match(h[j].r)){i=h[j].t;break}return i?"<"+i+">"+f+"</"+i+">":m};for(var q=0;q<2;q++){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,
  45. 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(m,n,i,j,f){i=i.toLowerCase();var g;j=j.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(l,
  46. k){g=k.match(/^(["']?)(.*)\1/)[2];return""});if(g&&Ea)g=ca(g,Ea,O);j=j.replace(/\s+([\w-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(l,k,p){k=k.toLowerCase();p=p.match(/^(["']?)(.*)\1/)[2];if(k==="class"){if(p.match(/^["']?(apple|webkit)/i))return"";if(i==="table"){p=p.replace(/\s?xhe-border/ig,"");if(p==="")return""}}else if(k.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return"";else if(g&&k.match(/^(src|href)$/i))return" "+k+'="'+g+'"';else if(k==="style")p=p.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,
  47. function(r,t,s,u,E){for(var L,C=0;C<Z.length;C++){r=Z[C];if(u===r.n){L=r.s;break}}return t+s+":"+L+E});return" "+k+'="'+p+'"'});if(i==="img"&&!j.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))j+=' alt=""';return n+j+f});a=a.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(m,n,i,j){return n+(j?j:"&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,
  48. function(m,n,i,j){return n+i.replace(/<br\s*\/?>/ig,"\r\n")+j})};this.getSource=function(a){var b,c=o.beforeGetSource;if(H){b=d("#sourceCode",w).val();c||(b=e.formatXHTML(b,false))}else{b=e.processHTML(w.body.innerHTML,"read");b=e.cleanHTML(b);b=e.formatXHTML(b,a);if(c)b=c(b)}return B.value=b};this.cleanWord=function(a){var b=o.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,
  49. "");a=a.replace(/\r?\n/ig,"");a=a.replace(/(<(\/?)([\w-:]+))((?:\s+[\w-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(h,q,m,n,i,j){n=n.toLowerCase();if(n.match(/^(link|img)$/)&&i.match(/file:\/\//i)||n.match(/:/)||n==="span"&&b===2)return"";if(!m){i=i.replace(/\s([\w-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(f,g,l){g=g.toLowerCase();l=l.match(/^(["']?)(.*)\1/)[2];if(g.match(/:/))return"";else if(g.match(/^(class|lang|language|span)$/))return"";else if(n==="td"&&(g===
  50. "height"||g==="width"&&!i.match(/\scolspan="\d+"/i)))return"";else if(g==="style"){if(b===2)return"";return(l=d.trim(l.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,"")))?" "+g+'="'+l.replace(/"/g,"'")+'"':""}return f});if(n==="a"&&!i.match(/\s+href\s*=/))return""}return q+i+j});for(var c=0;c<3;c++)a=a.replace(/<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,"")}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,
  51. "");var b;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(c,h){b=h.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,"");o.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,""));o.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));if(!o.linkTag||!o.inlineScript||!o.inlineStyle)a=a.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,
  52. function(c,h,q,m,n){if(!o.linkTag&&q.toLowerCase()==="link")return"";o.inlineScript||(m=m.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,""));o.inlineStyle||(m=m.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,""));return h+m+n});return a=a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>|&nbsp;)*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,
  53. b){function c(v){var x={};v=v.split(",");for(var z=0;z<v.length;z++)x[v[z]]=true;return x}function h(v){v=v.toLowerCase();var x=u[v];return x?x:v}function q(v,x,z){if(k[v])for(;F.last()&&p[F.last()];)m(F.last());r[v]&&F.last()===v&&m(v);(z=l[v]||!!z)||F.push(v);var J=[];J.push("<"+v);x.replace(L,function(pb,ya,qb,rb,sb){ya=ya.toLowerCase();J.push(" "+ya+'="'+(qb?qb:rb?rb:sb?sb:t[ya]?ya:"").replace(/"/g,"'")+'"')});J.push((z?" /":"")+">");j(J.join(""),v,true);if(v==="pre")Ka=true}function m(v){if(v)for(x=
  54. F.length-1;x>=0;x--){if(F[x]===v)break}else var x=0;if(x>=0){for(var z=F.length-1;z>=x;z--)j("</"+F[z]+">",F[z]);F.length=x}if(v==="pre"){Ka=false;ha--}}function n(v){j(e.domEncode(v))}function i(v){C.push(v)}function j(v,x,z){Ka||(v=v.replace(/(\t*\r?\n\t*)+/g,""));if(!Ka&&b===true)if(v.match(/^\s*$/))C.push(v);else{var J=k[x],pb=J?x:"";if(J){z&&ha++;La===""&&ha--}else La&&ha++;if(pb!==La||J)f();C.push(v);x==="br"&&f();if(J&&(l[x]||!z))ha--;La=J?x:""}else C.push(v)}function f(){C.push("\r\n");if(ha>
  55. 0)for(var v=ha;v--;)C.push("\t")}function g(v,x,z,J){if(!z)return J;v="";if(x=z.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))v+="font-family:"+x[1]+";";if(x=z.match(/ size\s*=\s*"\s*(\d+)\s*"/i))v+="font-size:"+Z[(x[1]>7?7:x[1]<1?1:x[1])-1].s+";";if(x=z.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))v+="color:"+x[1]+";";if(z=z.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))v+=z[1];if(v)J='<span style="'+v+'">'+J+"</span>";return J}var l=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param"),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,script,table,tbody,td,tfoot,th,thead,tr,ul"),
  56. p=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"),u={b:"strong",i:"em",s:"del",strike:"del"},E=/<(?:\/([^\s>]+)|!--([^>]*?)--|([^\s\/>]+)((?:"[^"]*"|'[^']*'|[^"'>]+)*)\s*(\/?))>/g,
  57. L=/\s+([\w-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g,C=[],F=[];F.last=function(){return this[this.length-1]};for(var D,G,R=0,ia,za,ha=-1,La="body",Ka=false;D=E.exec(a);){G=D.index;if(G>R){R=a.substring(R,G);ia?za.push(R):n(R)}R=E.lastIndex;if(G=D[1]){G=h(G);if(ia&&G===ia){i(za.join(""));za=ia=null}if(!ia){m(G);continue}}if(ia)za.push(D[0]);else if(G=D[3]){G=h(G);q(G,D[4],D[5]);if(s[G]){ia=G;za=[]}}else D[2]&&C.push(D[0])}a.length>R&&n(a.substring(R,a.length));m();a=C.join("");C=null;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,
  58. g);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,g);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,g);return a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"")};this.toggleShowBlocktag=function(a){if(ua!==a){ua=!ua;a=d(w.body);if(ua){oa+=" showBlocktag";a.addClass("showBlocktag")}else{oa=oa.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(H!==a){K.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");
  59. var b=w.body,c=d(b),h,q;a=0;if(H){h=e.getSource();c.html("").removeAttr("scroll").attr("class","editMode"+oa);if(y)b.contentEditable="true";else w.designMode="On";if(Ba){e._exec("inserthtml","-");d("#"+Ia).show().focus().hide()}}else{e.pasteHTML('<span id="_xhe_cursor"></span>',true);h=e.getSource(true);a=h.indexOf('<span id="_xhe_cursor"></span>');if(!cb)a=h.substring(0,a).replace(/\r/g,"").length;h=h.replace('<span id="_xhe_cursor"></span>',"");if(y)b.contentEditable="false";else w.designMode="Off";
  60. c.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');q=d("#sourceCode",c).blur(e.getSource)[0]}H=!H;e.setSource(h);e.focus();if(H)if(q.setSelectionRange)q.setSelectionRange(a,a);else{q=q.createTextRange();q.move("character",a);q.select()}else e.setCursorFirst(true);K.find("[name=Source],[name=Preview]").toggleClass("xheEnabled");K.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");
  61. setTimeout(Ua,300)}};this.showPreview=function(){var a=o.beforeSetSource,b=e.getSource();if(a)b=a(b);a="<html><head>"+xa+"<title>Preview</title>"+(O?'<base href="'+O+'"/>':"")+"</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=
  62. function(a){if(sa!==a){a=d("#"+wa).find(".xheLayout");var b=d("#"+wa),c=jQuery.browser.version;c=y&&(c==6||c==7);if(sa){c&&P.after(b);a.attr("style",jb);N.height(T-K.outerHeight());d(window).scrollTop(Ya);setTimeout(function(){d(window).scrollTop(Ya)},10)}else{c&&d("body").append(b);Ya=d(window).scrollTop();jb=a.attr("style");a.removeAttr("style");N.height("100%");setTimeout(Wa,100)}if(Ba){d("#"+Ia).show().focus().hide();setTimeout(e.focus,1)}else c&&e.setCursorFirst();sa=!sa;b.toggleClass("xhe_Fullscreen");
  63. d("html").toggleClass("xhe_Fullfix");K.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Ua,300)}};this.showMenu=function(a,b){var c=d('<div class="xheMenu"></div>'),h=[];d.each(a,function(q,m){h.push('<a href="javascript:void(0);" title="'+(m.t?m.t:m.s)+'" v="'+m.v+'">'+m.s+"</a>")});c.append(h.join(""));c.click(function(q){b(d(q.target).closest("a").attr("v"));e.hidePanel();return false}).mousedown(V);e.showPanel(c)};this.showColor=function(a){var b=d('<div class="xheColor"></div>'),
  64. c=[],h=0;d.each(ub,function(q,m){if(h%7===0)c.push((h>0?"</div>":"")+"<div>");c.push('<a href="javascript:void(0);" xhev="'+m+'" title="'+m+'" style="background:'+m+'"></a>');h++});c.push("</div>");b.append(c.join(""));b.click(function(q){q=q.target;if(d.nodeName(q,"A")){a(d(q).attr("xhev"));e.hidePanel();return false}}).mousedown(V);e.showPanel(b)};this.showPastetext=function(){var a=d('<div>Use Ctrl+V on your keyboard to paste the text.</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="OK" /></div>'),
  65. b=d("#xhePastetextValue",a);d("#xheSave",a).click(function(){e.loadBookmark();var c=b.val();c&&e.pasteText(c);e.hidePanel();return false});e.showDialog(a)};this.showLink=function(){var a=d('<div>Link URL: <input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div>Target:&nbsp;&nbsp; <select id="xheLinkTarget"><option selected="selected" value="">Default</option><option value="_blank">New window</option><option value="_self">Same window</option><option value="_parent">Parent window</option></select></div><div style="display:none">Link Text:<input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
  66. b=e.getParent("a"),c=d("#xheLinkText",a),h=d("#xheLinkUrl",a),q=d("#xheLinkTarget",a),m=d("#xheSave",a),n=e.getSelect();if(b.length===1){h.val(ba(b,"href"));q.attr("value",b.attr("target"))}else n===""&&c.val(o.defLinkText).closest("div").show();o.upLinkUrl&&e.uploadInit(h,o.upLinkUrl,o.upLinkExt);m.click(function(){e.loadBookmark();var i=h.val();if(i===""||b.length===0)e._exec("unlink");if(i!==""&&i!=="http://"){var j=i.split(" "),f=q.val(),g=c.val();if(j.length>1){e._exec("unlink");n=e.getSelect();
  67. var l='<a href="xhe_tmpurl"',k=[];if(f!=="")l+=' target="'+f+'"';l+=">xhe_tmptext</a>";g=n!==""?n:g?g:i;for(var p in j){i=j[p];if(i!==""){i=i.split("||");f=l;f=f.replace("xhe_tmpurl",i[0]);f=f.replace("xhe_tmptext",i[1]?i[1]:g);k.push(f)}}e.pasteHTML(k.join("&nbsp;"))}else{i=j[0].split("||");g||(g=i[0]);g=i[1]?i[1]:n!==""?"":g?g:i[0];if(b.length===0){g?e.pasteHTML('<a href="#xhe_tmpurl">'+g+"</a>"):e._exec("createlink","#xhe_tmpurl");b=d('a[href$="#xhe_tmpurl"]',w)}else g&&!X&&b.text(g);ba(b,"href",
  68. i[0]);f!==""?b.attr("target",f):b.removeAttr("target")}}e.hidePanel();return false});e.showDialog(a)};this.showImg=function(){var a=d('<div>Img URL:&nbsp; <input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div>Alt text: <input type="text" id="xheImgAlt" /></div><div>Alignment:<select id="xheImgAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="right">Right</option><option value="top">Top</option><option value="middle">Middle</option><option value="baseline">Baseline</option><option value="bottom">Bottom</option></select></div><div>Dimension:<input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>Border:&nbsp;&nbsp;&nbsp;<input type="text" id="xheImgBorder" style="width:40px;" /></div><div>Hspace:&nbsp;&nbsp;&nbsp;<input type="text" id="xheImgHspace" style="width:40px;" /> Vspace:<input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
  69. b=e.getParent("img"),c=d("#xheImgUrl",a),h=d("#xheImgAlt",a),q=d("#xheImgAlign",a),m=d("#xheImgWidth",a),n=d("#xheImgHeight",a),i=d("#xheImgBorder",a),j=d("#xheImgVspace",a),f=d("#xheImgHspace",a),g=d("#xheSave",a);if(b.length===1){c.val(ba(b,"src"));h.val(b.attr("alt"));q.val(b.attr("align"));m.val(b.attr("width"));n.val(b.attr("height"));i.val(b.attr("border"));var l=b.attr("vspace"),k=b.attr("hspace");j.val(l<=0?"":l);f.val(k<=0?"":k)}o.upImgUrl&&e.uploadInit(c,o.upImgUrl,o.upImgExt);g.click(function(){e.loadBookmark();
  70. var p=c.val();if(p!==""&&p!=="http://"){var r=p.split(" "),t=h.val(),s=q.val(),u=m.val(),E=n.val(),L=i.val(),C=j.val(),F=f.val();if(r.length>1){var D='<img src="xhe_tmpurl"',G=[];if(t!=="")D+=' alt="'+t+'"';if(s!=="")D+=' align="'+s+'"';if(u!=="")D+=' width="'+u+'"';if(E!=="")D+=' height="'+E+'"';if(L!=="")D+=' border="'+L+'"';if(C!=="")D+=' vspace="'+C+'"';if(F!=="")D+=' hspace="'+F+'"';D+=" />";for(var R in r){p=r[R];if(p!==""){p=p.split("||");t=D;t=t.replace("xhe_tmpurl",p[0]);if(p[1])t='<a href="'+
  71. p[1]+'" target="_blank">'+t+"</a>";G.push(t)}}e.pasteHTML(G.join("&nbsp;"))}else if(r.length===1){p=r[0];if(p!==""){p=p.split("||");if(b.length===0){e.pasteHTML('<img src="'+p[0]+'#xhe_tmpurl" />');b=d('img[src$="#xhe_tmpurl"]',w)}ba(b,"src",p[0]);t!==""&&b.attr("alt",t);s!==""?b.attr("align",s):b.removeAttr("align");u!==""?b.attr("width",u):b.removeAttr("width");E!==""?b.attr("height",E):b.removeAttr("height");L!==""?b.attr("border",L):b.removeAttr("border");C!==""?b.attr("vspace",C):b.removeAttr("vspace");
  72. F!==""?b.attr("hspace",F):b.removeAttr("hspace");if(p[1]){r=b.parent("a");if(r.length===0){b.wrap("<a></a>");r=b.parent("a")}ba(r,"href",p[1]);r.attr("target","_blank")}}}}else b.length===1&&b.remove();e.hidePanel();return false});e.showDialog(a)};this.showEmbed=function(a,b,c,h,q,m,n){b=d(b);var i=e.getParent('embed[type="'+c+'"],embed[classid="'+h+'"]'),j=d("#xhe"+a+"Url",b),f=d("#xhe"+a+"Width",b),g=d("#xhe"+a+"Height",b);a=d("#xheSave",b);m&&e.uploadInit(j,m,n);e.showDialog(b);if(i.length===1){j.val(ba(i,
  73. "src"));f.val(i.attr("width"));g.val(i.attr("height"))}a.click(function(){e.loadBookmark();var l=j.val();if(l!==""&&l!=="http://"){var k=f.val(),p=g.val(),r=/^\d+%?$/;r.test(k)||(k=412);r.test(p)||(p=300);var t='<embed type="'+c+'" classid="'+h+'" src="xhe_tmpurl"'+q;r=l.split(" ");if(r.length>1){t=t+"";var s,u=[];t+=' width="xhe_width" height="xhe_height" />';for(var E in r){l=r[E].split("||");s=t;s=s.replace("xhe_tmpurl",l[0]);s=s.replace("xhe_width",l[1]?l[1]:k);s=s.replace("xhe_height",l[2]?l[2]:
  74. p);l!==""&&u.push(s)}e.pasteHTML(u.join("&nbsp;"))}else if(r.length===1){l=r[0].split("||");if(i.length===0){e.pasteHTML(t.replace("xhe_tmpurl",l[0]+"#xhe_tmpurl")+" />");i=d('embed[src$="#xhe_tmpurl"]',w)}ba(i,"src",l[0]);i.attr("width",l[1]?l[1]:k);i.attr("height",l[2]?l[2]:p)}}else i.length===1&&i.remove();e.hidePanel();return false})};this.showEmot=function(a){var b=d('<div class="xheEmot"></div>');a=a?a:bb?bb:"default";var c=Ja[a],h=ga+a+"/",q=0,m=[],n="";n=c.width;var i=c.height,j=c.line,f=
  75. c.count;c=c.list;if(f)for(c=1;c<=f;c++){q++;m.push('<a href="javascript:void(0);" style="background-image:url('+h+c+'.gif);" emot="'+a+","+c+'" xhev="">&nbsp;</a>');q%j===0&&m.push("<br />")}else d.each(c,function(k,p){q++;m.push('<a href="javascript:void(0);" style="background-image:url('+h+k+'.gif);" emot="'+a+","+k+'" title="'+p+'" xhev="'+p+'">&nbsp;</a>');q%j===0&&m.push("<br />")});f=j*(n+12);c=f*0.75;if(Math.ceil(q/j)*(i+12)<=c)c="";n=d("<style>"+(c?".xheEmot div{width:"+(f+20)+"px;height:"+
  76. c+"px;}":"")+".xheEmot div a{width:"+n+"px;height:"+i+"px;}</style><div>"+m.join("")+"</div>").click(function(k){k=k.target;var p=d(k);if(d.nodeName(k,"A")){e.pasteHTML('<img emot="'+p.attr("emot")+'" alt="'+p.attr("xhev")+'">');e.hidePanel();return false}}).mousedown(V);b.append(n);var g=0,l=["<ul>"];d.each(Ja,function(k,p){g++;l.push("<li"+(a===k?' class="cur"':"")+'><a href="javascript:void(0);" group="'+k+'">'+p.name+"</a></li>")});if(g>1){l.push('</ul><br style="clear:both;" />');n=d(l.join("")).click(function(k){bb=
  77. d(k.target).attr("group");e.exec("Emot");return false}).mousedown(V);b.append(n)}e.showPanel(b)};this.showTable=function(){var a=d('<div>Rows&Cols:&nbsp;&nbsp;<input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>Headers:&nbsp;&nbsp;&nbsp;&nbsp;<select id="xheTableHeaders"><option selected="selected" value="">None</option><option value="row">First row</option><option value="col">First column</option><option value="both">Both</option></select></div><div>Dimension:&nbsp;&nbsp;<input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>Border:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>CellSpacing:<input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> CellPadding:<input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>Align:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select id="xheTableAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="center">Center</option><option value="right">Right</option></select></div><div>Caption:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
  78. b=d("#xheTableRows",a),c=d("#xheTableColumns",a),h=d("#xheTableHeaders",a),q=d("#xheTableWidth",a),m=d("#xheTableHeight",a),n=d("#xheTableBorder",a),i=d("#xheTableCellSpacing",a),j=d("#xheTableCellPadding",a),f=d("#xheTableAlign",a),g=d("#xheTableCaption",a);d("#xheSave",a).click(function(){e.loadBookmark();var l=g.val(),k=n.val(),p=b.val(),r=c.val(),t=h.val(),s=q.val(),u=m.val(),E=i.val(),L=j.val(),C=f.val();k="<table"+(k!==""?' border="'+k+'"':"")+(s!==""?' width="'+s+'"':"")+(u!==""?' width="'+
  79. u+'"':"")+(E!==""?' cellspacing="'+E+'"':"")+(L!==""?' cellpadding="'+L+'"':"")+(C!==""?' align="'+C+'"':"")+">";if(l!=="")k+="<caption>"+l+"</caption>";if(t==="row"||t==="both"){k+="<tr>";for(l=0;l<r;l++)k+='<th scope="col"></th>';k+="</tr>";p--}k+="<tbody>";for(l=0;l<p;l++){k+="<tr>";for(s=0;s<r;s++)k+=s===0&&(t==="col"||t==="both")?'<th scope="row"></th>':"<td></td>";k+="</tr>"}k+="</tbody></table>";e.pasteHTML(k);e.hidePanel();return false});e.showDialog(a)};this.showAbout=function(){var a=d('<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.7 (build 110601)</p><p>xhEditor is a platform independent WYSWYG XHTML editor based by jQuery,released as Open Source under <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>.</p><p>Copyright &copy; <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
  80. e.showDialog(a)};this.addShortcuts=function(a,b){a=a.toLowerCase();if(ta[a]===W)ta[a]=[];ta[a].push(b)};this.delShortcuts=function(a){delete ta[a]};this.uploadInit=function(a,b,c){function h(f){if(da(f,"string"))f=[f];var g=false,l,k=f.length,p,r=[];(l=o.onUpload)&&l(f);for(l=0;l<k;l++){p=f[l];p=da(p,"string")?p:p.url;if(p.substr(0,1)==="!"){g=true;p=p.substr(1)}r.push(p)}a.val(r.join(" "));g&&a.closest(".xheDialog").find("#xheSave").click()}var q=d('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+
  81. o.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),m=d(".xheBtn",q),n=o.html5Upload,i=n?o.upMultiple:1;a.after(q);m.before(a);b=b.replace(/{editorRoot}/ig,U);if(b.substr(0,1)==="!")m.click(function(){S=false;e.showIframeModal("Upload file",b.substr(1),h,null,null,function(){S=true})});else{q.append('<input type="file"'+(i>1?' multiple=""':"")+' class="xheFile" size="13" name="filedata" tabindex="-1" />');var j=d(".xheFile",q);j.change(function(){e.startUpload(j[0],b,c,h)});setTimeout(function(){a.closest(".xheDialog").bind("dragenter dragover",
  82. V).bind("drop",function(f){f=f.originalEvent.dataTransfer;var g;if(n&&f&&(g=f.files)&&g.length>0)e.startUpload(g,b,c,h);return false})},10)}};this.startUpload=function(a,b,c,h){function q(r,t){var s=Object,u=false;try{s=eval("("+r+")")}catch(E){}if(s.err===W||s.msg===W)alert(b+" upload interface error!\r\n\r\nreturn error:\r\n\r\n"+r);else if(s.err)alert(s.err);else{m.push(s.msg);u=true}if(!u||t)e.removeModal();t&&u&&h(m);return u}var m=[],n=o.html5Upload,i=n?o.upMultiple:1,j,f,g=d('<div style="padding:22px 0;text-align:center;line-height:30px;">File uploading,please wait...<br /></div>'),
  83. l='<img src="'+ab+'img/loading.gif">';if(!n||a.nodeType&&!((f=a.files)&&f[0])){if(!gb(a.value,c))return;g.append(l);j=new e.html4Upload(a,b,q)}else{f||(f=a);a=f.length;if(a>i){alert("Please do not upload more then "+i+" files.");return}for(i=0;i<a;i++)if(!gb(f[i].fileName,c))return;var k=d('<div class="xheProgress"><div><span>0%</span></div></div>');g.append(k);j=new e.html5Upload("filedata",f,b,q,function(r){if(r.loaded>=0){var t=Math.round(r.loaded*100/r.total)+"%";d("div",k).css("width",t);d("span",
  84. k).text(t+" ( "+hb(r.loaded)+" / "+hb(r.total)+" )")}else k.replaceWith(l)})}var p=S;if(p)S=false;e.showModal("File uploading(Esc cancel)",g,320,150,function(){S=p;j.remove()});j.start()};this.html4Upload=function(a,b,c){var h="jUploadFrame"+(new Date).getTime(),q=this,m=d('<iframe name="'+h+'" class="xheHideArea" />').appendTo("body"),n=d('<form action="'+b+'" target="'+h+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),i=d(a),j=i.clone().attr("disabled",
  85. "true");i.before(j).appendTo(n);this.remove=function(){if(q!==null){j.before(i).remove();m.remove();n.remove();q=null}};this.onLoad=function(){var f=m[0].contentWindow.document,g=d(f.body).text();f.write("");c(g,true)};this.start=function(){n.submit();m.load(q.onLoad)};return this};this.html5Upload=function(a,b,c,h,q){function m(r,t,s,u){i=new XMLHttpRequest;upload=i.upload;i.onreadystatechange=function(){i.readyState===4&&s(i.responseText)};if(upload)upload.onprogress=function(E){u(E.loaded)};else u(-1);
  86. i.open("POST",t);i.setRequestHeader("Content-Type","application/octet-stream");i.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+r.fileName+'"');i.sendAsBinary?i.sendAsBinary(r.getAsBinary()):i.send(r)}function n(r){q&&q({loaded:g+r,total:l})}for(var i,j=0,f=b.length,g=0,l=0,k=this,p=0;p<f;p++)l+=b[p].fileSize;this.remove=function(){if(i){i.abort();i=null}};this.uploadNext=function(r){if(r){g+=b[j-1].fileSize;n(0)}if((!r||r&&h(r,j===f)===true)&&j<f)m(b[j++],c,k.uploadNext,
  87. function(t){n(t)})};this.start=function(){k.uploadNext()}};this.showIframeModal=function(a,b,c,h,q,m){function n(){try{g.callback=i;g.unloadme=e.removeModal;d(g.document).keydown(Ma);if((l=g.name)===W)k=true}catch(p){k=true}}function i(p){g.document.write("");e.removeModal();p!=null&&c(p)}b=d('<iframe frameborder="0" src="'+b.replace(/{editorRoot}/ig,U)+(/\?/.test(b)?"&":"?")+"editorhost="+location.hostname+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');var j=
  88. d(b[0]),f=d(b[1]);e.showModal(a,b,h,q,m);var g=j[0].contentWindow,l,k=false;n();j.load(function(){n();if(k&&l){l=eval("("+unescape(l)+")");return i(l)}if(f.is(":visible")){j.show();f.remove()}})};this.showModal=function(a,b,c,h,q){if(Da)return false;la=o.layerShadow;c=c?c:o.modalWidth;h=h?h:o.modalHeight;Y=d('<div class="xheModal" style="width:'+(c-1)+"px;height:"+h+"px;margin-left:-"+Math.ceil(c/2)+"px;"+(y&&Aa<=7?"":"margin-top:-"+Math.ceil(h/2)+"px")+'">'+(o.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="Close (Esc)"></span>'+
  89. a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");Oa=d('<div class="xheModalOverlay"></div>').appendTo("body");if(la>0)Na=d('<div class="xheModalShadow" style="width:'+Y.outerWidth()+"px;height:"+Y.outerHeight()+"px;margin-left:-"+(Math.ceil(c/2)-la-2)+"px;"+(y&&Aa<=7?"":"margin-top:-"+(Math.ceil(h/2)-la-2)+"px")+'"></div>').appendTo("body");d(".xheModalContent",Y).css("height",h-(o.modalTitle?d(".xheModalTitle").outerHeight():0)).html(b);if(y&&Aa===6)Pa=d("select:visible").css("visibility",
  90. "hidden");d(".xheModalClose",Y).click(e.removeModal);Oa.show();la>0&&Na.show();Y.show();Da=true;Qa=q};this.removeModal=function(){Pa&&Pa.css("visibility","visible");Y.html("").remove();la>0&&Na.remove();Oa.remove();Qa&&Qa();Da=false};this.showDialog=function(a){var b=d('<div class="xheDialog"></div>');a=d(a);var c=d("#xheSave",a);if(c.length===1){a.find("input[type=text],select").keypress(function(m){if(m.which===13){c.click();return false}});a.find("textarea").keydown(function(m){if(m.ctrlKey&&m.which===
  91. 13){c.click();return false}});c.after(' <input type="button" id="xheCancel" value="Cancel" />');d("#xheCancel",a).click(e.hidePanel);if(!o.clickCancelDialog){Ca=false;var h=d('<div class="xheFixCancel"></div>').appendTo("body").mousedown(V),q=N.offset();h.css({left:q.left,top:q.top,width:N.outerWidth(),height:N.outerHeight()})}b.mousedown(function(){va=true})}b.append(a);e.showPanel(b);y||setTimeout(function(){b.find("input[type=text],textarea").filter(":visible").filter(function(){return d(this).css("visibility")!==
  92. "hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!Q.target)return false;M.html("").append(a).css("left",-999).css("top",-999);ka=d(Q.target).closest("a").addClass("xheActive");var b=ka.offset();a=b.left;b=b.top;b+=ka.outerHeight()-1;qa.css({left:a+1,top:b,width:ka.width()}).show();var c=document.documentElement,h=document.body;if(a+M.outerWidth()>(window.pageXOffset||c.scrollLeft||h.scrollLeft)+(c.clientWidth||h.clientWidth))a-=M.outerWidth()-ka.outerWidth();c=o.layerShadow;c>0&&pa.css({left:a+
  93. c,top:b+c,width:M.outerWidth(),height:M.outerHeight()}).show();M.css({left:a,top:b}).show();$a=S=true};this.hidePanel=function(){if(S){ka.removeClass("xheActive");pa.hide();qa.hide();M.hide();S=false;if(!Ca){d(".xheFixCancel").remove();Ca=true}$a=va=false;fa=null}};this.exec=function(a){e.focus();e.hidePanel();e.saveBookmark();var b=ra[a];if(!b)return false;if(Q===null){Q={};var c=K.find(".xheButton[name="+a+"]");if(c.length===1)Q.target=c}if(b.e)b.e.call(e);else{a=a.toLowerCase();switch(a){case "cut":try{w.execCommand(a);
  94. if(!w.queryCommandSupported(a))throw"Error";}catch(h){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+X) instead.")}break;case "copy":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(q){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+C) instead.")}break;case "paste":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(m){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+V) instead.")}break;
  95. case "pastetext":window.clipboardData?e.pasteText(window.clipboardData.getData("Text",true)):e.showPastetext();break;case "blocktag":var n=[];d.each(vb,function(f,g){n.push({s:"<"+g.n+">"+g.t+"</"+g.n+">",v:"<"+g.n+">",t:g.t})});e.showMenu(n,function(f){e._exec("formatblock",f)});break;case "fontface":var i=[];d.each(wb,function(f,g){g.c=g.c?g.c:g.n;i.push({s:'<span style="font-family:'+g.c+'">'+g.n+"</span>",v:g.c,t:g.n})});e.showMenu(i,function(f){e._exec("fontname",f)});break;case "fontsize":var j=
  96. [];d.each(Z,function(f,g){j.push({s:'<span style="font-size:'+g.s+';">'+g.t+"("+g.s+")</span>",v:f+1,t:g.t})});e.showMenu(j,function(f){e._exec("fontsize",f)});break;case "fontcolor":e.showColor(function(f){e._exec("forecolor",f)});break;case "backcolor":e.showColor(function(f){if(y)e._exec("backcolor",f);else{Ta(true);e._exec("hilitecolor",f);Ta(false)}});break;case "align":e.showMenu(xb,function(f){e._exec(f)});break;case "list":e.showMenu(yb,function(f){e._exec(f)});break;case "link":e.showLink();
  97. break;case "img":e.showImg();break;case "flash":e.showEmbed("Flash",'<div>Flash URL:<input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div>Dimension:<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="OK" /></div>',"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',
  98. o.upFlashUrl,o.upFlashExt);break;case "media":e.showEmbed("Media",'<div>Media URL:<input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div>Dimension:<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="OK" /></div>',"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',
  99. o.upMediaUrl,o.upMediaExt);break;case "emot":e.showEmot();break;case "table":e.showTable();break;case "source":e.toggleSource();break;case "preview":e.showPreview();break;case "print":ea.print();break;case "fullscreen":e.toggleFullscreen();break;case "about":e.showAbout();break;default:e._exec(a)}}Q=null};this._exec=function(a,b,c){c||e.focus();return b!==W?w.execCommand(a,false,b):w.execCommand(a,false,null)}};d(function(){d.fn.oldVal=d.fn.val;d.fn.val=function(B){var A=this,I;if(B===W)return A[0]&&
  100. (I=A[0].xheditor)?I.getSource():A.oldVal();return A.each(function(){(I=this.xheditor)?I.setSource(B):A.oldVal(B)})};d("textarea").each(function(){var B=d(this),A=B.attr("class");if(A&&(A=A.match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i)))B.xheditor(A[1]?{tools:A[1]}:null)})})})(jQuery);