// table.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'<section id="redactor-modal-table-insert"><label>'+this.lang.get("rows")+'</label><input type="text" size="5" value="2" id="redactor-table-rows" /><label>'+this.lang.get("columns")+'</label><input type="text" size="5" value="3" id="redactor-table-columns" /></section>'},init:function(){var b={};b.insert_table={title:this.lang.get("insert_table"),func:this.table.show};b.insert_row_above={title:this.lang.get("insert_row_above"),func:this.table.addRowAbove};b.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow};b.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft};b.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight};b.add_head={title:this.lang.get("add_head"),func:this.table.addHead};b.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead};b.delete_column={title:this.lang.get("delete_column"),func:this.table.deleteColumn};b.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow};b.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable};this.observe.addButton("td","table");this.observe.addButton("th","table");var a=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(a,b)},show:function(){this.modal.addTemplate("table",this.table.getTemplate());this.modal.load("table",this.lang.get("insert_table"),300);this.modal.createCancelButton();var a=this.modal.createActionButton(this.lang.get("insert"));a.on("click",this.table.insert);this.selection.save();this.modal.show();$("#redactor-table-rows").focus()},insert:function(){var n=$("#redactor-table-rows").val(),c=$("#redactor-table-columns").val(),a=$("<div>"),b=Math.floor(Math.random()*99999),l=$('<table id="table'+b+'"><tbody></tbody></table>'),e,h,j,k;for(e=0;e<n;e++){h=$("<tr>");for(j=0;j<c;j++){k=$("<td>"+this.opts.invisibleSpace+"</td>");if(e===0&&j===0){k.append(this.selection.getMarker())}$(h).append(k)}l.append(h)}a.append(l);var f=a.html();this.modal.close();this.selection.restore();if(this.table.getTable()){return}this.buffer.set();var g=this.selection.getBlock()||this.selection.getCurrent();if(g&&g.tagName!="BODY"){if(g.tagName=="LI"){g=$(g).closest("ul, ol")}$(g).after(f)}else{this.insert.html(f)}this.selection.restore();var m=this.$editor.find("#table"+b);if(!this.opts.linebreaks&&(this.utils.browser("mozilla")||this.utils.browser("msie"))){var d=m.next();if(d.length===0){m.after(this.opts.emptyHtml)}}this.observe.buttons();m.find("span.redactor-selection-marker").remove();m.removeAttr("id");this.code.sync();this.core.setCallback("insertedTable",m)},getTable:function(){var a=$(this.selection.getParent()).closest("table");if(!this.utils.isRedactorParent(a)){return false}if(a.size()===0){return false}return a},restoreAfterDelete:function(a){this.selection.restore();a.find("span.redactor-selection-marker").remove();this.code.sync()},deleteTable:function(){var b=this.table.getTable();if(!b){return}this.buffer.set();var a=b.next();if(!this.opts.linebreaks&&a.length!==0){this.caret.setStart(a)}else{this.caret.setAfter(b)}b.remove();this.code.sync()},deleteRow:function(){var a=this.table.getTable();if(!a){return}var c=$(this.selection.getCurrent());this.buffer.set();var e=c.closest("tr");var b=e.prev().length?e.prev():e.next();if(b.length){var d=b.children("td, th").first();if(d.length){d.prepend(this.selection.getMarker())}}e.remove();this.table.restoreAfterDelete(a)},deleteColumn:function(){var c=this.table.getTable();if(!c){return}this.buffer.set();var d=$(this.selection.getCurrent());var a=d.closest("td, th");var b=a[0].cellIndex;c.find("tr").each($.proxy(function(f,g){var e=$(g);var h=b-1<0?b+1:b-1;if(f===0){e.find("td, th").eq(h).prepend(this.selection.getMarker())}e.find("td, th").eq(b).remove()},this));this.table.restoreAfterDelete(c)},addHead:function(){var a=this.table.getTable();if(!a){return}this.buffer.set();if(a.find("thead").size()!==0){this.table.deleteHead();return}var b=a.find("tr").first().clone();b.find("td").html(this.opts.invisibleSpace);$thead=$("<thead></thead>").append(b);a.prepend($thead);this.code.sync()},deleteHead:function(){var a=this.table.getTable();if(!a){return}var b=a.find("thead");if(b.size()===0){return}this.buffer.set();b.remove();this.code.sync()},addRowAbove:function(){this.table.addRow("before")},addRowBelow:function(){this.table.addRow("after")},addColumnLeft:function(){this.table.addColumn("before")},addColumnRight:function(){this.table.addColumn("after")},addRow:function(c){var a=this.table.getTable();if(!a){return}this.buffer.set();var b=$(this.selection.getCurrent());var d=b.closest("tr");var e=d.clone();e.find("th").replaceWith(function(){var f=$("<td>");f[0].attributes=this.attributes;return f.append($(this).contents())});e.find("td").html(this.opts.invisibleSpace);if(c=="after"){d.after(e)}else{d.before(e)}this.code.sync()},addColumn:function(d){var c=this.table.getTable();if(!c){return}var b=0;var e=$(this.selection.getCurrent());this.buffer.set();var f=e.closest("tr");var a=e.closest("td, th");f.find("td, th").each($.proxy(function(g,h){if($(h)[0]===a[0]){b=g}},this));c.find("tr").each($.proxy(function(g,j){var h=$(j).find("td, th").eq(b);var k=h.clone();k.html(this.opts.invisibleSpace);if(d=="after"){h.after(k)}else{h.before(k)}},this));this.code.sync()}}};
// wbbcode.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){return{init:function(){var d=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){if($.browser.msie){this.$editor.addClass("msie")}var h=$.trim(this.wutil.getOption("woltlab.originalValue"));if(h.length){this.wutil.replaceText(h);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var c=this.clean.onSync;this.clean.onSync=function(h){h=h.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return c.call(self,h)};if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var b=this.button.get("table");if(b.length){var g=b.data("dropdown");g.find(".redactor-dropdown-add_head").parent().remove();g.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(g.find(".redactor-dropdown-delete_table").parent());b.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+d,$.proxy(function(h){h.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_code_"+d,$.proxy(function(h){h.cancel=true;this.wbbcode._handleInsertCode(null,true)},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+d,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+d,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var e=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var f=function(h){h.find("br").each(function(i,j){if(j.children.length){$(j).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");e.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode.fixBlockLevelElements();this.wutil.selectionEndOfEditor();this.wbbcode.observeQuotes();this.wbbcode.observeCodeListings();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");e.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wutil.fixDOM();f(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(h){this.wutil.saveSelection();if(h.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var a=this.opts.verifiedTags.indexOf("ul");if(a>-1){this.opts.verifiedTags.splice(a,1)}WCF.System.Event.addListener("com.woltlab.wcf.redactor","observe_load_"+d,(function(h){this.wbbcode.observeCodeListings();this.wbbcode.observeQuotes()}).bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","fixFormatting_"+d,$.proxy(this.wbbcode.fixFormatting,this))},_tableButtonClick:function(b){var c=$(b.currentTarget);if(!c.hasClass("dropact")){return}var a=this.selection.getBlock()||this.selection.getCurrent();var d=c.data("dropdown");d.children("li").show();var e=d.find("> li > .redactor-dropdown-insert_table").parent();if(a.tagName=="TD"){e.hide()}else{e.nextAll().hide()}},insertSmiley:function(a,b,c){if(c){this.wbbcode.registerSmiley(a,b)}if(this.opts.visual){this.insert.html(' <img src="'+b+'" class="smiley" alt="'+a+'" /> ',false)}else{this.wutil.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},convertFromHtml:function(l){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:l});l=l.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");l=l.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");l=l.replace(/&#(8203|x200b);/g,"");l=l.replace(/™/gi,"\u2122");l=l.replace(/©/gi,"\u00a9");l=l.replace(/…/gi,"\u2026");l=l.replace(/—/gi,"\u2014");l=l.replace(/‐/gi,"\u2010");var q={};l=l.replace(/<div class="codeBox[^"]+"(.*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(A,B,y,D){var C="";var x="";if(B.match(/data-highlighter="([a-zA-Z]+)"/)){C=RegExp.$1}if(B.match(/data-filename="([^"]+)"/)){x=$.trim(RegExp.$1)}var z=WCF.getUUID();q[z]={codeContent:D.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:x.replace(/['"]/g,""),highlighter:(C==="plain"?"":C),lineNumber:(y>1?y:0)};return"@@@"+z+"@@@"});l=l.replace(/\r?\n/g,"");l=l.replace(/<a[^>]*?><\/a>/g,"");l=l.replace(/<p><\/p>/g,"");l=l.replace(/<br( \/)?><\/p>/g,"</p>");var g=l.split(/(<\/?(?:div|p)>)/);var h="";var v="";for(var a=0;a<g.length;a++){var w=g[a];if(w=="<p>"||w=="<div>"){continue}else{if(w=="</p>"||w=="</div>"){v=$.trim(v);if(v!="@@@wcf_empty_line@@@"){v+="\n"}h+=v;v=""}else{if(a==0||a+1==g.length){h+=w}else{v+=w}}}}if(v){h+=v;v=""}l=h;l=l.replace(/@@@wcf_empty_line@@@/g,"\n");l=l.replace(/\n\n$/,"\n");l=l.replace(/<br>$/,"");l=l.replace(/<br>/g,"\n");l=l.replace(/<br>/g,"");l=l.replace(/ /gi," ");l=l.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(z,y,B){var C;var A="";var x="";if(y.match(/data-author="([^"]+)"/)){A=WCF.String.unescapeHTML(RegExp.$1)}if(y.match(/cite="([^"]+)"/)){x=WCF.String.unescapeHTML(RegExp.$1)}if(x){C="[quote='"+A+"','"+x+"']"}else{if(A){C="[quote='"+A+"']"}else{C="[quote]"}}return C});l=l.replace(/(?:\n*)<\/blockquote>\n?/gi,"[/quote]\n");l=l.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");l=l.replace(/<a[^>]+><\/a>/,"");l=l.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(A,y,z,B){if(z==B){return"[url]"+z+"[/url]"}return"[url='"+z+"']"+B+"[/url]"});l=l.replace(/<(?:b|strong)>/gi,"[b]");l=l.replace(/<\/(?:b|strong)>/gi,"[/b]");l=l.replace(/<(?:i|em)>/gi,"[i]");l=l.replace(/<\/(?:i|em)>/gi,"[/i]");l=l.replace(/<u>/gi,"[u]");l=l.replace(/<\/u>/gi,"[/u]");l=l.replace(/<sub>/gi,"[sub]");l=l.replace(/<\/sub>/gi,"[/sub]");l=l.replace(/<sup>/gi,"[sup]");l=l.replace(/<\/sup>/gi,"[/sup]");l=l.replace(/<(?:s(trike)?|del)>/gi,"[s]");l=l.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var e=l.split(/(<\/?span[^>]*>)/);var v=[];var n=[];var o="";var c={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var a=0;a<e.length;a++){var i=e[a];if(i=="</span>"){var d=n.pop();var h=d.start+$.trim(v.pop())+d.end;if(v.length){v[v.length-1]+=h}else{o+=h}}else{if(i.match(/^<span/)){if(i.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var k=RegExp.$1;var t;var m;if(k.match(/color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var s=RegExp.$1;var b=RegExp.$2;var f=RegExp.$3;var p=("0123456789ABCDEF".charAt((s-s%16)/16)+""+"0123456789ABCDEF".charAt(s%16))+""+("0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16))+""+("0123456789ABCDEF".charAt((f-f%16)/16)+""+"0123456789ABCDEF".charAt(f%16));t="[color=#"+p+"]";m="[/color]"}else{if(k.match(/color: ?([^;]+);?/i)){t="[color="+RegExp.$1+"]";m="[/color]"}else{if(k.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){t="[size="+RegExp.$1+"]";m="[/size]"}else{if(c[RegExp.$1]){t="[size="+c[RegExp.$1]+"]";m="[/size]"}else{t="";m=""}}}else{if(k.match(/font-family: ?([^;]+);?/)){t="[font='"+RegExp.$1.replace(/'/g,"")+"']";m="[/font]"}else{t='<span style="'+k+'">';m="</span>"}}}}v[v.length]="";n[v.length]={start:t,end:m}}else{if(i.match(/^<span class="inlineCode">/)){v[v.length]="";n[v.length]={start:"[tt]",end:"[/tt]"}}else{v[v.length]="";n[v.length]={start:"",end:""}}}}else{if(v.length){v[v.length-1]+=i}else{o+=i}}}}l=o;l=l.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(y,x,A,z){return"[align="+A+"]"+$.trim(z)+"[/align]"});l=l.replace(/ ?<img [^>]*?alt="([^"]+?)" class="smiley".*?> ?/gi," $1 ");l=l.replace(/ ?<img [^>]*?class="smiley" alt="([^"]+?)".*?> ?/gi," $1 ");l=l.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)".*?( style="([^"]+)")?.*?>/gi,function(A,D,x,B){var C="none";var z=null;if(B){B=B.split(";");for(var E=0;E<B.length;E++){var y=$.trim(B[E]);if(y.match(/^float: (left|right)$/)){C=RegExp.$1}else{if(y.match(/^width: (\d+)px$/)){z=RegExp.$1}}}if(z!==null){return"[attach="+D+","+C+","+z+"][/attach]"}else{if(C!=="none"){return"[attach="+D+","+C+"][/attach]"}}}return"[attach="+D+"][/attach]"});l=l.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?style="([^"]+)".*?>/gi,function(C,F,y,z){var B="none";var A=0;var D=z.split(";");for(var E=0;E<D.length;E++){var x=D[E];if(x.match(/float: (left|right|none)/)){B=RegExp.$1}else{if(x.match(/width: (\d+)px/)){A=parseInt(RegExp.$1)}}}if(A){return"[img='"+y+"',"+B+","+A+"][/img]"}else{if(B!=="none"){return"[img='"+y+"',"+B+"][/img]"}}return"[img]"+y+"[/img]"});l=l.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");l=l.replace(/<li>/gi,"[*]");l=l.replace(/<\/li>/gi,"");l=l.replace(/<ul>/gi,"[list]");l=l.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");l=l.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");l=l.replace(/<\/(ul|ol)>/gi,"[/list]");l=l.replace(/<table[^>]*>/gi,"[table]\n");l=l.replace(/<\/table>/gi,"[/table]\n");l=l.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(x,y){return $.trim(y)});l=l.replace(/<tr><\/tr>/gi,"");l=l.replace(/<tr>/gi,"[tr]\n");l=l.replace(/<\/tr>/gi,"[/tr]\n");l=l.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");l=l.replace(/(\t)*<td>(\t)*/gi,"[td]");l=l.replace(/(\t)*<\/td>/gi,"[/td]\n");var u={};l.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(x){var y=x.hashCode();u[y]=x.replace(/\$/g,"$$$$");return"@@"+y+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:l});l=l.replace(/<[^(<|>)]+>/g,"");if($.getLength(u)){for(var j in u){var r=new RegExp("@@"+j+"@@","g");data=data.replace(r,u[j])}}if($.getLength(q)){$.each(q,function(z,B){var y=0;if(B.highlighter){y++}if(B.lineNumber){y++}if(B.filename){y++}var x="";switch(y){case 1:if(B.highlighter){x=B.highlighter}else{if(B.filename){x="'"+B.filename+"'"}else{x=B.lineNumber}}break;case 2:if(B.highlighter){x=B.highlighter}if(B.lineNumber){if(x.length){x+=","}x+=B.lineNumber}if(B.filename){if(x.length){x+=","}x+="'"+B.filename+"'"}break;case 3:x=B.highlighter+","+B.lineNumber+",'"+B.filename+"'";break}var A="[code"+(x.length?"="+x:"")+"]"+B.codeContent+"[/code]\n";l=l.replace(new RegExp("@@@"+z+"@@@\n?","g"),A)})}l=l.replace(/</g,"<");l=l.replace(/>/g,">");l=l.replace(/&/g,"&");l=l.replace(/%28/g,"(");l=l.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:l});l=$.trim(l);if(l.length){l+="\n"}return l},convertToHtml:function(F){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:F});F=this.wutil.removeZeroWidthSpace(F);F=F.replace(/&/g,"&");F=F.replace(/</g,"<");F=F.replace(/>/g,">");var s=[];var n=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");F=F.replace(n,function(G){var H=G.hashCode();s.push({key:H,value:G.replace(/\$/g,"$$$$")});return"@@"+H+"@@"});F=F.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);F=F.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);F=F.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);F=F.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);F=F.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);F=F.replace(/\[b\]([\s\S]*?)\[\/b]/gi,"<b>$1</b>");F=F.replace(/\[i\]([\s\S]*?)\[\/i]/gi,"<em>$1</em>");F=F.replace(/\[u\]([\s\S]*?)\[\/u]/gi,"<u>$1</u>");F=F.replace(/\[s\]([\s\S]*?)\[\/s]/gi,"<strike>$1</strike>");F=F.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,"<sub>$1</sub>");F=F.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,"<sup>$1</sup>");F=F.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');F=F.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(H,I,J){var G="float: "+J+";";if(J==="left"){G+="margin: 0 15px 7px 0"}else{G+="margin: 0 0 7px 15px"}return'<img src="'+I+'" style="'+G+'" />'});F=F.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(H,J,K,I){var G="float: "+K+"; width: "+I+"px;";if(K==="left"){G+="margin: 0 15px 7px 0"}else{G+="margin: 0 0 7px 15px"}return'<img src="'+J+'" style="'+G+'" />'});F=F.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');F=F.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(G,H,I){I=$.trim(I);if(!I.length){I=this.opts.invisibleSpace}return'<span style="font-size: '+H+'pt">'+I+"</span>"}).bind(this));F=F.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(H,G,I){I=$.trim(I);if(!I.length){I=this.opts.invisibleSpace}return'<span style="color: '+G+'">'+I+"</span>"}).bind(this));F=F.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(H,G,I){I=$.trim(I);if(!I.length){I=this.opts.invisibleSpace}return'<span style="font-family: '+G+'">'+I+"</span>"}).bind(this));F=F.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');F=F.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");F=F.replace(/\[list\]/gi,"<ul>");F=F.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');F=F.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');F=F.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');F=F.replace(/\[\/list\]/gi,"</ul>");F=F.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(G,H){return"[table]"+$.trim(H)+"[/table]"});F=F.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');F=F.replace(/\[\/table\](\n*)?/gi,function(G,H){if(H){if(H.match(/\n/g).length>2){H=H.replace(/^\n/,"")}return"</table>"+H}return"</table>"});F=F.replace(/\[tr\]\n*/gi,"<tr>");F=F.replace(/\[\/tr\]\n*/gi,"</tr>");F=F.replace(/\[td\]\n*/gi,"<td>");F=F.replace(/\[\/td\]\n*/gi,"</td>");F=F.replace(/<td>([\S\s]*?)<\/td>/gi,function(G,I){var H=$.trim(I);if(!H.length){H="​"}return"<td>"+H+"</td>"});var c=this.wutil.getOption("woltlab.attachmentUrl");var E=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(c){var C=this.wbbcode._getImageAttachments();F=F.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(G,H,I){H=parseInt(H);if(C[H]!==undefined){return'<img src="'+E.replace(/987654321/,H)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+H+'" />'}return G});F=F.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(H,I,J){I=parseInt(I);if(C[I]!==undefined){var G="";if(J==="left"||J==="right"){G="float: "+J+";";if(J==="left"){G+="margin: 0 15px 7px 0"}else{G+="margin: 0 0 7px 15px"}}G=' style="'+G+'"';return'<img src="'+E.replace(/987654321/,I)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+I+'"'+G+" />"}return H});F=F.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(H,J,K,I){J=parseInt(J);if(C[J]!==undefined){var G="width: "+I+"px; max-height: "+C[J].height+"px; max-width: "+C[J].width+"px;";if(K==="left"||K==="right"){G+="float: "+K+";";if(K==="left"){G+="margin: 0 15px 7px 0"}else{G+="margin: 0 0 7px 15px"}}G=' style="'+G+'"';return'<img src="'+c.replace(/987654321/,J)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+J+'"'+G+" />"}return H})}for(var u in __REDACTOR_SMILIES){var j=u.replace(/</g,"<").replace(/>/g,">");var i=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(j)+"(?=\\s|<|$)","gi");F=F.replace(i,'$1<img src="'+__REDACTOR_SMILIES[u]+'" class="smiley" alt="'+j+'" />')}F=F.replace(/(javascript):/gi,"$1<span></span>:");F=F.replace(/(\r|\r\n)/g,"\n");var y=[];var B=[];var g=F.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var d=WCF.getUUID();while(true){var o=false;for(var a=0;a<g.length;a++){var A=g[a];if(A.toLowerCase()==="[/quote]"){o=true;var e="";var m=g.slice(0,a);var b=false;while(m.length){var z=m.pop();e=z+e;if(z.match(/^\[quote/i)){A=e+A;var l=WCF.getUUID();y.push({hashCode:l,content:A.replace(/\$/g,"$$$$")});B.push(l);A="@@"+l+"@@";b=true;break}}if(!b){m=g.slice(0,a);A=d}g=m.concat(A,g.slice(a+1));break}}if(!o){break}}F=g.join("");F=F.replace(new RegExp(d,"g"),"[/quote]");F=F.replace(/\n*$/,"");var v=[];F=F.replace(/(<li>[\s\S]*?<\/li>)/g,function(G){G=$.trim(G).replace(/\n/,"<br>");var H=WCF.getUUID();v.push({key:H,content:G});return H});var f=F.split("\n");F="";for(var a=0,k=f.length;a<k;a++){var r=$.trim(f[a]);if(r.match(/^<([a-z]+)/)||r.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())){if(r.match(/^<([a-z]+).*<\/\1>/)){F+=r}else{F+=r+"<br />"}}else{F+="<p>"+r+"</p>"}}else{if(!r){r="<br>"}else{if(r.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,B)){F+=r;continue}}}F+="<p>"+r+"</p>"}}if(v.length){for(var a=v.length-1;a>=0;a--){F=F.replace(v[a].key,v[a].content)}}if(y.length){var D=function(G){return G.replace(/^['"]/,"").replace(/['"]$/,"")};var q=this;var p=function(G){return G.replace(/\[quote(=['"].+['"])?\]([\S\s]*)\[\/quote\]/gi,function(J,I,L){var P="";var K="";if(I){I=I.substr(1);I=I.split(",");switch(I.length){case 1:P=I[0];break;case 2:P=I[0];K=I[1];break}P=WCF.String.escapeHTML(D($.trim(P)));K=WCF.String.escapeHTML(D($.trim(K)))}var Q='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+K+'" data-author="'+P+'"><header contenteditable="false"><h3>'+q.wbbcode._buildQuoteHeader(P,K)+'</h3><a class="redactorQuoteEdit"></a></header>';L=$.trim(L);var H="";if(L.length){var O=L.split("\n");for(var N=0;N<O.length;N++){var M=O[N];if(M.length===0){M=q.opts.invisibleSpace}else{if(M.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,B)){H+=M;continue}}}H+="<div>"+M+"</div>"}}else{H="<div>"+q.opts.invisibleSpace+"</div>"}Q+=H;Q+="</blockquote>";return Q})};for(var a=y.length-1;a>=0;a--){var t=y[a];var w=new RegExp("@@"+t.hashCode+"@@","g");F=F.replace(w,p(t.content))}}if(s.length){for(var a=s.length-1;a>=0;a--){var x=s[a];var w=new RegExp("@@"+x.key+"@@","g");var h=x.value;h=h.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,function(J,Q,L){var K="plain";var O=0;var N="";if(Q){Q=Q.substring(1);Q=Q.split(",");var M=function(S){return S.match(/^\d+$/)};var I=function(S){return(S.indexOf(".")!==-1)};var H=function(S){return(__REDACTOR_CODE_HIGHLIGHTERS[Q[0]]!==undefined)};var G=function(S){return S.replace(/^(["'])(.*)\1$/,"$2")};switch(Q.length){case 1:if(M(Q[0])){O=(parseInt(Q[0])>1)?Q[0]:0}else{if(I(Q[0])){N=G(Q[0])}else{if(H(Q[0])){K=Q[0]}}}break;case 2:if(M(Q[0])){O=(parseInt(Q[0])>1)?Q[0]:0;if(I(Q[1])){N=G(Q[1])}else{if(H(Q[1])){K=Q[1]}}}else{if(H(Q[0])){K=Q[0]}if(I(Q[1])){N=G(Q[1])}}break;case 3:if(H(Q[0])){K=Q[0]}if(M(Q[1])){O=Q[1]}if(I(Q[2])){N=G(Q[2])}break}}L=L.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var R="";for(var P=0;P<L.length;P++){R+="<li>"+L[P]+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+K+'"'+(N?' data-filename="'+WCF.String.escapeHTML(N)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[K]+(N?": "+WCF.String.escapeHTML(N):"")+'</h3></div><ol start="'+(O>1?O:1)+'">'+R+"</ol></div></div>"});F=F.replace(w,h)}}F=F.replace(/<p><(blockquote|div)/g,"<$1");F=F.replace(/<\/(blockquote|div)><\/p>/g,"</$1>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:F});return F},_pasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/<h([1-6])([^>]*)>/g,function(f,i,h){if(h&&h.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var c=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').appendTo(document.body);var e=parseInt(c[0].clientWidth);c.remove();var d=-1;var g=false;$.each(b,function(l,j){if(d===-1){d=l}else{if(Math.abs(e-j)<Math.abs(e-b[d])){d=l}}if(e==j){g=true}});if(!g){d=(d<6)?parseInt(d)+1:d}i=d}}return"[size="+b[i]+"]"});a=a.replace(/<\/h[1-6]>/g,"[/size]");a=a.replace(/<(article|header)[^>]+>/g,"<div>");a=a.replace(/<\/(article|header)>/g,"</div>");a=a.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");a=a.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:a});return a},_pasteCallback:function(a){a=a.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');a=a.replace(/\[\/size\]/g,"</span></p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:a});return a;a=a.replace(/<img([^>]+)>/g,function(b,c){b=b.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return b});return a},insertAttachment:function(e,c){e=parseInt(e);var a=this.wutil.getOption("woltlab.attachment"+(!c?"Thumbnail":"")+"Url");var d=this.wbbcode._getImageAttachments();if(a&&d[e]!==undefined){var b="";if(c){b=' style="width: '+d[e].width+"px; max-height: "+d[e].height+"px; max-width: "+d[e].width+'px;"'}this.wutil.insertDynamic('<img src="'+a.replace(/987654321/,e)+'" class="redactorEmbeddedAttachment'+(!c?" redactorDisableResize":"")+'" data-attachment-id="'+e+'"'+b+" />","[attach="+e+(c?",none,"+d[e].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+e+"][/attach]")}},removeAttachment:function(a){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(b,d){var c=$(d);if(c.data("attachmentID")==a){c.remove()}})},_getImageAttachments:function(){var b=this.wutil.getOption("woltlab.attachmentImages")||[];if(b.length){delete this.opts.attachmentImages;return b}var a={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),a);return a.imageAttachments},_keydownCallback:function(t){switch(t.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var l=this.selection.getCurrent();var k=this.selection.getParent();k=(k)?$(k):k;var h=(k)?k.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(t.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var f=false;if(h.length){var i=true;for(var a=0;a<h[0].children.length;a++){var s=h[0].children[a];if(s.tagName==="DIV"){if(s.textContent.replace(/\u200b/,"").length){i=false;break}}}if(i){f=true}}else{var c=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var m=c.startContainer;if(m.nodeType===Node.TEXT_NODE){if(c.startOffset===0||(c.startOffset===1&&m.textContent==="\u200b")){if(!m.previousSibling){m=m.parentElement}}}if(m.nodeType===Node.ELEMENT_NODE){var g=m.previousSibling;if(g&&g.nodeType===Node.ELEMENT_NODE&&g.tagName==="BLOCKQUOTE"){h=g;f=true}}}if(f){var p=window.getSelection();if(p.rangeCount){p.removeAllRanges()}var n=document.createRange();n.selectNode(h[0]||h);p.addRange(n);t.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(l)){var r=l.nextElementSibling;if(r&&r.tagName==="BLOCKQUOTE"){var p=window.getSelection();if(p.rangeCount){p.removeAllRanges()}var n=document.createRange();n.selectNode(r);p.addRange(n);t.cancel=true}}break;case $.ui.keyCode.DOWN:var d=$(l);if(d.next("blockquote").length){this.caret.setStart(d.next().children("div:first"));t.cancel=true}else{if(k){if(k.next("blockquote").length){this.caret.setStart(k.next().children("div:first"));t.cancel=true}else{if(h.length){var o=d.closest("div",h[0]);if(!o.next().length){if(h.next().length){this.caret.setStart(h.next())}else{this.wutil.setCaretAfter(h)}t.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(h.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!k||!h.length){return}var o=$(l).closest("div",h[0]);var q=o.prev();if(q[0].tagName==="DIV"){return}else{if(q[0].tagName==="BLOCKQUOTE"){return}}var j=h.prev();if(j.length===0){this.wutil.setCaretBefore(h)}else{if(j[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(j.children("div:last"))}else{if($.trim(j.html())==""){j.html(this.opts.invisibleSpace)}this.caret.setEnd(j)}}t.cancel=true;break;case 83:if($.browser.mobile){return}var b=false;if(navigator.platform.match(/^Mac/)){if(t.event.ctrlKey&&t.event.altKey){b=true}}else{if(t.event.altKey){b=true}}if(b){var e={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),e);if(e.cancel){t.cancel=true}}break}},_keyupCallback:function(a){if(a.event.which!==$.ui.keyCode.BACKSPACE&&a.event.which!==$.ui.keyCode.DELETE){return}this.$editor.find("blockquote").each(function(b,d){var c=$(d);if(!c.children("header").length){c.remove()}})},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(d){var b=$(d.currentTarget).closest("header");var c=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(d.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(c);var a=b.offset();c.css({left:a.left+"px",top:(a.top+20)+"px"});$(".redactor-link-tooltip").remove();c.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(a,d){var b=$(d);var c=b.find(".redactorEditCodeBox");if(!c.length){c=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").insertAfter(b.find("> div > div > h3"))}c.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(b,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(a,c){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(c?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save"));if(c){this.selection.save();b.click($.proxy(function(){var f=$("#redactorQuoteAuthor").val();var e=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();var d=this.selection.getHtml();if(this.utils.isEmpty(d)){d=""}var g=this.wbbcode.insertQuoteBBCode(f,e,d);if(g!==null){if(!d.length){this.caret.setStart(g.find("> div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(a.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(a.attr("cite")));b.click($.proxy(function(){var d=$("#redactorQuoteAuthor").val();a.data("author",d);a.attr("data-author",d);a.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(a);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(b){var c=b.data("author");var a=b.attr("cite");if(a){a=WCF.String.escapeHTML(a)}b.find("> div > header > h3").empty().append(this.wbbcode._buildQuoteHeader(c,a))},insertQuoteBBCode:function(c,h,d,e){var g="[quote]";var a="[/quote]";if(c){if(h){g="[quote='"+c+"','"+h+"']"}else{g="[quote='"+c+"']"}}var l=null;if(this.wutil.inWysiwygMode()){var f=(e)?this.wbbcode.convertToHtml(e):d;var k=WCF.getUUID();var b=this.wbbcode.convertToHtml(g+k+a);b=b.replace(k,f.replace(/^<p>/,"").replace(/<\/p>$/,""));b=b.replace(/^<p>/,"").replace(/<\/p>$/,"");b=b.replace(/<blockquote/,'<blockquote id="'+k+'"');this.insert.html(b,false);l=this.$editor.find("#"+k);if(l.length){var j=l.find("> 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){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(i);i.remove()}}}l.removeAttr("id");this.wutil.setCaretAfter(l[0])}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(g+e+a)}this.wutil.saveSelection();return l},_buildQuoteHeader:function(b,c){var a="";if(!b&&c){b=c;c=""}if(b){if(c){a+='<a href="'+c+'">'}a+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(b)});if(c){a+="</a>"}}else{a="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return a},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(c,e){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(e?"insert":"edit")),400);var a=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(e){this.selection.get();var b=this.selection.getText();this.selection.save();this.modal.show();var i=$("#redactorCodeBox").focus();i.val(b);a.click($.proxy(function(){var p=$("#redactorCodeBox");var m=$("#redactorCodeFilename");var r=$("#redactorCodeHighlighter");var s=$("#redactorCodeLineNumber");var o=p.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(o).length===0){if(!p.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(p)}return}var n=$.trim(m.val().replace(/['"]/g,""));var q="[code="+r.val()+","+s.val()+(n.length?",'"+n+"'":"")+"]";q+=o;q+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var l=this.wbbcode.convertToHtml(q);this.buffer.set();this.insert.html(l,false);var p=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();p.attr("contenteditable","false");this.caret.setAfter(p);this.modal.close()},this))}else{var g=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));g.click((function(){this.buffer.set();c.remove();this.modal.close()}).bind(this));this.modal.show();var i=$("#redactorCodeBox").focus();var h=$("#redactorCodeFilename");var f=$("#redactorCodeHighlighter");var j=$("#redactorCodeLineNumber");f.val(c.data("highlighter"));h.val(c.data("filename")||"");var d=c.find("> div > ol");j.val(parseInt(d.prop("start")));var k="";d.children("li").each(function(l,m){k+=$(m).text()+"\n"});i.val(k.replace(/^\n+/,"").replace(/\n+$/,""));a.click($.proxy(function(){var m=i.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(m).length===0){if(!i.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(i)}return}var q=f.val();c.data("highlighter",q);c.attr("data-highlighter",q);var n=__REDACTOR_CODE_HIGHLIGHTERS[q];var l=$.trim(h.val().replace(/['"]/g,""));if(l){n+=": "+WCF.String.escapeHTML(l);c.data("filename",l);c.attr("data-filename",l)}else{c.removeAttr("data-filename");c.removeData("filename")}c.data("highlighter",f.val());c.find("> div > div > h3").html(n);var o=c.find("> div > ol").empty();var r=parseInt(j.val());o.prop("start",(r>1?r:1));m=m.split("\n");var p="";for(var s=0;s<m.length;s++){p+="<li>"+WCF.String.escapeHTML(m[s])+"</li>"}o.append($(p));this.modal.close()},this))}},fixBlockLevelElements:function(){return;var a=(function(d,c){var b="P";if(d.parentElement.tagName==="DIV"&&d.parentElement!==this.$editor[0]){d=d.parentElement;b="DIV"}if(d[c]===null||d[c].tagName!==b){$("<"+b+">"+this.opts.invisibleSpace+"</"+b+">")[(c==="previousElementSibling"?"insertBefore":"insertAfter")](d)}else{if(d.previousElementSibling.tagName===b){if(!d[c].innerHTML.length||d[c].innerHTML.toLowerCase()==="<p></p>"){$(d[c]).html(this.opts.invisibleSpace)}}}}).bind(this);this.$editor.find("blockquote, .codeBox").each((function(b,c){a(c,"previousElementSibling");a(c,"nextElementSibling")}).bind(this))},fixFormatting:function(c){var a=function(e){e.style.removeProperty("text-align");for(var f=0;f<e.children.length;f++){a(e.children[f])}};for(var d=0;d<this.alignment.blocks.length;d++){var b=this.alignment.blocks[d];switch(b.tagName){case"BLOCKQUOTE":b.style.removeProperty("text-align");a(b.children[0]);break;case"DIV":if(/\bcodeBox\b/.test(b.className)){a(b)}break}}}}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){if($.browser.msie){this.$editor.addClass("msie")}var i=$.trim(this.wutil.getOption("woltlab.originalValue"));if(i.length){this.wutil.replaceText(i);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var d=this.clean.onSync;this.clean.onSync=(function(i){if(a===true){a=false}else{i=i.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>")}return d.call(this,i)}).bind(this);if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var c=this.button.get("table");if(c.length){var h=c.data("dropdown");h.find(".redactor-dropdown-add_head").parent().remove();h.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(h.find(".redactor-dropdown-delete_table").parent());c.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_code_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertCode(null,true)},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+e,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+e,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var f=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var g=function(i){i.find("br").each(function(j,k){if(k.children.length){$(k).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");f.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode.fixBlockLevelElements();this.wutil.selectionEndOfEditor();this.wbbcode.observeQuotes();this.wbbcode.observeCodeListings();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");f.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wutil.fixDOM();g(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(i){this.wutil.saveSelection();if(i.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var b=this.opts.verifiedTags.indexOf("ul");if(b>-1){this.opts.verifiedTags.splice(b,1)}WCF.System.Event.addListener("com.woltlab.wcf.redactor","observe_load_"+e,(function(i){this.wbbcode.observeCodeListings();this.wbbcode.observeQuotes()}).bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","fixFormatting_"+e,$.proxy(this.wbbcode.fixFormatting,this))},_tableButtonClick:function(c){var d=$(c.currentTarget);if(!d.hasClass("dropact")){return}var b=this.selection.getBlock()||this.selection.getCurrent();var e=d.data("dropdown");e.children("li").show();var f=e.find("> li > .redactor-dropdown-insert_table").parent();if(b.tagName=="TD"){f.hide()}else{f.nextAll().hide()}},insertSmiley:function(b,c,d){if(d){this.wbbcode.registerSmiley(b,c)}if(this.opts.visual){this.insert.html(' <img src="'+c+'" class="smiley" alt="'+b+'" /> ',false)}else{this.wutil.insertAtCaret(" "+b+" ")}},registerSmiley:function(b,c){if(__REDACTOR_SMILIES[b]){return false}__REDACTOR_SMILIES[b]=c;return true},convertFromHtml:function(m){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:m});m=m.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");m=m.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");m=m.replace(/&#(8203|x200b);/g,"");m=m.replace(/™/gi,"\u2122");m=m.replace(/©/gi,"\u00a9");m=m.replace(/…/gi,"\u2026");m=m.replace(/—/gi,"\u2014");m=m.replace(/‐/gi,"\u2010");var r={};m=m.replace(/<div class="codeBox[^"]+"(.*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(B,C,z,E){var D="";var y="";if(C.match(/data-highlighter="([a-zA-Z]+)"/)){D=RegExp.$1}if(C.match(/data-filename="([^"]+)"/)){y=$.trim(RegExp.$1)}var A=WCF.getUUID();r[A]={codeContent:E.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:y.replace(/['"]/g,""),highlighter:(D==="plain"?"":D),lineNumber:(z>1?z:0)};return"@@@"+A+"@@@"});m=m.replace(/\r?\n/g,"");m=m.replace(/<a[^>]*?><\/a>/g,"");m=m.replace(/<p><\/p>/g,"");m=m.replace(/<br( \/)?><\/p>/g,"</p>");var h=m.split(/(<\/?(?:div|p)>)/);var i="";var w="";for(var b=0;b<h.length;b++){var x=h[b];if(x=="<p>"||x=="<div>"){continue}else{if(x=="</p>"||x=="</div>"){w=$.trim(w);if(w!="@@@wcf_empty_line@@@"){w+="\n"}i+=w;w=""}else{if(b==0||b+1==h.length){i+=x}else{w+=x}}}}if(w){i+=w;w=""}m=i;m=m.replace(/@@@wcf_empty_line@@@/g,"\n");m=m.replace(/\n\n$/,"\n");m=m.replace(/<br>$/,"");m=m.replace(/<br>/g,"\n");m=m.replace(/<br>/g,"");m=m.replace(/ /gi," ");m=m.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(A,z,C){var D;var B="";var y="";if(z.match(/data-author="([^"]+)"/)){B=WCF.String.unescapeHTML(RegExp.$1)}if(z.match(/cite="([^"]+)"/)){y=WCF.String.unescapeHTML(RegExp.$1)}if(y){D="[quote='"+B+"','"+y+"']"}else{if(B){D="[quote='"+B+"']"}else{D="[quote]"}}return D});m=m.replace(/(?:\n*)<\/blockquote>\n?/gi,"[/quote]\n");m=m.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");m=m.replace(/<a[^>]+><\/a>/,"");m=m.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(A,y,z,B){if(z==B){return"[url]"+z+"[/url]"}return"[url='"+z+"']"+B+"[/url]"});m=m.replace(/<(?:b|strong)>/gi,"[b]");m=m.replace(/<\/(?:b|strong)>/gi,"[/b]");m=m.replace(/<(?:i|em)>/gi,"[i]");m=m.replace(/<\/(?:i|em)>/gi,"[/i]");m=m.replace(/<u>/gi,"[u]");m=m.replace(/<\/u>/gi,"[/u]");m=m.replace(/<sub>/gi,"[sub]");m=m.replace(/<\/sub>/gi,"[/sub]");m=m.replace(/<sup>/gi,"[sup]");m=m.replace(/<\/sup>/gi,"[/sup]");m=m.replace(/<(?:s(trike)?|del)>/gi,"[s]");m=m.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var f=m.split(/(<\/?span[^>]*>)/);var w=[];var o=[];var p="";var d={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var b=0;b<f.length;b++){var j=f[b];if(j=="</span>"){var e=o.pop();var i=e.start+$.trim(w.pop())+e.end;if(w.length){w[w.length-1]+=i}else{p+=i}}else{if(j.match(/^<span/)){if(j.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var l=RegExp.$1;var u;var n;if(l.match(/color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var t=RegExp.$1;var c=RegExp.$2;var g=RegExp.$3;var q=("0123456789ABCDEF".charAt((t-t%16)/16)+""+"0123456789ABCDEF".charAt(t%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((g-g%16)/16)+""+"0123456789ABCDEF".charAt(g%16));u="[color=#"+q+"]";n="[/color]"}else{if(l.match(/color: ?([^;]+);?/i)){u="[color="+RegExp.$1+"]";n="[/color]"}else{if(l.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){u="[size="+RegExp.$1+"]";n="[/size]"}else{if(d[RegExp.$1]){u="[size="+d[RegExp.$1]+"]";n="[/size]"}else{u="";n=""}}}else{if(l.match(/font-family: ?([^;]+);?/)){u="[font='"+RegExp.$1.replace(/'/g,"")+"']";n="[/font]"}else{u='<span style="'+l+'">';n="</span>"}}}}w[w.length]="";o[w.length]={start:u,end:n}}else{if(j.match(/^<span class="inlineCode">/)){w[w.length]="";o[w.length]={start:"[tt]",end:"[/tt]"}}else{w[w.length]="";o[w.length]={start:"",end:""}}}}else{if(w.length){w[w.length-1]+=j}else{p+=j}}}}m=p;m=m.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(z,y,B,A){return"[align="+B+"]"+$.trim(A)+"[/align]"});m=m.replace(/ ?<img [^>]*?alt="([^"]+?)" class="smiley".*?> ?/gi," $1 ");m=m.replace(/ ?<img [^>]*?class="smiley" alt="([^"]+?)".*?> ?/gi," $1 ");m=m.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)".*?( style="([^"]+)")?.*?>/gi,function(B,E,y,C){var D="none";var A=null;if(C){C=C.split(";");for(var F=0;F<C.length;F++){var z=$.trim(C[F]);if(z.match(/^float: (left|right)$/)){D=RegExp.$1}else{if(z.match(/^width: (\d+)px$/)){A=RegExp.$1}}}if(A!==null){return"[attach="+E+","+D+","+A+"][/attach]"}else{if(D!=="none"){return"[attach="+E+","+D+"][/attach]"}}}return"[attach="+E+"][/attach]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?style="([^"]+)".*?>/gi,function(D,G,z,A){var C="none";var B=0;var E=A.split(";");for(var F=0;F<E.length;F++){var y=E[F];if(y.match(/float: (left|right|none)/)){C=RegExp.$1}else{if(y.match(/width: (\d+)px/)){B=parseInt(RegExp.$1)}}}if(B){return"[img='"+z+"',"+C+","+B+"][/img]"}else{if(C!=="none"){return"[img='"+z+"',"+C+"][/img]"}}return"[img]"+z+"[/img]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");m=m.replace(/<li>/gi,"[*]");m=m.replace(/<\/li>/gi,"");m=m.replace(/<ul>/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/<table[^>]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(y,z){return $.trim(z)});m=m.replace(/<tr><\/tr>/gi,"");m=m.replace(/<tr>/gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)*<td>(\t)*/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var v={};m.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(y){var z=y.hashCode();v[z]=y.replace(/\$/g,"$$$$");return"@@"+z+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:m});m=m.replace(/<[^(<|>)]+>/g,"");if($.getLength(v)){for(var k in v){var s=new RegExp("@@"+k+"@@","g");data=data.replace(s,v[k])}}if($.getLength(r)){$.each(r,function(A,C){var z=0;if(C.highlighter){z++}if(C.lineNumber){z++}if(C.filename){z++}var y="";switch(z){case 1:if(C.highlighter){y=C.highlighter}else{if(C.filename){y="'"+C.filename+"'"}else{y=C.lineNumber}}break;case 2:if(C.highlighter){y=C.highlighter}if(C.lineNumber){if(y.length){y+=","}y+=C.lineNumber}if(C.filename){if(y.length){y+=","}y+="'"+C.filename+"'"}break;case 3:y=C.highlighter+","+C.lineNumber+",'"+C.filename+"'";break}var B="[code"+(y.length?"="+y:"")+"]"+C.codeContent+"[/code]\n";m=m.replace(new RegExp("@@@"+A+"@@@\n?","g"),B)})}m=m.replace(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:m});m=$.trim(m);if(m.length){m+="\n"}return m},convertToHtml:function(G){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:G});G=this.wutil.removeZeroWidthSpace(G);G=G.replace(/&/g,"&");G=G.replace(/</g,"<");G=G.replace(/>/g,">");var t=[];var o=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");G=G.replace(o,function(H){var I=H.hashCode();t.push({key:I,value:H.replace(/\$/g,"$$$$")});return"@@"+I+"@@"});G=G.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);G=G.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);G=G.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);G=G.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);G=G.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);G=G.replace(/\[b\]([\s\S]*?)\[\/b]/gi,"<b>$1</b>");G=G.replace(/\[i\]([\s\S]*?)\[\/i]/gi,"<em>$1</em>");G=G.replace(/\[u\]([\s\S]*?)\[\/u]/gi,"<u>$1</u>");G=G.replace(/\[s\]([\s\S]*?)\[\/s]/gi,"<strike>$1</strike>");G=G.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,"<sub>$1</sub>");G=G.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,"<sup>$1</sup>");G=G.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');G=G.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(I,J,K){var H="float: "+K+";";if(K==="left"){H+="margin: 0 15px 7px 0"}else{H+="margin: 0 0 7px 15px"}return'<img src="'+J+'" style="'+H+'" />'});G=G.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(I,K,L,J){var H="float: "+L+"; width: "+J+"px;";if(L==="left"){H+="margin: 0 15px 7px 0"}else{H+="margin: 0 0 7px 15px"}return'<img src="'+K+'" style="'+H+'" />'});G=G.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');G=G.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(H,I,J){J=$.trim(J);if(!J.length){J=this.opts.invisibleSpace}return'<span style="font-size: '+I+'pt">'+J+"</span>"}).bind(this));G=G.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(I,H,J){J=$.trim(J);if(!J.length){J=this.opts.invisibleSpace}return'<span style="color: '+H+'">'+J+"</span>"}).bind(this));G=G.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(I,H,J){J=$.trim(J);if(!J.length){J=this.opts.invisibleSpace}return'<span style="font-family: '+H+'">'+J+"</span>"}).bind(this));G=G.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');G=G.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");G=G.replace(/\[list\]/gi,"<ul>");G=G.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');G=G.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');G=G.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');G=G.replace(/\[\/list\]/gi,"</ul>");G=G.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(H,I){return"[table]"+$.trim(I)+"[/table]"});G=G.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');G=G.replace(/\[\/table\](\n*)?/gi,function(H,I){if(I){if(I.match(/\n/g).length>2){I=I.replace(/^\n/,"")}return"</table>"+I}return"</table>"});G=G.replace(/\[tr\]\n*/gi,"<tr>");G=G.replace(/\[\/tr\]\n*/gi,"</tr>");G=G.replace(/\[td\]\n*/gi,"<td>");G=G.replace(/\[\/td\]\n*/gi,"</td>");G=G.replace(/<td>([\S\s]*?)<\/td>/gi,function(H,J){var I=$.trim(J);if(!I.length){I="​"}return"<td>"+I+"</td>"});var d=this.wutil.getOption("woltlab.attachmentUrl");var F=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(d){var D=this.wbbcode._getImageAttachments();G=G.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(H,I,J){I=parseInt(I);if(D[I]!==undefined){return'<img src="'+F.replace(/987654321/,I)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+I+'" />'}return H});G=G.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(I,J,K){J=parseInt(J);if(D[J]!==undefined){var H="";if(K==="left"||K==="right"){H="float: "+K+";";if(K==="left"){H+="margin: 0 15px 7px 0"}else{H+="margin: 0 0 7px 15px"}}H=' style="'+H+'"';return'<img src="'+F.replace(/987654321/,J)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+J+'"'+H+" />"}return I});G=G.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(I,K,L,J){K=parseInt(K);if(D[K]!==undefined){var H="width: "+J+"px; max-height: "+D[K].height+"px; max-width: "+D[K].width+"px;";if(L==="left"||L==="right"){H+="float: "+L+";";if(L==="left"){H+="margin: 0 15px 7px 0"}else{H+="margin: 0 0 7px 15px"}}H=' style="'+H+'"';return'<img src="'+d.replace(/987654321/,K)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+K+'"'+H+" />"}return I})}for(var v in __REDACTOR_SMILIES){var k=v.replace(/</g,"<").replace(/>/g,">");var j=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(k)+"(?=\\s|<|$)","gi");G=G.replace(j,'$1<img src="'+__REDACTOR_SMILIES[v]+'" class="smiley" alt="'+k+'" />')}G=G.replace(/(javascript):/gi,"$1<span></span>:");G=G.replace(/(\r|\r\n)/g,"\n");var z=[];var C=[];var h=G.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var e=WCF.getUUID();while(true){var p=false;for(var b=0;b<h.length;b++){var B=h[b];if(B.toLowerCase()==="[/quote]"){p=true;var f="";var n=h.slice(0,b);var c=false;while(n.length){var A=n.pop();f=A+f;if(A.match(/^\[quote/i)){B=f+B;var m=WCF.getUUID();z.push({hashCode:m,content:B.replace(/\$/g,"$$$$")});C.push(m);B="@@"+m+"@@";c=true;break}}if(!c){n=h.slice(0,b);B=e}h=n.concat(B,h.slice(b+1));break}}if(!p){break}}G=h.join("");G=G.replace(new RegExp(e,"g"),"[/quote]");G=G.replace(/\n*$/,"");var w=[];G=G.replace(/(<li>[\s\S]*?<\/li>)/g,function(H){H=$.trim(H).replace(/\n/,"<br>");var I=WCF.getUUID();w.push({key:I,content:H});return I});var g=G.split("\n");G="";for(var b=0,l=g.length;b<l;b++){var s=$.trim(g[b]);if(s.match(/^<([a-z]+)/)||s.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())){if(s.match(/^<([a-z]+).*<\/\1>/)){G+=s}else{G+=s+"<br />"}}else{G+="<p>"+s+"</p>"}}else{if(!s){s="<br>"}else{if(s.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,C)){G+=s;continue}}}G+="<p>"+s+"</p>"}}if(w.length){for(var b=w.length-1;b>=0;b--){G=G.replace(w[b].key,w[b].content)}}if(z.length){var E=function(H){return H.replace(/^['"]/,"").replace(/['"]$/,"")};var r=this;var q=function(H){return H.replace(/\[quote(=['"].+['"])?\]([\S\s]*)\[\/quote\]/gi,function(K,J,M){var Q="";var L="";if(J){J=J.substr(1);J=J.split(",");switch(J.length){case 1:Q=J[0];break;case 2:Q=J[0];L=J[1];break}Q=WCF.String.escapeHTML(E($.trim(Q)));L=WCF.String.escapeHTML(E($.trim(L)))}var R='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+L+'" data-author="'+Q+'"><header contenteditable="false"><h3>'+r.wbbcode._buildQuoteHeader(Q,L)+'</h3><a class="redactorQuoteEdit"></a></header>';M=$.trim(M);var I="";if(M.length){var P=M.split("\n");for(var O=0;O<P.length;O++){var N=P[O];if(N.length===0){N=r.opts.invisibleSpace}else{if(N.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,C)){I+=N;continue}}}I+="<div>"+N+"</div>"}}else{I="<div>"+r.opts.invisibleSpace+"</div>"}R+=I;R+="</blockquote>";return R})};for(var b=z.length-1;b>=0;b--){var u=z[b];var x=new RegExp("@@"+u.hashCode+"@@","g");G=G.replace(x,q(u.content))}}if(t.length){for(var b=t.length-1;b>=0;b--){var y=t[b];var x=new RegExp("@@"+y.key+"@@","g");var i=y.value;i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,function(K,R,M){var L="plain";var P=0;var O="";if(R){R=R.substring(1);R=R.split(",");var N=function(T){return T.match(/^\d+$/)};var J=function(T){return(T.indexOf(".")!==-1)};var I=function(T){return(__REDACTOR_CODE_HIGHLIGHTERS[R[0]]!==undefined)};var H=function(T){return T.replace(/^(["'])(.*)\1$/,"$2")};switch(R.length){case 1:if(N(R[0])){P=(parseInt(R[0])>1)?R[0]:0}else{if(J(R[0])){O=H(R[0])}else{if(I(R[0])){L=R[0]}}}break;case 2:if(N(R[0])){P=(parseInt(R[0])>1)?R[0]:0;if(J(R[1])){O=H(R[1])}else{if(I(R[1])){L=R[1]}}}else{if(I(R[0])){L=R[0]}if(J(R[1])){O=H(R[1])}}break;case 3:if(I(R[0])){L=R[0]}if(N(R[1])){P=R[1]}if(J(R[2])){O=H(R[2])}break}}M=M.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var S="";for(var Q=0;Q<M.length;Q++){S+="<li>"+M[Q]+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+L+'"'+(O?' data-filename="'+WCF.String.escapeHTML(O)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[L]+(O?": "+WCF.String.escapeHTML(O):"")+'</h3></div><ol start="'+(P>1?P:1)+'">'+S+"</ol></div></div>"});G=G.replace(x,i)}}G=G.replace(/<p><(blockquote|div)/g,"<$1");G=G.replace(/<\/(blockquote|div)><\/p>/g,"</$1>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:G});return G},_pasteBeforeCallback:function(b){var c={1:24,2:22,3:18,4:14,5:12,6:10};b=b.replace(/<h([1-6])([^>]*)>/g,function(g,j,i){if(i&&i.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var d=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').appendTo(document.body);var f=parseInt(d[0].clientWidth);d.remove();var e=-1;var h=false;$.each(c,function(m,l){if(e===-1){e=m}else{if(Math.abs(f-l)<Math.abs(f-c[e])){e=m}}if(f==l){h=true}});if(!h){e=(e<6)?parseInt(e)+1:e}j=e}}return"[size="+c[j]+"]"});b=b.replace(/<\/h[1-6]>/g,"[/size]");b=b.replace(/<(article|header)[^>]+>/g,"<div>");b=b.replace(/<\/(article|header)>/g,"</div>");b=b.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");b=b.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:b});return b},_pasteCallback:function(b){b=b.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');b=b.replace(/\[\/size\]/g,"</span></p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:b});return b;b=b.replace(/<img([^>]+)>/g,function(c,d){c=c.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return c});return b},insertAttachment:function(f,d){f=parseInt(f);var b=this.wutil.getOption("woltlab.attachment"+(!d?"Thumbnail":"")+"Url");var e=this.wbbcode._getImageAttachments();if(b&&e[f]!==undefined){var c="";if(d){c=' style="width: '+e[f].width+"px; max-height: "+e[f].height+"px; max-width: "+e[f].width+'px;"'}this.wutil.insertDynamic('<img src="'+b.replace(/987654321/,f)+'" class="redactorEmbeddedAttachment'+(!d?" redactorDisableResize":"")+'" data-attachment-id="'+f+'"'+c+" />","[attach="+f+(d?",none,"+e[f].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+f+"][/attach]")}},removeAttachment:function(b){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(c,e){var d=$(e);if(d.data("attachmentID")==b){d.remove()}})},_getImageAttachments:function(){var c=this.wutil.getOption("woltlab.attachmentImages")||[];if(c.length){delete this.opts.attachmentImages;return c}var b={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),b);return b.imageAttachments},_keydownCallback:function(u){switch(u.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var m=this.selection.getCurrent();var l=this.selection.getParent();l=(l)?$(l):l;var i=(l)?l.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(u.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var g=false;if(i.length){var j=true;for(var b=0;b<i[0].children.length;b++){var t=i[0].children[b];if(t.tagName==="DIV"){if(t.textContent.replace(/\u200b/,"").length){j=false;break}}}if(j){g=true}}else{var d=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var n=d.startContainer;if(n.nodeType===Node.TEXT_NODE){if(d.startOffset===0||(d.startOffset===1&&n.textContent==="\u200b")){if(!n.previousSibling){n=n.parentElement}}}if(n.nodeType===Node.ELEMENT_NODE){var h=n.previousSibling;if(h&&h.nodeType===Node.ELEMENT_NODE&&h.tagName==="BLOCKQUOTE"){i=h;g=true}}}if(g){var q=window.getSelection();if(q.rangeCount){q.removeAllRanges()}var o=document.createRange();o.selectNode(i[0]||i);q.addRange(o);u.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(m)){var s=m.nextElementSibling;if(s&&s.tagName==="BLOCKQUOTE"){var q=window.getSelection();if(q.rangeCount){q.removeAllRanges()}var o=document.createRange();o.selectNode(s);q.addRange(o);u.cancel=true}}break;case $.ui.keyCode.DOWN:var e=$(m);if(e.next("blockquote").length){this.caret.setStart(e.next().children("div:first"));u.cancel=true}else{if(l){if(l.next("blockquote").length){this.caret.setStart(l.next().children("div:first"));u.cancel=true}else{if(i.length){var p=e.closest("div",i[0]);if(!p.next().length){if(i.next().length){this.caret.setStart(i.next())}else{this.wutil.setCaretAfter(i)}u.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(i.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!l||!i.length){return}var p=$(m).closest("div",i[0]);var r=p.prev();if(r[0].tagName==="DIV"){return}else{if(r[0].tagName==="BLOCKQUOTE"){return}}var k=i.prev();if(k.length===0){this.wutil.setCaretBefore(i)}else{if(k[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(k.children("div:last"))}else{if($.trim(k.html())==""){k.html(this.opts.invisibleSpace)}this.caret.setEnd(k)}}u.cancel=true;break;case 83:if($.browser.mobile){return}var c=false;if(navigator.platform.match(/^Mac/)){if(u.event.ctrlKey&&u.event.altKey){c=true}}else{if(u.event.altKey){c=true}}if(c){var f={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),f);if(f.cancel){u.cancel=true}}break}},_keyupCallback:function(b){if(b.event.which!==$.ui.keyCode.BACKSPACE&&b.event.which!==$.ui.keyCode.DELETE){return}this.$editor.find("blockquote").each(function(c,e){var d=$(e);if(!d.children("header").length){d.remove()}})},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(e){var c=$(e.currentTarget).closest("header");var d=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(d);var b=c.offset();d.css({left:b.left+"px",top:(b.top+20)+"px"});$(".redactor-link-tooltip").remove();d.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(b,e){var c=$(e);var d=c.find(".redactorEditCodeBox");if(!d.length){d=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").insertAfter(c.find("> div > div > h3"))}d.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(c,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(b,d){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(d?"insert":"edit")),400);var c=this.modal.createActionButton(this.lang.get("save"));if(d){this.selection.save();c.click($.proxy(function(){var g=$("#redactorQuoteAuthor").val();var f=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();a=true;var e=this.selection.getHtml();if(this.utils.isEmpty(e)){e=""}var h=this.wbbcode.insertQuoteBBCode(g,f,e);if(h!==null){if(!e.length){this.caret.setStart(h.find("> div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(b.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(b.attr("cite")));c.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();b.data("author",e);b.attr("data-author",e);b.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(b);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(c){var d=c.data("author");var b=c.attr("cite");if(b){b=WCF.String.escapeHTML(b)}c.find("> div > header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(d,i,e,f){var h="[quote]";var b="[/quote]";if(d){if(i){h="[quote='"+d+"','"+i+"']"}else{h="[quote='"+d+"']"}}var m=null;if(this.wutil.inWysiwygMode()){var g=(f)?this.wbbcode.convertToHtml(f):e;var l=WCF.getUUID();var c=this.wbbcode.convertToHtml(h+l+b);c=c.replace(l,g.replace(/^<p>/,"").replace(/<\/p>$/,""));c=c.replace(/^<p>/,"").replace(/<\/p>$/,"");c=c.replace(/<blockquote/,'<blockquote id="'+l+'"');this.insert.html(c,false);m=this.$editor.find("#"+l);if(m.length){var k=m.find("> div");if(k.length==1){if(k[0].innerHTML===""){k[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var j=m.find("> div > br[type=_moz]");if(j.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(j);j.remove()}}}m.removeAttr("id");this.wutil.setCaretAfter(m[0])}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(h+f+b)}this.wutil.saveSelection();return m},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+='<a href="'+d+'">'}b+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(c)});if(d){b+="</a>"}}else{b="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return b},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(d,f){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(f?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(f){this.selection.get();var c=this.selection.getText();this.selection.save();this.modal.show();var j=$("#redactorCodeBox").focus();j.val(c);b.click($.proxy(function(){var q=$("#redactorCodeBox");var n=$("#redactorCodeFilename");var s=$("#redactorCodeHighlighter");var t=$("#redactorCodeLineNumber");var p=q.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(p).length===0){if(!q.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(q)}return}var o=$.trim(n.val().replace(/['"]/g,""));var r="[code="+s.val()+","+t.val()+(o.length?",'"+o+"'":"")+"]";r+=p;r+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var m=this.wbbcode.convertToHtml(r);this.buffer.set();this.insert.html(m,false);var q=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();q.attr("contenteditable","false");this.caret.setAfter(q);this.modal.close()},this))}else{var h=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));h.click((function(){this.buffer.set();d.remove();this.modal.close()}).bind(this));this.modal.show();var j=$("#redactorCodeBox").focus();var i=$("#redactorCodeFilename");var g=$("#redactorCodeHighlighter");var k=$("#redactorCodeLineNumber");g.val(d.data("highlighter"));i.val(d.data("filename")||"");var e=d.find("> div > ol");k.val(parseInt(e.prop("start")));var l="";e.children("li").each(function(m,n){l+=$(n).text()+"\n"});j.val(l.replace(/^\n+/,"").replace(/\n+$/,""));b.click($.proxy(function(){var n=j.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(n).length===0){if(!j.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(j)}return}var r=g.val();d.data("highlighter",r);d.attr("data-highlighter",r);var o=__REDACTOR_CODE_HIGHLIGHTERS[r];var m=$.trim(i.val().replace(/['"]/g,""));if(m){o+=": "+WCF.String.escapeHTML(m);d.data("filename",m);d.attr("data-filename",m)}else{d.removeAttr("data-filename");d.removeData("filename")}d.data("highlighter",g.val());d.find("> div > div > h3").html(o);var p=d.find("> div > ol").empty();var s=parseInt(k.val());p.prop("start",(s>1?s:1));n=n.split("\n");var q="";for(var t=0;t<n.length;t++){q+="<li>"+WCF.String.escapeHTML(n[t])+"</li>"}p.append($(q));this.modal.close()},this))}},fixBlockLevelElements:function(){return;var b=(function(e,d){var c="P";if(e.parentElement.tagName==="DIV"&&e.parentElement!==this.$editor[0]){e=e.parentElement;c="DIV"}if(e[d]===null||e[d].tagName!==c){$("<"+c+">"+this.opts.invisibleSpace+"</"+c+">")[(d==="previousElementSibling"?"insertBefore":"insertAfter")](e)}else{if(e.previousElementSibling.tagName===c){if(!e[d].innerHTML.length||e[d].innerHTML.toLowerCase()==="<p></p>"){$(e[d]).html(this.opts.invisibleSpace)}}}}).bind(this);this.$editor.find("blockquote, .codeBox").each((function(c,d){b(d,"previousElementSibling");b(d,"nextElementSibling")}).bind(this))},fixFormatting:function(d){var b=function(f){f.style.removeProperty("text-align");for(var g=0;g<f.children.length;g++){b(f.children[g])}};for(var e=0;e<this.alignment.blocks.length;e++){var c=this.alignment.blocks[e];switch(c.tagName){case"BLOCKQUOTE":c.style.removeProperty("text-align");b(c.children[0]);break;case"DIV":if(/\bcodeBox\b/.test(c.className)){b(c)}break}}}}};
// wbutton.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbutton=function(){return{_bbcodes:{},init:function(){this._bbcodes={};for(var h=0,e=__REDACTOR_BUTTONS.length;h<e;h++){this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[h])}var a={html:"fa-square-o",bold:"fa-bold",italic:"fa-italic",underline:"fa-underline",deleted:"fa-strikethrough",subscript:"fa-subscript",superscript:"fa-superscript",orderedlist:"fa-list-ol",unorderedlist:"fa-list-ul",outdent:"fa-outdent",indent:"fa-indent",link:"fa-link",alignment:"fa-align-left",table:"fa-table"};var d={fontcolor:WCF.Language.get("wcf.bbcode.button.fontColor"),fontfamily:WCF.Language.get("wcf.bbcode.button.fontFamily"),fontsize:WCF.Language.get("wcf.bbcode.button.fontSize"),image:WCF.Language.get("wcf.bbcode.button.image"),subscript:WCF.Language.get("wcf.bbcode.button.subscript"),superscript:WCF.Language.get("wcf.bbcode.button.superscript")};var b=this.wutil.getOption("buttons");var g="";for(var h=0,e=b.length;h<e;h++){var c=b[h];if(c=="separator"){this.button.get(g).parent().addClass("separator");continue}var f=this.button.get(c);if(f.length){if(a[c]){this.button.setAwesome(c,a[c])}if(c==="table"&&g){f.parent().insertAfter(this.button.get(g).parent())}}else{this.wbutton._addCoreButton(c,(d[c]?d[c]:null),(a[c]?a[c]:null),g)}g=c}this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this))},_addCoreButton:function(b,c,a,d){var f={title:(c===null?b:c)};if(b==="subscript"||b==="superscript"){f.command=b}var e=this.button.build(b,f);$("<li />").append(e).insertAfter(this.button.get(d).parent());if(a!==null){this.button.setAwesome(b,a)}},_addBBCodeButton:function(b){var c="__wcf_"+b.name;var a=this.button.add(c,b.label);this.button.addCallback(a,this.wbutton._insertBBCode);this._bbcodes[c]={name:b.name,voidElement:(b.voidElement===true)};if(b.icon.match(/^fa\-[a-z\-]+$/)){this.button.setAwesome(c,b.icon)}else{a.css("background-image","url("+__REDACTOR_ICON_PATH+b.icon+")")}},_insertBBCode:function(a){var d=this._bbcodes[a].name;var b={buttonName:a,cancel:false,redactor:this};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+d+"_"+this.$textarea.wcfIdentify(),b);if(b.cancel===false){var c=this.selection.getHtml();if(false&&d==="tt"){var e=(this.selection.getParent())?$(this.selection.getParent()):null;if(e&&e.closest("inline.inlineCode",this.$editor.get()[0]).length){this.inline.toggleClass("inlineCode")}else{this.inline.toggleClass("inlineCode")}}else{this.buffer.set();if(this.utils.browser("mozilla")&&!c.length){var f=getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.ELEMENT_NODE&&f.tagName==="P"&&f.innerHTML==="<br>"){f.removeChild(f.children[0])}}if(this._bbcodes[a].voidElement){this.insert.html(c+this.selection.getMarkerAsHtml()+"["+d+"]",false)}else{this.insert.html("["+d+"]"+c+this.selection.getMarkerAsHtml()+"[/"+d+"]",false)}this.selection.restore()}}},insertImage:function(){this.image.show()},_insertImage:function(){var d=$("#redactor-image-link-source");var b=d.val().trim();if(b.length){this.buffer.set();var c=$("#redactor-image-align").val();var a="";if(c==="left"||c==="right"){a=' style="float: '+c+'"'}this.insert.html('<img src="'+b+'"'+a+">",false);this.modal.close();this.observe.images()}else{if(!d.next("small.innerError")){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(d)}}}}};
// wfontcolor.js
// wfontsize.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wfontsize=function(){return{init:function(){var a=this.button.addDropdown(this.button.get("fontsize"));this.wfontsize._createDropdown(a)},_createDropdown:function(g){var e=[8,10,12,14,18,24,36];var b=this;for(var f=0;f<e.length;f++){var c=e[f];var d=$('<li><a href="#">'+c+"</a></li>").appendTo(g);var a=d.children("a").data("fontSize",c).css("font-size",c+"pt");if(c>18){a.css("line-height","1em")}a.click(function(h){h.preventDefault();b.inline.format("span","style","font-size: "+$(this).data("fontSize")+"pt;")})}$('<li class="dropdownDivider" />').appendTo(g);var d=$('<li><a href="#">'+this.opts.curLang.none+"</a></li>").appendTo(g);d.children("a").click(function(h){h.preventDefault();b.inline.removeStyleRule("font-size")})}}};
// wmonkeypatch.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch=function(){return{init:function(){this.wmonkeypatch.alignment();this.wmonkeypatch.button();this.wmonkeypatch.caret();this.wmonkeypatch.clean();this.wmonkeypatch.code();this.wmonkeypatch.dropdown();this.wmonkeypatch.image();this.wmonkeypatch.inline();this.wmonkeypatch.insert();this.wmonkeypatch.keydown();this.wmonkeypatch.keyup();this.wmonkeypatch.link();this.wmonkeypatch.modal();this.wmonkeypatch.paste();this.wmonkeypatch.observe();this.wmonkeypatch.selection();this.wmonkeypatch.utils();this.wmonkeypatch.rebuildTemplates();this.wmonkeypatch.bindEvents();this.wmonkeypatch.fixWebKit()},bindEvents:function(){var a=this.$textarea.wcfIdentify();this.wutil.setOption("keydownCallback",function(e){var d={cancel:false,event:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+a,d);return(d.cancel?false:true)});this.wutil.setOption("keyupCallback",(function(e){this.wutil.saveSelection();var d={cancel:false,event:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+a,d);return(d.cancel?false:true)}).bind(this));if(this.opts.activeButtons){this.$editor.off("mouseup.redactor keyup.redactor focus.redactor");this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",$.proxy(this.observe.buttons,this));this.$editor.on("keyup.redactor",$.proxy(this.keyup.init,this))}var c=false;this.$editor.on("mousedown.wmonkeypatch",(function(){c=true}).bind(this));$(document).on("mouseup.wmonkeypatch",(function(){if(c){c=false;this.wutil.saveSelection()}}).bind(this));var b=(function(d,e){if(e){if(d.previousElementSibling&&d.previousElementSibling.tagName==="P"){this.caret.setEnd(d.previousElementSibling)}else{this.wutil.setCaretBefore(d)}}else{if(d.nextElementSibling&&d.nextElementSibling.tagName==="P"){this.caret.setEnd(d.nextElementSibling)}else{this.wutil.setCaretAfter(d)}}}).bind(this);this.$editor.on("click.wmonkeypatch",(function(g){if(g.target===this.$editor[0]){var h=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(h&&h.collapsed){var f=h.startContainer;while(f!==null&&f!==this.$editor[0]){if(f.nodeType===Node.ELEMENT_NODE){if(f.tagName==="BLOCKQUOTE"||(f.tagName==="DIV"&&/\bcodeBox\b/.test(f.className))){var d=$(element).offset();if(g.pageY<=d.top){b(f,true)}else{b(f,false)}return false}}f=f.parentElement}}var e=this.$editor.children("blockquote, div.codeBox");e.each(function(l,m){var j=$(m);var i=j.offset();if(g.pageY<=i.top){b(m,true);return false}else{var k=j.outerHeight()+(parseInt(j.css("margin-bottom"),10)||0);if((g.pageY<=i.top+k)||(l+1)===e.length){b(m,false);return false}}});return false}}).bind(this))},alignment:function(){var a=this.alignment.setBlocks;this.alignment.setBlocks=(function(b){a.call(this,b);WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","fixFormatting_"+this.$textarea.wcfIdentify())}).bind(this)},button:function(){var a=this.button.addDropdown;this.button.addDropdown=(function(b,d){var c=a.call(this,b,d);if(!d){c.addClass("dropdownMenu")}return c}).bind(this)},caret:function(){this.caret.set=(function(g,f,d,b){if(!this.utils.browser("msie")){if(this.utils.isMobile()&&this.utils.browser("webkit")&&navigator.userAgent.match(/(iPad|iPhone|iPod)/i)){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}}else{this.$editor.focus()}}g=g[0]||g;d=d[0]||d;if(this.utils.isBlockTag(g.tagName)&&g.innerHTML===""){g.innerHTML=this.opts.invisibleSpace}if(g.tagName=="BR"&&this.opts.linebreaks===false){var a=$(this.opts.emptyHtml)[0];$(g).replaceWith(a);g=a;d=g}this.selection.get();try{this.range.setStart(g,f);this.range.setEnd(d,b)}catch(c){}this.selection.addRange()}).bind(this);this.caret.setOffset=(function(g,a){if(typeof a=="undefined"){a=g}if(!this.focus.isFocused()){this.focus.setStart()}var b=document.createRange();var d=document.getSelection();var c,f=0;var e=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);while(c=e.nextNode()){f+=c.nodeValue.length;if(f>g||(g===a&&f===g)){b.setStart(c,c.nodeValue.length+g-f);g=Infinity}if(f>=a){b.setEnd(c,c.nodeValue.length+a-f);break}}d.removeAllRanges();d.addRange(b)}).bind(this)},clean:function(){var c=function(e){e=e.replace(/\u201D/g,"__wcf_preserve_character_1__");e=e.replace(/\u201C/g,"__wcf_preserve_character_2__");e=e.replace(/\u2018/g,"__wcf_preserve_character_3__");e=e.replace(/\u2019/g,"__wcf_preserve_character_4__");return e};var b=function(e){e=e.replace(/__wcf_preserve_character_1__/g,"\u201D");e=e.replace(/__wcf_preserve_character_2__/g,"\u201C");e=e.replace(/__wcf_preserve_character_3__/g,"\u2018");e=e.replace(/__wcf_preserve_character_4__/g,"\u2019");return e};var d=this.clean.onPaste;this.clean.onPaste=(function(f,e){this.opts.replaceDivs=true;f=c(f);f=d.call(this,f,e);this.opts.replaceDivs=false;return b(f)}).bind(this);this.clean.onPasteRemoveEmpty=function(e){return e.replace(/<br\s?\/?>$/i,"")};var a=this.clean.onSet;this.clean.onSet=(function(e){e=c(e);e=a.call(this,e);return b(e)}).bind(this);this.clean.setVerified=(function(g){if(this.utils.browser("msie")){return g}g=g.replace(new RegExp("<img(.*?[^>])>","gi"),'<img$1 data-verified="redactor">');g=g.replace(new RegExp("<span(.*?)>","gi"),'<span$1 data-verified="redactor">');var j=g.match(new RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>',"gi"));if(j){var e=j.length;for(var f=0;f<e;f++){var h=j[f].replace(/style="(.*?)"/i,'style="$1" rel="$1"');g=g.replace(new RegExp(WCF.String.escapeRegExp(j[f]),"gi"),h)}}return g}).bind(this)},code:function(){var c=this.code.startSync;this.code.startSync=(function(){this.code.syncCode=undefined;c.call(this)}).bind(this);var b=this.code.textareaIndenting;this.code.textareaIndenting=(function(d){if(d.keyCode!==9||d.ctrlKey){return true}return b.call(this,d)}).bind(this);var a=this.code.showCode;this.code.showCode=(function(){var d=null;if(!this.$textarea.is(":visible")){d=this.$textarea.parentsUntil(":visible").last();d.show()}a.call(this);if(d!==null){d.hide()}}).bind(this)},dropdown:function(){this.dropdown.build=(function(c,e,d){e.addClass("dropdownMenu");$.each(d,(function(i,h){if(i=="dropdownDivider"){$('<li class="dropdownDivider" />').appendTo(e)}else{var g=$("<li />");var f=$('<a href="#" class="redactor-dropdown-'+i+'">'+h.title+"</a>");f.on("click",$.proxy(function(k){var j="func";var l=h.func;if(h.command){j="command";l=h.command}else{if(h.dropdown){j="dropdown";l=h.dropdown}}this.button.onClick(k,i,j,l)},this));f.appendTo(g);g.appendTo(e)}}).bind(this))}).bind(this);var a=this.dropdown.show;this.dropdown.show=$.proxy(function(f,c){var d=this.button.get(c).data("dropdown");b(d);if($.browser.iOS){this.wutil.saveSelection()}a.call(this,f,c);d.off("mouseover mouseout")},this);var b=function(f){if(f.hasClass("dropdownMenu")){return}f.addClass("dropdownMenu");var e=f.children("a").detach();for(var d=0;d<e.length;d++){var c=$("<li />").appendTo(f);c.append(e[d])}}},image:function(){var c=this.image.setEditable;this.image.setEditable=(function(d){if(!d.hasClass("smiley")){c.call(this,d)}}).bind(this);var b=this.image.loadEditableControls;this.image.loadEditableControls=(function(d){var e=b.call(this,d);if(d.hasClass("redactorDisableResize")&&e!==false){e.hide()}return e}).bind(this);this.image.show=(function(){this.modal.load("image",this.lang.get("image"),0);var d=this.modal.createActionButton(this.lang.get("insert"));d.click($.proxy(this.wbutton._insertImage,this));this.selection.save();this.modal.show()}).bind(this);this.image.showEdit=(function(d){this.modal.load("imageEdit",this.lang.get("edit"),0);this.image.buttonSave=this.modal.createActionButton(this.lang.get("save"));this.image.buttonSave.click((function(){this.image.update(d)}).bind(this));$("#redactor-image-link-source").val(d.attr("src"));$("#redactor-image-align").val(d.css("float"));this.modal.show()}).bind(this);var a=(function(e){var d=e.parent();e=e.detach();e.prependTo(d);this.caret.setAfter(e)}).bind(this);this.image.update=(function(d){this.image.hideResize();this.buffer.set();d.attr("src",$("#redactor-image-link-source").val());this.image.setFloating(d);a(d);this.modal.close();this.observe.images()}).bind(this)},inline:function(){var b=this.inline.format;this.inline.format=(function(c,d,e){if($.browser.iOS){this.wutil.restoreSelection()}b.call(this,c,d,e)}).bind(this);var a=this.inline.removeStyleRule;this.inline.removeStyleRule=(function(c){if($.browser.iOS){this.wuil.restoreSelection()}a.call(this,c)}).bind(this)},insert:function(){var c=($.browser.webkit||document.documentElement.style.hasOwnProperty("WebkitAppearance")||window.hasOwnProperty("chrome"));var a=(function(g){var f=this.$editor.html();if(this.utils.isEmpty(f)){var i=false;if(g.match(/^<(blockquote|div|p)/i)){this.$editor.empty();i=true}this.$editor.focus();if(!i){this.caret.setEnd(this.$editor.children("p:eq(0)"))}}else{if(document.activeElement!==this.$editor[0]){this.wutil.restoreSelection()}if(g.match(/^<(blockquote|div|p)/i)&&getSelection().getRangeAt(0).collapsed){var h=getSelection().getRangeAt(0).startContainer;if(h.nodeType===Node.TEXT_NODE&&h.textContent==="\u200b"){this.caret.setEnd($(h.parentElement).html("<br />"))}}}}).bind(this);var b=(function(){var f=false;this.$editor.find("span").each(function(){var g=$(this);if(g.data("verified")!=="redactor"){var h=$("<b>helper</b>").insertBefore(g);h.after(g.contents());h.remove();g.remove();f=true}});if(f){this.wutil.saveSelection()}}).bind(this);var e=this.insert.html;this.insert.html=(function(g,f){a(g);e.call(this,g,f);this.wutil.saveSelection();if(c){setTimeout(function(){b()},10)}}).bind(this);if(navigator.userAgent.match(/safari/i)){var d=this.insert.execHtml;this.insert.execHtml=(function(f){try{d.call(this,f)}catch(g){console.debug("[Redactor.wmonkeypatch] Suppressed error in Safari: "+g.message)}}).bind(this)}},keydown:function(){this.keydown.enterWithinBlockquote=false;var c=this.keydown.onTab;this.keydown.onTab=(function(g,d){var f=this.selection.getBlock();if(f&&f.tagName==="LI"){return c.call(this,g,d)}return true}).bind(this);var b=this.keydown.replaceDivToParagraph;this.keydown.replaceDivToParagraph=(function(){if(this.keydown.enterWithinBlockquote){this.keydown.enterWithinBlockquote=false}else{b.call(this)}}).bind(this);var a=this.keydown.setupBuffer;this.keydown.setupBuffer=(function(f,d){if(this.keydown.ctrl&&d===89&&!f.shiftKey&&!f.altKey&&this.opts.rebuffer.length!==0){f.preventDefault();this.buffer.redo();return}a.call(this,f,d)}).bind(this)},keyup:function(){var a=this.keyup.replaceToParagraph;this.keyup.replaceToParagraph=(function(b){if(this.keyup.current.tagName!=="DIV"||this.keyup.current.parentElement.tagName!=="BLOCKQUOTE"){a.call(this,b)}}).bind(this)},link:function(){var b=this.link.insert;this.link.insert=(function(){b.call(this);this.selection.get();var c=this.selection.getCurrent();if(c.nodeType===Node.TEXT_NODE){c=c.parentElement}if(c.tagName==="A"){this.caret.setAfter(c)}}).bind(this);var a=this.link.set;this.link.set=(function(f,d,e){a.call(this,f,d,e);if(f.length&&this.link.text!==f){this.selection.get();var c=this.selection.getCurrent();if(c.nodeType===Node.TEXT_NODE){c=c.parentElement}if(c.tagName==="A"){$(c).text(f)}}}).bind(this)},modal:function(){this.modal.dialog=null;var b=this.modal.addTemplate;this.modal.addTemplate=(function(c,d){if(c!=="table"){b.call(this,c,d)}}).bind(this);this.modal.build=function(){};this.modal.load=(function(c,e,d){this.modal.templateName=c;this.modal.title=e;this.modal.dialog=$("<div />").hide().appendTo(document.body);this.modal.dialog.html(this.modal.getTemplate(this.modal.templateName));this.$modalFooter=null}).bind(this);this.modal.show=(function(){this.modal.dialog.wcfDialog({onClose:$.proxy(this.modal.close,this),title:this.modal.title});this.modal.dialog.find("input:first").focus()}).bind(this);var a=this.modal.createButton;this.modal.createButton=(function(c,d){if(this.$modalFooter===null){this.$modalFooter=$('<div class="formSubmit" />').appendTo(this.modal.dialog);this.modal.dialog.addClass("dialogForm")}return a.call(this,c,d)}).bind(this);this.modal.close=(function(){if(this.modal.dialog===null){return}try{this.modal.dialog.wcfDialog("close");this.modal.dialog.remove()}catch(c){}this.modal.dialog=null}).bind(this);this.modal.createCancelButton=function(){return $()};this.modal.createDeleteButton=function(){return $()}},observe:function(){var d=(function(j,e,h,f,i,k){var g=this.$toolbar.find(h);if(j&&j.closest(e,this.$editor[0]).length!=0){g[(f?"removeClass":"addClass")](i)}else{if(k&&!this.opts.visual){return}g[(f?"addClass":"removeClass")](i)}}).bind(this);var c=this.observe.buttons;this.observe.buttons=(function(g,h){c.call(this,g,h);var f=this.selection.getParent();f=(f===false)?null:$(f);d(f,"ul, ol","a.re-indent, a.re-outdent",true,"redactor-button-disabled");d(f,"blockquote.quoteBox","a.re-__wcf_quote",false,"redactor-button-disabled",true);d(f,"sub","a.re-subscript",false,"redactor-act");d(f,"sup","a.re-superscript",false,"redactor-act")}).bind(this);var a=this.observe.load;this.observe.load=(function(){a.call(this);WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","observe_load_"+this.$textarea.wcfIdentify())}).bind(this);var b=this.observe.showTooltip;this.observe.showTooltip=(function(g){var f=$(g.target);if(!f.hasClass("redactorQuoteEdit")){b.call(this,g)}}).bind(this)},paste:function(){var a=this.paste.insert;this.paste.insert=(function(b){a.call(this,b);setTimeout((function(){this.wutil.fixDOM();if($.browser.msie){getSelection().getRangeAt(0).collapse(false)}this.wutil.saveSelection()}).bind(this),20)}).bind(this)},selection:function(){this.selection.implicitRange=null;var a=(function(e,c){var b=c.nextSibling;if(b!==null&&b.nodeType===Node.TEXT_NODE&&b.length===0){$(b).remove()}var d=null;if((c.id==="selection-marker-1"&&!this.$editor.find("#selection-marker-2").length)||c.id==="nodes-marker-1"&&!this.$editor.find("#nodes-marker-2").length){d=c.previousSibling}$(c).remove();if(d!==null){this.selection.implicitRange=document.createRange();this.selection.implicitRange.setStart(d,d.length);this.selection.implicitRange.setEnd(d,d.length)}else{this.selection.implicitRange=null}}).bind(this);this.selection.removeMarkers=(function(){this.$editor.find("span.redactor-selection-marker").each(a)}).bind(this);this.selection.removeNodesMarkers=(function(){$(document).find("span.redactor-nodes-marker").each(a);this.$editor.find("span.redactor-nodes-marker").each(a)}).bind(this)},utils:function(){this.utils.removeEmpty=function(a,b){}},rebuildTemplates:function(){this.opts.modal.image='<fieldset id="redactor-modal-image-edit"><dl><dt><label for="redactor-image-link-source">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long" /></dd></dl><dl><dt><label for="redactor-image-align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor-image-align"><option value="none">'+WCF.Language.get("wcf.global.noSelection")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="right">'+this.lang.get("right")+"</option></select></dd></dl></fieldset>";this.opts.modal.imageEdit=this.opts.modal.image;this.opts.modal.link='<fieldset id="redactor-modal-link"><dl><dt><label for="redactor-link-url" />URL</label></dt><dd><input type="url" id="redactor-link-url" class="long" /></dd></dl><dl><dt><label for="redactor-link-url-text">'+this.lang.get("text")+'</label></dt><dd><input type="text" id="redactor-link-url-text" class="long" /></dd></dl></fieldset>';this.opts.modal.quote='<fieldset><dl><dt><label for="redactorQuoteAuthor">'+WCF.Language.get("wcf.bbcode.quote.edit.author")+'</label></dt><dd><input type="text" id="redactorQuoteAuthor" class="long" /></dd></dl><dl><dt><label for="redactorQuoteLink">'+WCF.Language.get("wcf.bbcode.quote.edit.link")+'</label></dt><dd><input type="text" id="redactorQuoteLink" class="long" /></dd></dl></fieldset>';var a="";$.each(__REDACTOR_CODE_HIGHLIGHTERS,function(c,b){if(c==="plain"){return true}a+='<option value="'+c+'">'+b+"</option>"});this.opts.modal.code="<fieldset><legend>"+WCF.Language.get("wcf.bbcode.code.settings")+'</legend><dl><dt><label for="redactorCodeHighlighter">'+WCF.Language.get("wcf.bbcode.code.highlighter")+'</label></dt><dd><select id="redactorCodeHighlighter"><option value="plain">'+WCF.Language.get("wcf.bbcode.code.highlighter.none")+"</option>"+a+"</select><small>"+WCF.Language.get("wcf.bbcode.code.highlighter.description")+'</small></dd></dl><dl><dt><label for="redactorCodeLineNumber">'+WCF.Language.get("wcf.bbcode.code.lineNumber")+'</label></dt><dd><input type="number" id="redactorCodeLineNumber" min="1" max="99999" value="1" /><small>'+WCF.Language.get("wcf.bbcode.code.lineNumber.description")+'</small></dd></dl><dl><dt><label for="redactorCodeFilename">'+WCF.Language.get("wcf.bbcode.code.filename")+'</label></dt><dd><input type="text" id="redactorCodeFilename" value="" class="long" /><small>'+WCF.Language.get("wcf.bbcode.code.filename.description")+"</small></dd></dl></fieldset><fieldset><legend>"+WCF.Language.get("wcf.bbcode.code")+'</legend><dl class="wide"><dt></dt><dd><textarea id="redactorCodeBox" class="long" rows="12" /></dd></dl></fieldset>';this.opts.modal.table='<fieldset id="redactor-modal-table-insert"><dl><dt><label for="redactor-table-rows">'+this.lang.get("rows")+'</label></dt><dd><input type="number" size="5" value="2" min="1" id="redactor-table-rows" class="tiny" /></dd></dl><dl><dt><label for="redactor-table-columns">'+this.lang.get("columns")+'</label></dt><dd><input type="number" size="5" value="3" min="1" id="redactor-table-columns" class="tiny" /></dd></dl></fieldset>'},fixWebKit:function(){return;if(!$.browser.webkit&&!document.documentElement.style.hasOwnProperty("WebkitAppearance")&&!window.hasOwnProperty("chrome")){return}var a={fontSize:this.$editor.css("font-size"),lineHeight:this.$editor.css("line-height")};var c=this.$editor.wcfIdentify();var b=document.createElement("style");b.type="text/css";b.innerHTML="#"+c+" span { font-size: "+a.fontSize+"; line-height: "+a.lineHeight+" }";document.head.appendChild(b)}}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch=function(){return{init:function(){this.wmonkeypatch.alignment();this.wmonkeypatch.button();this.wmonkeypatch.caret();this.wmonkeypatch.clean();this.wmonkeypatch.code();this.wmonkeypatch.dropdown();this.wmonkeypatch.image();this.wmonkeypatch.inline();this.wmonkeypatch.insert();this.wmonkeypatch.keydown();this.wmonkeypatch.keyup();this.wmonkeypatch.link();this.wmonkeypatch.modal();this.wmonkeypatch.paste();this.wmonkeypatch.observe();this.wmonkeypatch.selection();this.wmonkeypatch.utils();this.wmonkeypatch.rebuildTemplates();this.wmonkeypatch.bindEvents();this.wmonkeypatch.fixWebKit()},bindEvents:function(){var a=this.$textarea.wcfIdentify();this.wutil.setOption("keydownCallback",function(e){var d={cancel:false,event:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+a,d);return(d.cancel?false:true)});this.wutil.setOption("keyupCallback",(function(e){this.wutil.saveSelection();var d={cancel:false,event:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+a,d);return(d.cancel?false:true)}).bind(this));if(this.opts.activeButtons){this.$editor.off("mouseup.redactor keyup.redactor focus.redactor");this.$editor.on("mouseup.redactor keyup.redactor focus.redactor",$.proxy(this.observe.buttons,this));this.$editor.on("keyup.redactor",$.proxy(this.keyup.init,this))}var c=false;this.$editor.on("mousedown.wmonkeypatch",(function(){c=true}).bind(this));$(document).on("mouseup.wmonkeypatch",(function(){if(c){c=false;this.wutil.saveSelection()}}).bind(this));var b=(function(d,e){if(e){if(d.previousElementSibling&&d.previousElementSibling.tagName==="P"){this.caret.setEnd(d.previousElementSibling)}else{this.wutil.setCaretBefore(d)}}else{if(d.nextElementSibling&&d.nextElementSibling.tagName==="P"){this.caret.setEnd(d.nextElementSibling)}else{this.wutil.setCaretAfter(d)}}}).bind(this);this.$editor.on("click.wmonkeypatch",(function(g){if(g.target===this.$editor[0]){var h=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(h&&h.collapsed){var f=h.startContainer;while(f!==null&&f!==this.$editor[0]){if(f.nodeType===Node.ELEMENT_NODE){if(f.tagName==="BLOCKQUOTE"||(f.tagName==="DIV"&&/\bcodeBox\b/.test(f.className))){var d=$(element).offset();if(g.pageY<=d.top){b(f,true)}else{b(f,false)}return false}}f=f.parentElement}}var e=this.$editor.children("blockquote, div.codeBox");e.each(function(l,m){var j=$(m);var i=j.offset();if(g.pageY<=i.top){b(m,true);return false}else{var k=j.outerHeight()+(parseInt(j.css("margin-bottom"),10)||0);if((g.pageY<=i.top+k)||(l+1)===e.length){b(m,false);return false}}});return false}}).bind(this))},alignment:function(){var a=this.alignment.setBlocks;this.alignment.setBlocks=(function(b){a.call(this,b);WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","fixFormatting_"+this.$textarea.wcfIdentify())}).bind(this)},button:function(){var a=this.button.addDropdown;this.button.addDropdown=(function(b,d){var c=a.call(this,b,d);if(!d){c.addClass("dropdownMenu")}return c}).bind(this)},caret:function(){this.caret.set=(function(g,f,d,b){if(!this.utils.browser("msie")){if(this.utils.isMobile()&&this.utils.browser("webkit")&&navigator.userAgent.match(/(iPad|iPhone|iPod)/i)){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}}else{this.$editor.focus()}}g=g[0]||g;d=d[0]||d;if(this.utils.isBlockTag(g.tagName)&&g.innerHTML===""){g.innerHTML=this.opts.invisibleSpace}if(g.tagName=="BR"&&this.opts.linebreaks===false){var a=$(this.opts.emptyHtml)[0];$(g).replaceWith(a);g=a;d=g}this.selection.get();try{this.range.setStart(g,f);this.range.setEnd(d,b)}catch(c){}this.selection.addRange()}).bind(this);this.caret.setOffset=(function(g,a){if(typeof a=="undefined"){a=g}if(!this.focus.isFocused()){this.focus.setStart()}var b=document.createRange();var d=document.getSelection();var c,f=0;var e=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);while(c=e.nextNode()){f+=c.nodeValue.length;if(f>g||(g===a&&f===g)){b.setStart(c,c.nodeValue.length+g-f);g=Infinity}if(f>=a){b.setEnd(c,c.nodeValue.length+a-f);break}}d.removeAllRanges();d.addRange(b)}).bind(this)},clean:function(){var c=function(e){e=e.replace(/\u201D/g,"__wcf_preserve_character_1__");e=e.replace(/\u201C/g,"__wcf_preserve_character_2__");e=e.replace(/\u2018/g,"__wcf_preserve_character_3__");e=e.replace(/\u2019/g,"__wcf_preserve_character_4__");return e};var b=function(e){e=e.replace(/__wcf_preserve_character_1__/g,"\u201D");e=e.replace(/__wcf_preserve_character_2__/g,"\u201C");e=e.replace(/__wcf_preserve_character_3__/g,"\u2018");e=e.replace(/__wcf_preserve_character_4__/g,"\u2019");return e};var d=this.clean.onPaste;this.clean.onPaste=(function(f,e){this.opts.replaceDivs=true;f=c(f);f=d.call(this,f,e);this.opts.replaceDivs=false;return b(f)}).bind(this);this.clean.onPasteRemoveEmpty=function(e){return e.replace(/<br\s?\/?>$/i,"")};var a=this.clean.onSet;this.clean.onSet=(function(e){e=c(e);e=a.call(this,e);return b(e)}).bind(this);this.clean.setVerified=(function(g){if(this.utils.browser("msie")){return g}g=g.replace(new RegExp("<img(.*?[^>])>","gi"),'<img$1 data-verified="redactor">');g=g.replace(new RegExp("<span(.*?)>","gi"),'<span$1 data-verified="redactor">');var j=g.match(new RegExp('<(span|img)(.*?)style="(.*?)"(.*?[^>])>',"gi"));if(j){var e=j.length;for(var f=0;f<e;f++){var h=j[f].replace(/style="(.*?)"/i,'style="$1" rel="$1"');g=g.replace(new RegExp(WCF.String.escapeRegExp(j[f]),"gi"),h)}}return g}).bind(this)},code:function(){var c=this.code.startSync;this.code.startSync=(function(){this.code.syncCode=undefined;c.call(this)}).bind(this);var b=this.code.textareaIndenting;this.code.textareaIndenting=(function(d){if(d.keyCode!==9||d.ctrlKey){return true}return b.call(this,d)}).bind(this);var a=this.code.showCode;this.code.showCode=(function(){var d=null;if(!this.$textarea.is(":visible")){d=this.$textarea.parentsUntil(":visible").last();d.show()}a.call(this);if(d!==null){d.hide()}}).bind(this)},dropdown:function(){this.dropdown.build=(function(c,e,d){e.addClass("dropdownMenu");$.each(d,(function(i,h){if(i=="dropdownDivider"){$('<li class="dropdownDivider" />').appendTo(e)}else{var g=$("<li />");var f=$('<a href="#" class="redactor-dropdown-'+i+'">'+h.title+"</a>");f.on("click",$.proxy(function(k){var j="func";var l=h.func;if(h.command){j="command";l=h.command}else{if(h.dropdown){j="dropdown";l=h.dropdown}}this.button.onClick(k,i,j,l)},this));f.appendTo(g);g.appendTo(e)}}).bind(this))}).bind(this);var a=this.dropdown.show;this.dropdown.show=$.proxy(function(f,c){var d=this.button.get(c).data("dropdown");b(d);if($.browser.iOS){this.wutil.saveSelection()}a.call(this,f,c);d.off("mouseover mouseout")},this);var b=function(f){if(f.hasClass("dropdownMenu")){return}f.addClass("dropdownMenu");var e=f.children("a").detach();for(var d=0;d<e.length;d++){var c=$("<li />").appendTo(f);c.append(e[d])}}},image:function(){var c=this.image.setEditable;this.image.setEditable=(function(d){if(!d.hasClass("smiley")){c.call(this,d)}}).bind(this);var b=this.image.loadEditableControls;this.image.loadEditableControls=(function(d){var e=b.call(this,d);if(d.hasClass("redactorDisableResize")&&e!==false){e.hide()}return e}).bind(this);this.image.show=(function(){this.modal.load("image",this.lang.get("image"),0);var d=this.modal.createActionButton(this.lang.get("insert"));d.click($.proxy(this.wbutton._insertImage,this));this.selection.save();this.modal.show()}).bind(this);this.image.showEdit=(function(d){this.modal.load("imageEdit",this.lang.get("edit"),0);this.image.buttonSave=this.modal.createActionButton(this.lang.get("save"));this.image.buttonSave.click((function(){this.image.update(d)}).bind(this));$("#redactor-image-link-source").val(d.attr("src"));$("#redactor-image-align").val(d.css("float"));this.modal.show()}).bind(this);var a=(function(e){var d=e.parent();e=e.detach();e.prependTo(d);this.caret.setAfter(e)}).bind(this);this.image.update=(function(d){this.image.hideResize();this.buffer.set();d.attr("src",$("#redactor-image-link-source").val());this.image.setFloating(d);a(d);this.modal.close();this.observe.images()}).bind(this)},inline:function(){var b=this.inline.format;this.inline.format=(function(c,d,e){if($.browser.iOS){this.wutil.restoreSelection()}b.call(this,c,d,e)}).bind(this);var a=this.inline.removeStyleRule;this.inline.removeStyleRule=(function(c){if($.browser.iOS){this.wuil.restoreSelection()}a.call(this,c)}).bind(this)},insert:function(){var c=($.browser.webkit||document.documentElement.style.hasOwnProperty("WebkitAppearance")||window.hasOwnProperty("chrome"));var a=(function(g){var f=this.$editor.html();if(this.utils.isEmpty(f)){var i=false;if(g.match(/^<(blockquote|div|p)/i)){this.$editor.empty();i=true}this.$editor.focus();if(!i){this.caret.setEnd(this.$editor.children("p:eq(0)"))}}else{if(document.activeElement!==this.$editor[0]){this.wutil.restoreSelection()}if(g.match(/^<(blockquote|div|p)/i)&&getSelection().getRangeAt(0).collapsed){var h=getSelection().getRangeAt(0).startContainer;if(h.nodeType===Node.TEXT_NODE&&h.textContent==="\u200b"){this.caret.setEnd($(h.parentElement).html("<br />"))}}}}).bind(this);var b=(function(){var f=false;this.$editor.find("span").each(function(){var g=$(this);if(g.data("verified")!=="redactor"){var h=$("<b>helper</b>").insertBefore(g);h.after(g.contents());h.remove();g.remove();f=true}});if(f){this.wutil.saveSelection()}}).bind(this);var e=this.insert.html;this.insert.html=(function(g,f){a(g);e.call(this,g,f);this.wutil.saveSelection();if(c){setTimeout(function(){b()},10)}}).bind(this);if(navigator.userAgent.match(/safari/i)){var d=this.insert.execHtml;this.insert.execHtml=(function(f){try{d.call(this,f)}catch(g){console.debug("[Redactor.wmonkeypatch] Suppressed error in Safari: "+g.message)}}).bind(this)}},keydown:function(){this.keydown.enterWithinBlockquote=false;var c=this.keydown.onTab;this.keydown.onTab=(function(g,d){var f=this.selection.getBlock();if(f&&f.tagName==="LI"){return c.call(this,g,d)}return true}).bind(this);var b=this.keydown.replaceDivToParagraph;this.keydown.replaceDivToParagraph=(function(){if(this.keydown.enterWithinBlockquote){this.keydown.enterWithinBlockquote=false}else{b.call(this)}}).bind(this);var a=this.keydown.setupBuffer;this.keydown.setupBuffer=(function(f,d){if(this.keydown.ctrl&&d===89&&!f.shiftKey&&!f.altKey&&this.opts.rebuffer.length!==0){f.preventDefault();this.buffer.redo();return}a.call(this,f,d)}).bind(this)},keyup:function(){var a=this.keyup.replaceToParagraph;this.keyup.replaceToParagraph=(function(b){if(this.keyup.current.tagName!=="DIV"||this.keyup.current.parentElement.tagName!=="BLOCKQUOTE"){a.call(this,b)}}).bind(this)},link:function(){var b=this.link.insert;this.link.insert=(function(){b.call(this);this.selection.get();var c=this.selection.getCurrent();if(c.nodeType===Node.TEXT_NODE){c=c.parentElement}if(c.tagName==="A"){this.caret.setAfter(c)}}).bind(this);var a=this.link.set;this.link.set=(function(f,d,e){a.call(this,f,d,e);if(f.length&&this.link.text!==f){this.selection.get();var c=this.selection.getCurrent();if(c.nodeType===Node.TEXT_NODE){c=c.parentElement}if(c.tagName==="A"){$(c).text(f)}}}).bind(this)},modal:function(){this.modal.dialog=null;var b=this.modal.addTemplate;this.modal.addTemplate=(function(c,d){if(c!=="table"){b.call(this,c,d)}}).bind(this);this.modal.build=function(){};this.modal.load=(function(c,e,d){this.modal.templateName=c;this.modal.title=e;this.modal.dialog=$("<div />").hide().appendTo(document.body);this.modal.dialog.html(this.modal.getTemplate(this.modal.templateName));this.$modalFooter=null}).bind(this);this.modal.show=(function(){this.modal.dialog.wcfDialog({onClose:$.proxy(this.modal.close,this),title:this.modal.title});this.modal.dialog.find("input:first").focus()}).bind(this);var a=this.modal.createButton;this.modal.createButton=(function(c,d){if(this.$modalFooter===null){this.$modalFooter=$('<div class="formSubmit" />').appendTo(this.modal.dialog);this.modal.dialog.addClass("dialogForm")}return a.call(this,c,d)}).bind(this);this.modal.close=(function(){if(this.modal.dialog===null){return}try{this.modal.dialog.wcfDialog("close")}catch(c){}finally{var d=this.modal.dialog.parents(".dialogContainer:eq(0)");if(d.length){setTimeout(function(){d.remove()},500)}}this.modal.dialog=null}).bind(this);this.modal.createCancelButton=function(){return $()};this.modal.createDeleteButton=function(){return $()}},observe:function(){var d=(function(j,e,h,f,i,k){var g=this.$toolbar.find(h);if(j&&j.closest(e,this.$editor[0]).length!=0){g[(f?"removeClass":"addClass")](i)}else{if(k&&!this.opts.visual){return}g[(f?"addClass":"removeClass")](i)}}).bind(this);var c=this.observe.buttons;this.observe.buttons=(function(g,h){c.call(this,g,h);var f=this.selection.getParent();f=(f===false)?null:$(f);d(f,"ul, ol","a.re-indent, a.re-outdent",true,"redactor-button-disabled");d(f,"blockquote.quoteBox","a.re-__wcf_quote",false,"redactor-button-disabled",true);d(f,"sub","a.re-subscript",false,"redactor-act");d(f,"sup","a.re-superscript",false,"redactor-act")}).bind(this);var a=this.observe.load;this.observe.load=(function(){a.call(this);WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","observe_load_"+this.$textarea.wcfIdentify())}).bind(this);var b=this.observe.showTooltip;this.observe.showTooltip=(function(g){var f=$(g.target);if(!f.hasClass("redactorQuoteEdit")){b.call(this,g)}}).bind(this)},paste:function(){var a=this.paste.insert;this.paste.insert=(function(b){a.call(this,b);setTimeout((function(){this.wutil.fixDOM();if($.browser.msie){getSelection().getRangeAt(0).collapse(false)}this.wutil.saveSelection()}).bind(this),20)}).bind(this)},selection:function(){this.selection.implicitRange=null;var a=(function(e,c){var b=c.nextSibling;if(b!==null&&b.nodeType===Node.TEXT_NODE&&b.length===0){$(b).remove()}var d=null;if((c.id==="selection-marker-1"&&!this.$editor.find("#selection-marker-2").length)||c.id==="nodes-marker-1"&&!this.$editor.find("#nodes-marker-2").length){d=c.previousSibling}$(c).remove();if(d!==null){this.selection.implicitRange=document.createRange();this.selection.implicitRange.setStart(d,d.length);this.selection.implicitRange.setEnd(d,d.length)}else{this.selection.implicitRange=null}}).bind(this);this.selection.removeMarkers=(function(){this.$editor.find("span.redactor-selection-marker").each(a)}).bind(this);this.selection.removeNodesMarkers=(function(){$(document).find("span.redactor-nodes-marker").each(a);this.$editor.find("span.redactor-nodes-marker").each(a)}).bind(this)},utils:function(){this.utils.removeEmpty=function(a,b){}},rebuildTemplates:function(){this.opts.modal.image='<fieldset id="redactor-modal-image-edit"><dl><dt><label for="redactor-image-link-source">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long" /></dd></dl><dl><dt><label for="redactor-image-align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor-image-align"><option value="none">'+WCF.Language.get("wcf.global.noSelection")+'</option><option value="left">'+this.lang.get("left")+'</option><option value="right">'+this.lang.get("right")+"</option></select></dd></dl></fieldset>";this.opts.modal.imageEdit=this.opts.modal.image;this.opts.modal.link='<fieldset id="redactor-modal-link"><dl><dt><label for="redactor-link-url" />URL</label></dt><dd><input type="url" id="redactor-link-url" class="long" /></dd></dl><dl><dt><label for="redactor-link-url-text">'+this.lang.get("text")+'</label></dt><dd><input type="text" id="redactor-link-url-text" class="long" /></dd></dl></fieldset>';this.opts.modal.quote='<fieldset><dl><dt><label for="redactorQuoteAuthor">'+WCF.Language.get("wcf.bbcode.quote.edit.author")+'</label></dt><dd><input type="text" id="redactorQuoteAuthor" class="long" /></dd></dl><dl><dt><label for="redactorQuoteLink">'+WCF.Language.get("wcf.bbcode.quote.edit.link")+'</label></dt><dd><input type="text" id="redactorQuoteLink" class="long" /></dd></dl></fieldset>';var a="";$.each(__REDACTOR_CODE_HIGHLIGHTERS,function(c,b){if(c==="plain"){return true}a+='<option value="'+c+'">'+b+"</option>"});this.opts.modal.code="<fieldset><legend>"+WCF.Language.get("wcf.bbcode.code.settings")+'</legend><dl><dt><label for="redactorCodeHighlighter">'+WCF.Language.get("wcf.bbcode.code.highlighter")+'</label></dt><dd><select id="redactorCodeHighlighter"><option value="plain">'+WCF.Language.get("wcf.bbcode.code.highlighter.none")+"</option>"+a+"</select><small>"+WCF.Language.get("wcf.bbcode.code.highlighter.description")+'</small></dd></dl><dl><dt><label for="redactorCodeLineNumber">'+WCF.Language.get("wcf.bbcode.code.lineNumber")+'</label></dt><dd><input type="number" id="redactorCodeLineNumber" min="1" max="99999" value="1" /><small>'+WCF.Language.get("wcf.bbcode.code.lineNumber.description")+'</small></dd></dl><dl><dt><label for="redactorCodeFilename">'+WCF.Language.get("wcf.bbcode.code.filename")+'</label></dt><dd><input type="text" id="redactorCodeFilename" value="" class="long" /><small>'+WCF.Language.get("wcf.bbcode.code.filename.description")+"</small></dd></dl></fieldset><fieldset><legend>"+WCF.Language.get("wcf.bbcode.code")+'</legend><dl class="wide"><dt></dt><dd><textarea id="redactorCodeBox" class="long" rows="12" /></dd></dl></fieldset>';this.opts.modal.table='<fieldset id="redactor-modal-table-insert"><dl><dt><label for="redactor-table-rows">'+this.lang.get("rows")+'</label></dt><dd><input type="number" size="5" value="2" min="1" id="redactor-table-rows" class="tiny" /></dd></dl><dl><dt><label for="redactor-table-columns">'+this.lang.get("columns")+'</label></dt><dd><input type="number" size="5" value="3" min="1" id="redactor-table-columns" class="tiny" /></dd></dl></fieldset>'},fixWebKit:function(){return;if(!$.browser.webkit&&!document.documentElement.style.hasOwnProperty("WebkitAppearance")&&!window.hasOwnProperty("chrome")){return}var a={fontSize:this.$editor.css("font-size"),lineHeight:this.$editor.css("line-height")};var c=this.$editor.wcfIdentify();var b=document.createElement("style");b.type="text/css";b.innerHTML="#"+c+" span { font-size: "+a.fontSize+"; line-height: "+a.lineHeight+" }";document.head.appendChild(b)}}};
// wupload.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wupload=function(){return{_boundGlobalUploadEvents:false,_dropArea:{},_timer:null,_isDragging:false,_isFile:false,init:function(){var a=".redactor_"+this.$textarea.wcfIdentify();$(document).on("dragover"+a,$.proxy(this.wupload._dragOver,this));$(document).on("dragleave"+a,$.proxy(this.wupload._dragLeave,this));$(document).on("drop"+a,(function(b){b.preventDefault();this.wupload._revertDropArea(undefined,this.$textarea.wcfIdentify())}).bind(this));if(!this.wupload._boundGlobalUploadEvents){this.wupload._boundGlobalUploadEvents=true;$(document).on("dragend",function(b){b.preventDefault()})}WCF.System.Event.addListener("com.woltlab.wcf.attachment","autoInsert_"+this.$textarea.wcfIdentify(),$.proxy(this.wupload.insertPastedImageAttachment,this))},_dragOver:function(d){d=d.originalEvent;if(!d.dataTransfer||!d.dataTransfer.types){return}var e=false;for(var c in d.dataTransfer){if(/^moz/.test(c)){e=true;break}}this.wupload._isFile=false;if(e){if(d.dataTransfer.types[0]==="application/x-moz-file"){this.wupload._isFile=true}}else{for(var g=0;g<d.dataTransfer.types.length;g++){if(d.dataTransfer.types[g]==="Files"){this.wupload._isFile=true;break}}}if(!this.wupload._isFile){return}this.wupload._isFile=true;d.preventDefault();if(!this.wupload._isDragging){var b=this.$textarea.wcfIdentify();if(this.wupload._dropArea[b]===undefined){this.wupload._dropArea[b]=$('<div class="redactorDropArea">'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"</div>").hide().appendTo(document.body);this.wupload._dropArea[b].on("dragover",$.proxy(this.wupload._hoverDropArea,this)).on("dragleave",$.proxy(this.wupload._revertDropArea,this)).on("drop",$.proxy(this.wupload._drop,this))}var a=(this.wutil.inWysiwygMode())?this.$editor.getDimensions("outer"):this.$textarea.getDimensions("outer");var f=(this.wutil.inWysiwygMode())?this.$editor.getOffsets("offset"):this.$textarea.getOffsets("offset");this.wupload._dropArea[b].css({height:a.height+"px",left:f.left+"px",lineHeight:a.height+"px",top:f.top+"px",width:a.width+"px"}).show();this.wupload._isDragging=true}d.preventDefault()},_hoverDropArea:function(a){this.wupload._dropArea[this.$textarea.wcfIdentify()].addClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropNow"))},_revertDropArea:function(c,a){if(!this.wupload._isFile){return}var b=a||this.$textarea.wcfIdentify();this.wupload._dropArea[b].removeClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropHere"));if(a){this.wupload._dropArea[b].hide()}},_dragLeave:function(){if(!this.wupload._isDragging||!this.wupload._isFile){return}if(this.wupload._timer===null){this.wupload._timer=new WCF.PeriodicalExecuter((function(a){a.stop();if(!this.wupload._isDragging){this.wupload._dropArea[this.$textarea.wcfIdentify()].hide()}}).bind(this),100)}else{this.wupload._timer.resume()}this.wupload._isDragging=false},_drop:function(b){if(!this.wupload._isFile){return}b=b.originalEvent||b;if(b.dataTransfer&&b.dataTransfer.files.length){b.preventDefault();var a=this.$textarea.wcfIdentify();this.wupload._revertDropArea(undefined,a);for(var c=0;c<b.dataTransfer.files.length;c++){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+a,{file:b.dataTransfer.files[c]})}}},pasteClipboardUploadMozilla:function(){this.$editor.find("img[data-mozilla-paste-image]").each($.proxy(function(d,g){var f=$(g);var a=f.prop("src").split(",");var e=a[0].split(";")[0].split(":")[1];var c=a[1];var b={blob:WCF.base64toBlob(c,e),uploadID:null};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+this.$textarea.wcfIdentify(),b);f.replaceWith('<span class="redactor-pastedImageFromClipboard-'+b.uploadID+'" />')},this))},insertPastedImageAttachment:function(b){var a=this.$editor.find("span.redactor-pastedImageFromClipboard-"+b.uploadID);a.before(b.attachment);a.remove()}}};
// wutil.js