From fae4caa53d2d65e2d1bcef8f76fe67bb1b9a8e27 Mon Sep 17 00:00:00 2001
From: "woltlab.com" @@@wcf_empty_line@@@ <\/p>/g,"");m=m.replace(/ "+r+" "+r+" ");a=a.replace(/<\/(div|p)><\/(div|p)>/g," ");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:a});return a},_pasteCallback:function(a){a=a.replace(/ ');a=a.replace(/\[\/size\]/g," /,"").replace(/<\/p>$/,""));b=b.replace(/^ /,"").replace(/<\/p>$/,"");b=b.replace(/ "+this.opts.invisibleSpace+"
]+)?><\/p>/g,"[\s\S]+?<\/pre>/g,function(y){var x=WCF.getUUID();l[x]=y;return"@@@"+x+"@@@"});m=m.replace(/\r?\n/g,"");if($.getLength(l)){$.each(l,function(x,y){m=m.replace("@@@"+x+"@@@",y)})}m=m.replace(/]*?><\/a>/g,"");m=m.replace(/
<\/p>/g,"
$/,"");m=m.replace(/
/g,"\n");m=m.replace(/
/g,"");m=m.replace(/ /gi," ");m=m.replace(/]+)>\n?
";return P})};for(var a=x.length-1;a>=0;a--){var t=x[a];var v=new RegExp("@@"+t.hashCode+"@@","g");E=E.replace(v,p(t.content))}}if(s.length){for(var a=s.length-1;a>=0;a--){var w=s[a];var v=new RegExp("@@"+w.key+"@@","g");var h=w.value;h=h.replace(/^\[code[^\]]*\][\S\s]*\[\/code\]$/,"/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/
/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/
]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/([\s\S]*?)<\/tbody>/,function(x,y){return $.trim(y)});m=m.replace(/
"});E=E.replace(/\[tr\]\n*/gi,"<\/tr>/gi,"");m=m.replace(/ /gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/ ([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)* (\t)*/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var u={};m.replace(/<\/span>/,function(x){var y=x.hashCode();u[y]=x.replace(/\$/g,"$$$$");return"@@"+y+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:m});m=m.replace(/<[^(<|>)]+>/g,"");if($.getLength(u)){for(var j in u){var r=new RegExp("@@"+j+"@@","g");data=data.replace(r,u[j])}}m=m.replace(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");m=m.replace(/\[\/code\]\n\n?/g,"[/code]\n\n");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:m});m=$.trim(m);if(m.length){m+="\n"}return m},convertToHtml:function(E){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:E});E=this.wutil.removeZeroWidthSpace(E);E=E.replace(/&/g,"&");E=E.replace(//g,">");var s=[];var n=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");E=E.replace(n,function(F){var G=F.hashCode();s.push({key:G,value:F.replace(/\$/g,"$$$$")});return"@@"+G+"@@"});E=E.replace(/\[url\]([^"]+?)\[\/url]/gi,'$1'+this.opts.invisibleSpace);E=E.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'$2'+this.opts.invisibleSpace);E=E.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'$2'+this.opts.invisibleSpace);E=E.replace(/\[email\]([^"]+?)\[\/email]/gi,'$1'+this.opts.invisibleSpace);E=E.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'$2'+this.opts.invisibleSpace);E=E.replace(/\[b\]([\s\S]*?)\[\/b]/gi,"$1");E=E.replace(/\[i\]([\s\S]*?)\[\/i]/gi,"$1");E=E.replace(/\[u\]([\s\S]*?)\[\/u]/gi,"$1");E=E.replace(/\[s\]([\s\S]*?)\[\/s]/gi," $1");E=E.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,"$1");E=E.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,"$1");E=E.replace(/\[img\]([^"]+?)\[\/img\]/gi,'');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,'');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,'');E=E.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'');E=E.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,'$2');E=E.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,'$2');E=E.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,'$2');E=E.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'");E=E.replace(/\[list=1\]/gi,'
');E=E.replace(/\[list=a\]/gi,'
');E=E.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'
');E=E.replace(/\[\/list]\n?/gi,"
\n");E=E.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(F,G){return"[table]"+$.trim(G)+"[/table]"});E=E.replace(/\[table\]\n*/gi,'');E=E.replace(/\[\/table\](\n*)?/gi,function(F,G){if(G){if(G.match(/\n/g).length>2){G=G.replace(/^\n/,"")}return"
"+G}return"");E=E.replace(/\[\/tr\]\n*/gi," ");E=E.replace(/\[td\]\n*/gi,"");E=E.replace(/\[\/td\]\n*/gi," ");E=E.replace(/([\S\s]*?)<\/td>/gi,function(F,H){var G=$.trim(H);if(!G.length){G=""}return" "+G+" "});var c=this.wutil.getOption("woltlab.attachmentUrl");var D=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(c){var B=this.wbbcode._getImageAttachments();E=E.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(F,G,H){G=parseInt(G);if(B[G]!==undefined){return''}return F});E=E.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(G,H,I){H=parseInt(H);if(B[H]!==undefined){var F="";if(I==="left"||I==="right"){F="float: "+I+";"}F=' style="'+F+'"';return'"}return G});E=E.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(G,I,J,H){I=parseInt(I);if(B[I]!==undefined){var F="width: "+H+"px; max-height: "+B[I].height+"px; max-width: "+B[I].width+"px;";if(J==="left"||J==="right"){F+="float: "+J+";"}F=' style="'+F+'"';return'"}return G})}for(var u in __REDACTOR_SMILIES){var j=u.replace(//g,">");var i=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(j)+"(?=\\s|<|$)","gi");E=E.replace(i,'$1')}E=E.replace(/(javascript):/gi,"$1:");E=E.replace(/(\r|\r\n)/g,"\n");var x=[];var A=[];var g=E.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/);var d=WCF.getUUID();while(true){var o=false;for(var a=0;a
"}}else{E+="
"}else{if(r.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,A)){E+=r;continue}}}E+="'+q.wbbcode._buildQuoteHeader(O,J)+'
$&
");E=E.replace(v,h)}}E=E.replace(/<\/p>/g,"
");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:E});return E},_pasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/
<\/(div|p)>/g,"
]*>(
]*>)+/g,"$1");a=a.replace(/\[size=(\d+)\]/g,' div > div");if(j.length==1){if(j[0].innerHTML===""){j[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var i=l.find("> div > br[type=_moz]");if(i.length){$("