// table.js
+
+// wbutton.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(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){window.addEventListener("unload",(function(l){this.code.startSync();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()))}).bind(this));if($.browser.msie){this.$editor.addClass("msie")}this.$textarea[0].setAttribute("data-is-dirty",true);var j=$.trim(this.wutil.getOption("woltlab.originalValue"));if(j.length){this.wutil.replaceText(j);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection();var k=this.$editor[0],i=this.$textarea[0];setTimeout(function(){if($.browser.iOS&&k.scrollHeight===0){if(document.activeElement===k||document.activeElement===i){document.activeElement.blur()}}},10)}).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){i=i.replace(/\u200C/g,"__wcf_zwnj__");i=i.replace(/\u200D/g,"__wcf_zwj__");if(a===true){a=false}else{i=i.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).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.wutil.fixDOM();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);if(/ Edge\//.test(navigator.userAgent)){var i=this.$editor[0];window.dtdesign=i;if(i.childElementCount>1&&i.children[0].innerHTML==="\u200b"){i.removeChild(i.children[0])}}this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(i){if(i.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}setTimeout(this.wutil.saveSelection.bind(this),10)}).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(j,i,e){if(e){this.wbbcode.registerSmiley(j,i)}if(this.opts.visual){this.wutil.restoreSelection();var f=null;if(window.getSelection().rangeCount&&window.getSelection().getRangeAt(0).collapsed){f=window.getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.TEXT_NODE){f=f.parentElement}if(!this.utils.isRedactorParent(f)){f=null}}this.insert.html('<img src="'+i+'" class="smiley" alt="'+j+'" id="redactorSmiley">',false);var b=document.getElementById("redactorSmiley");b.removeAttribute("id");if(f!==null){var d=window.getSelection().getRangeAt(0).startContainer;if(d.nodeType===Node.TEXT_NODE){d=d.parentElement}if(f!==d){f.appendChild(b)}}var h=function(k){if(k===null){return false}if((k.nodeType===Node.ELEMENT_NODE&&k.nodeName==="SPAN")||k.nodeType===Node.TEXT_NODE){if(k.textContent==="\u00A0"){return true}}return false};var g=b.parentElement;if(!h(b.previousSibling)){var c=document.createTextNode("\u00A0");g.insertBefore(c,b)}if(!h(b.nextSibling)){var c=document.createTextNode("\u00A0");if(g.lastChild===b){g.appendChild(c)}else{g.insertBefore(c,b.nextSibling)}}this.wutil.saveSelection()}else{this.wutil.insertAtCaret(" "+j+" ")}},registerSmiley:function(b,c){if(__REDACTOR_SMILIES[b]){return false}__REDACTOR_SMILIES[b]=c;return true},convertFromHtml:function(n){var w=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:n});n=n.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");n=n.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");n=n.replace(/&#(8203|x200b);/g,"");n=n.replace(/™/gi,"\u2122");n=n.replace(/©/gi,"\u00a9");n=n.replace(/…/gi,"\u2026");n=n.replace(/—/gi,"\u2014");n=n.replace(/‐/gi,"\u2010");var s={};n=n.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(F,D,C,E,B){var J=D+" "+C;var G="";var H="";if(J.match(/data-highlighter="([a-zA-Z]+)"/)){G=RegExp.$1}if(J.match(/data-filename="([^"]+)"/)){H=$.trim(RegExp.$1)}var I=WCF.getUUID();s[I]={codeContent:B.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:H.replace(/['"]/g,""),highlighter:(G==="plain"?"":G),lineNumber:(E>1?E:0)};return"@@@"+I+"@@@"});n=n.replace(/\r?\n/g,"");n=n.replace(/<a[^>]*?><\/a>/g,"");n=n.replace(/<p><\/p><table/g,"<table");n=n.replace(/<\/table><p><\/p>/g,"</table>");for(var A in s){n=n.replace(new RegExp("<p></p>@@@"+A+"@@@<p></p>"),"@@@"+A+"@@@")}n=n.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>");n=n.replace(/<br( \/)?><\/p>/g,"</p>");var h=n.split(/(<\/?(?:div|p)>)/);var i="";var y="";for(var b=0;b<h.length;b++){var z=h[b];if(z=="<p>"||z=="<div>"){continue}else{if(z=="</p>"||z=="</div>"){y=$.trim(y);if(y!="@@@wcf_empty_line@@@"){y+="\n"}i+=y;y=""}else{if(b==0||b+1==h.length){i+=z}else{y+=z}}}}if(y){i+=y;y=""}n=i;n=n.replace(/@@@wcf_empty_line@@@/g,"\n");n=n.replace(/\n\n$/,"\n");n=n.replace(/<br>$/,"");n=n.replace(/<br>/g,"\n");n=n.replace(/<br>/g,"");n=n.replace(/ /gi," ");n=n.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(D,C,F){var G;var E="";var B="";if(C.match(/data-author="([^"]+)"/)){E=WCF.String.unescapeHTML(RegExp.$1)}if(C.match(/cite="([^"]+)"/)){B=WCF.String.unescapeHTML(RegExp.$1)}if(B){G="[quote='"+E+"','"+B+"']"}else{if(E){G="[quote='"+E+"']"}else{G="[quote]"}}return G});n=n.replace(/(?:\n*)<\/blockquote>\n?/gi,"\n[/quote]\n");n=n.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");n=n.replace(/<a[^>]+><\/a>/,"");n=n.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(D,B,C,E){if(C==E){return"[url]"+C+"[/url]"}return"[url='"+C+"']"+E+"[/url]"});n=n.replace(/<(?:b|strong)>/gi,function(){if(w.indexOf("b")===-1){w.push("b")}return"[b]"});n=n.replace(/<\/(?:b|strong)>/gi,"[/b]");n=n.replace(/<(?:i|em)>/gi,function(){if(w.indexOf("i")===-1){w.push("i")}return"[i]"});n=n.replace(/<\/(?:i|em)>/gi,"[/i]");n=n.replace(/<u>/gi,function(){if(w.indexOf("u")===-1){w.push("u")}return"[u]"});n=n.replace(/<\/u>/gi,"[/u]");n=n.replace(/<sub>/gi,function(){if(w.indexOf("sub")===-1){w.push("sub")}return"[sub]"});n=n.replace(/<\/sub>/gi,"[/sub]");n=n.replace(/<sup>/gi,function(){if(w.indexOf("sup")===-1){w.push("sup")}return"[sup]"});n=n.replace(/<\/sup>/gi,"[/sup]");n=n.replace(/<(?:s(trike)?|del)>/gi,function(){if(w.indexOf("s")===-1){w.push("s")}return"[s]"});n=n.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var f=n.split(/(<\/?span[^>]*>)/);var y=[];var p=[];var q="";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=p.pop();var i=e.start+y.pop()+e.end;if(y.length){y[y.length-1]+=i}else{q+=i}}else{if(j.match(/^<span/)){if(j.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var l=RegExp.$1;var v;var o;if(l.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var u=RegExp.$1;var c=RegExp.$2;var g=RegExp.$3;var r=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((g-g%16)/16)+""+"0123456789ABCDEF".charAt(g%16));v="[color=#"+r+"]";o="[/color=#"+r+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/(?:^|;\s*)color: ?([^;]+);?/i)){v="[color="+RegExp.$1+"]";o="[/color="+RegExp.$1+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){v="[size="+RegExp.$1+"]";o="[/size="+RegExp.$1+"]";if(w.indexOf("size")===-1){w.push("size")}}else{if(d[RegExp.$1]){v="[size="+d[RegExp.$1]+"]";o="[/size="+d[RegExp.$1]+"]";if(w.indexOf("size")===-1){w.push("size")}}else{v="";o=""}}}else{if(l.match(/font-family: ?([^;]+);?/)){v="[font='"+RegExp.$1.replace(/'/g,"")+"']";o="[/font='"+RegExp.$1.replace(/'/g,"")+"']";if(w.indexOf("font")===-1){w.push("font")}}else{v='<span style="'+l+'">';o="</span>"}}}}y[y.length]="";p[y.length]={start:v,end:o}}else{if(j.match(/^<span class="inlineCode">/)){y[y.length]="";p[y.length]={start:"[tt]",end:"[/tt]"}}else{y[y.length]="";p[y.length]={start:"",end:""}}}}else{if(y.length){y[y.length-1]+=j}else{q+=j}}}}n=q;n=n.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(C,B,E,D){if(w.indexOf("align")===-1){w.push("align")}return"[align="+E+"]"+$.trim(D)+"[/align="+E+"]\n"});if(w.length){var m=true;while(m){m=false;n=n.replace(new RegExp("\\[\\/((?:"+w.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){m=true;return"\n"})}n=n.replace(new RegExp("\\[\\/("+w.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}n=n.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 ");n=n.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 ");n=n.replace(/<img([^>]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi,function(E,H,J){var K=H+" "+J;var G;if(K.match(/data-attachment-id="(\d+)"/)){G=RegExp.$1}else{return E}var D="none";var C=null;if(K.match(/style="([^"]+)"/)){var F=RegExp.$1.split(";");for(var I=0;I<F.length;I++){var B=$.trim(F[I]);if(B.match(/^float: (left|right)$/)){D=RegExp.$1}else{if(B.match(/^width: (\d+)px$/)){C=RegExp.$1}}}if(C!==null){return"[attach="+G+","+D+","+C+"][/attach]"}else{if(D!=="none"){return"[attach="+G+","+D+"][/attach]"}}}return"[attach="+G+"][/attach]"});n=n.replace(/<img([^>]*)?src=(["'])([^"']+?)\2([^>]*)?>/gi,function(G,I,M,C,L){var J=I+" "+L;var E="";if(J.match(/style="([^"]+)"/)){E=RegExp.$1}var F="none";var D=0;var H=E.split(";");for(var K=0;K<H.length;K++){var B=H[K];if(B.match(/float: (left|right|none)/)){F=RegExp.$1}else{if(B.match(/width: (\d+)px/)){D=parseInt(RegExp.$1)}}}if(D){return"[img='"+C+"',"+F+","+D+"][/img]"}else{if(F!=="none"){return"[img='"+C+"',"+F+"][/img]"}}return"[img]"+C+"[/img]"});n=n.replace(/<li>/gi,"[*]");n=n.replace(/<\/li>/gi,"\n");n=n.replace(/<ul>/gi,"[list]");n=n.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");n=n.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]");n=n.replace(/<\/(ul|ol)>/gi,"[/list]");n=n.replace(/\n?\[list\]/g,"\n[list]");n=n.replace(/\[\/list\]\n\[\*\]/g,"[/list][*]");n=n.replace(/\[\/list\]\n\[\/list\]/g,"[/list][/list]");n=n.replace(/<table[^>]*>/gi,"[table]\n");n=n.replace(/<\/table>\n?/gi,"[/table]\n");n=n.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(B,C){return $.trim(C)});n=n.replace(/<tr><\/tr>/gi,"");n=n.replace(/<tr>/gi,"[tr]\n");n=n.replace(/<\/tr>/gi,"[/tr]\n");n=n.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");n=n.replace(/(\t)*<td>(\t)*/gi,"[td]");n=n.replace(/(\t)*<\/td>/gi,"[/td]\n");var x={};n.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(B){var C=B.hashCode();x[C]=B.replace(/\$/g,"$$$$");return"@@"+C+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:n});n=n.replace(/<[^(<|>)]+>/g,"");if($.getLength(x)){for(var k in x){var t=new RegExp("@@"+k+"@@","g");n=n.replace(t,x[k])}}if($.getLength(s)){$.each(s,function(D,F){var C=0;if(F.highlighter){C++}if(F.lineNumber){C++}if(F.filename){C++}var B="";switch(C){case 1:if(F.highlighter){B=F.highlighter}else{if(F.filename){B="'"+F.filename+"'"}else{B=F.lineNumber}}break;case 2:if(F.lineNumber){B=F.lineNumber}if(F.highlighter){if(B.length){B+=","}B+=F.highlighter}if(F.filename){if(B.length){B+=","}B+="'"+F.filename+"'"}break;case 3:B=F.highlighter+","+F.lineNumber+",'"+F.filename+"'";break}var E="[code"+(B.length?"="+B:"")+"]"+F.codeContent+"[/code]\n";n=n.replace(new RegExp("@@@"+D+"@@@\n?","g"),E.replace(/\$/g,"$$$"))})}n=n.replace(/</g,"<");n=n.replace(/>/g,">");n=n.replace(/&/g,"&");n=n.replace(/%28/g,"(");n=n.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:n});n=$.trim(n);if(n.length){n+="\n"}return n},convertToHtml:function(I){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:I});I=this.wutil.removeZeroWidthSpace(I);I=I.replace(/&/g,"&");I=I.replace(/</g,"<");I=I.replace(/>/g,">");var u=[];var o=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");I=I.replace(o,function(J){var K=J.hashCode();u.push({key:K,value:J.replace(/\$/g,"$$$$")});return"@@"+K+"@@"});I=I.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\1\]/gi,"[$1]");I=I.replace(/\[(\/(?:b|i|s|sub|sup|u))\]\[\1\]/gi,"[$1]");I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\/\1\]/gi,"");I=I.replace(/\[b\]([\s\S]*?)\[\/b]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<strong>","</strong>")}).bind(this));I=I.replace(/\[i\]([\s\S]*?)\[\/i]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<em>","</em>")}).bind(this));I=I.replace(/\[u\]([\s\S]*?)\[\/u]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<u>","</u>")}).bind(this));I=I.replace(/\[s\]([\s\S]*?)\[\/s]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<del>","</del>")}).bind(this));I=I.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sub>","</sub>")}).bind(this));I=I.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sup>","</sup>")}).bind(this));I=I.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(K,L,M){var J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+L+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(K,M,N,L){var J="float: "+N+"; width: "+L+"px;";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+M+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(J,K,L){return this.wbbcode._expandFormatting(L,'<span style="font-size: '+K+'pt">',"</span>")}).bind(this));I=I.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="color: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="font-family: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,(function(J,L,K){return this.wbbcode._expandFormatting(K,'<p style="text-align: '+L+'">',"</p>")}).bind(this));var s=I.indexOf("[list");if(s>0){var h=I.substr(0,s);h=h.replace(/\[\*\]/g,"");I=h+I.substr(s)}var x=I.lastIndexOf("[/list]");if(x===-1){I=I.replace(/\[\*\]/g,"");I=I.replace(/\[list[^\]]*\]/g,"")}else{var h=I.substr(x+7);h=h.replace(/\[\*\]/g,"");I=I.substr(0,x+7)+h}I=I.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(J,K){return"<li>"+$.trim(K)+"</li>"});I=I.replace(/\n*(\[list\]<\/li>)/g,"$1");I=I.replace(/\[list\]/gi,"<ul>");I=I.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');I=I.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');I=I.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">');I=I.replace(/\[\/list\]/gi,"</ul>");I=I.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(J,K){return"[table]"+$.trim(K)+"[/table]"});I=I.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');I=I.replace(/\[\/table\](\n*)?/gi,function(J,K){if(K){if(K.match(/\n/g).length>2){K=K.replace(/^\n/,"")}return"</table>"+K}return"</table>"});I=I.replace(/\[tr\]\n*/gi,"<tr>");I=I.replace(/\[\/tr\]\n*/gi,"</tr>");I=I.replace(/\[td\]\n*/gi,"<td>");I=I.replace(/\[\/td\]\n*/gi,"</td>");I=I.replace(/<td>([\S\s]*?)<\/td>/gi,function(J,L){var K=$.trim(L);if(!K.length){K="​"}return"<td>"+K+"</td>"});var d=this.wutil.getOption("woltlab.attachmentUrl");var H=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(d){var F=this.wbbcode._getImageAttachments();I=I.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(J,K,L){K=parseInt(K);if(F[K]!==undefined){return'<img src="'+H.replace(/987654321/,K)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+K+'" />'}return J});I=I.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(K,L,M){L=parseInt(L);if(F[L]!==undefined){var J="";if(M==="left"||M==="right"){J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+H.replace(/987654321/,L)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+L+'"'+J+" />"}return K});I=I.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(K,M,N,L){M=parseInt(M);if(F[M]!==undefined){var J="width: "+L+"px; max-height: "+F[M].height+"px; max-width: "+F[M].width+"px;";if(N==="left"||N==="right"){J+="float: "+N+";";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+d.replace(/987654321/,M)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+M+'"'+J+" />"}return K})}for(var w in __REDACTOR_SMILIES){var k=w.replace(/</g,"<").replace(/>/g,">");var j=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(k)+"(?=\\s|<|$)","gi");I=I.replace(j,'$1<img src="'+__REDACTOR_SMILIES[w]+'" class="smiley" alt="'+k+'" />')}I=I.replace(/(javascript):/gi,"$1<span></span>:");I=I.replace(/(\r|\r\n)/g,"\n");var B=[];var E=[];var g=I.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var e=WCF.getUUID();while(true){var p=false;for(var b=0;b<g.length;b++){var D=g[b];if(D.toLowerCase()==="[/quote]"){p=true;var f="";var n=g.slice(0,b);var c=false;while(n.length){var C=n.pop();f=C+f;if(C.match(/^\[quote/i)){D=f+D;var m=WCF.getUUID();B.push({hashCode:m,content:D.replace(/\$/g,"$$$$")});E.push(m);D="@@"+m+"@@";c=true;break}}if(!c){n=g.slice(0,b);D=e}g=n.concat(D,g.slice(b+1));break}}if(!p){break}}I=g.join("");I=I.replace(new RegExp(e,"g"),"[/quote]");I=I.replace(/\n*$/,"");var y=[];I=I.replace(/(<li>[\s\S]*?<\/li>)/g,function(J){J=$.trim(J).replace(/\n/g,"<br>");var K=WCF.getUUID();y.push({key:K,content:J});return K});var h=I.split("\n");I="";for(var b=0,l=h.length;b<l;b++){var t=$.trim(h[b]);if(t.match(/^<([a-z]+)/)||t.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())||RegExp.$1.toUpperCase()==="TABLE"){if(t.match(/^<([a-z]+).*<\/\1>/)){I+=t}else{I+=t+"<br />"}}else{I+="<p>"+t+"</p>"}}else{if(!t){t="<br>"}else{if(t.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){I+=t;continue}}}I+="<p>"+t+"</p>"}}I=I.replace(/<td>([\s\S]+?)<\/td>/g,function(J,K){K=K.replace(/<br(?: \/)?>(<[uo]l)/g,"$1");return"<td>"+K.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"});if(y.length){for(var b=y.length-1;b>=0;b--){I=I.replace(y[b].key,y[b].content)}}if(B.length){var G=function(J){return J.replace(/^['"]/,"").replace(/['"]$/,"")};var r=this;var q=function(J){return J.replace(/\[quote(=(['"]).+?\2)?\]([\S\s]*)\[\/quote\]/gi,function(N,L,M,P){var T="";var O="";if(L){L=L.substr(1);L=L.split(",");switch(L.length){case 1:T=L[0];break;case 2:T=L[0];O=L[1];break}T=WCF.String.escapeHTML(G($.trim(T)));O=WCF.String.escapeHTML(G($.trim(O)))}var U='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+O+'" data-author="'+T+'"><header contenteditable="false"><h3>'+r.wbbcode._buildQuoteHeader(T,O)+'</h3><a class="redactorQuoteEdit"></a></header>';P=$.trim(P);var K="";if(P.length){var S=P.split("\n");for(var R=0;R<S.length;R++){var Q=S[R];if(Q.length===0){Q=r.opts.invisibleSpace}else{if(Q.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){K+=Q;continue}}}K+="<div>"+Q+"</div>"}}else{K="<div>"+r.opts.invisibleSpace+"</div>"}U+=K;U+="</blockquote>";return U})};for(var b=B.length-1;b>=0;b--){var v=B[b];var z=new RegExp("@@"+v.hashCode+"@@","g");I=I.replace(z,q(v.content))}}I=I.replace(/<(?:div|p)><(blockquote|div)/g,"<$1");I=I.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>");if(u.length){for(var b=u.length-1;b>=0;b--){var A=u[b];var z=new RegExp("@@"+A.key+"@@","g");var i=A.value;i=i.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,(function(J,L){var K=L.split("\n");L="";for(var O=0,N=K.length;O<N;O++){var M=K[O];if(M.length){if(L.length){L+="</p><p>"}L+="[tt]"+M+"[/tt]"}else{if(O===0||(O+1)===N){continue}if(L.match(/\[\/tt\]$/)){L+="</p><p>"+this.opts.invisibleSpace+""}else{L+="</p><p><br>"}}}return L}).bind(this));i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,(function(M,U,O){var N="plain";var S=0;var Q="";if(U){U=U.substring(1);U=U.split(",");var P=function(W){return W.match(/^\d+$/)};var L=function(W){return(W.indexOf(".")!==-1)||(W.match(/^(["']).*\1$/))};var K=function(W){return(__REDACTOR_CODE_HIGHLIGHTERS[W]!==undefined)};var J=function(W){return W.replace(/^(["'])(.*)\1$/,"$2")};switch(U.length){case 1:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0}else{if(L(U[0])){Q=J(U[0])}else{if(K(U[0])){N=U[0]}}}break;case 2:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0;if(K(U[1])){N=U[1]}else{if(L(U[1])){Q=J(U[1])}}}else{if(K(U[0])){N=U[0]}if(L(U[1])){Q=J(U[1])}}break;case 3:if(K(U[0])){N=U[0]}if(P(U[1])){S=U[1]}if(L(U[2])){Q=J(U[2])}break}}O=O.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var V="";for(var T=0;T<O.length;T++){var R=O[T];if(!R.length){R=this.opts.invisibleSpace}V+="<li>"+R+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+N+'"'+(Q?' data-filename="'+WCF.String.escapeHTML(Q)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'</h3></div><ol start="'+(S>1?S:1)+'">'+V+"</ol></div></div>"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i<h;i++){var g=d[i];if(g.length===0){g=this.opts.invisibleSpace}if(e.length){e+="\n"}e+=c+g+f}return e},_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]");if(/<p class="MsoNormal/.test(b)){b=b.replace(/([^>\s])\n([^<\s])/g,"$1 $2");b=b.replace(/<a name="[^"]+">/g,"")}b=b.replace(/<o:p> <\/o:p>/g,"<br>");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>");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");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>");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i<f;i++){var h=d[i];if(!h.match(/^\s*background-color/)){g.push(h)}}return'style="'+g.join(";")+'"'});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(x){switch(x.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 p=this.selection.getCurrent();var n=this.selection.getParent();n=(n)?$(n):n;var j=(n)?n.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(x.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var h=false;if(j.length){var k=true;for(var b=0;b<j[0].children.length;b++){var w=j[0].children[b];if(w.tagName==="DIV"){if(w.textContent.replace(/\u200b/,"").length){k=false;break}}}if(k){h=true}else{var m=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;if(m.startOffset===0){var d=m.startContainer,o;while((d=d.parentNode)!==null){o=d.previousSibling;if(o!==null){if(o.nodeType===Node.ELEMENT_NODE&&o.nodeName==="HEADER"){h=true}break}}}}}else{var f=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var q=f.startContainer;if(q.nodeType===Node.TEXT_NODE){if(f.startOffset===0||(f.startOffset===1&&q.textContent==="\u200b")){if(!q.previousSibling){q=q.parentElement}}}if(q.nodeType===Node.ELEMENT_NODE){var i=q.previousSibling;if(i&&i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BLOCKQUOTE"){j=i;h=true}}}if(h){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(j[0]||j);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(p)){var v=p.nextElementSibling;if(v&&v.tagName==="BLOCKQUOTE"){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(v);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DOWN:var e=$(p);if(e.next("blockquote").length){this.caret.setStart(e.next().children("div:first"));x.cancel=true}else{if(n){if(n.next("blockquote").length){this.caret.setStart(n.next().children("div:first"));x.cancel=true}else{if(j.length){var s=e.closest("div",j[0]);if(!s.next().length){if(j.next().length){this.caret.setStart(j.next())}else{this.wutil.setCaretAfter(j)}x.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(j.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!n||!j.length){return}var s=$(p).closest("div",j[0]);var u=s.prev();if(u[0].tagName==="DIV"){return}else{if(u[0].tagName==="BLOCKQUOTE"){return}}var l=j.prev();if(l.length===0){this.wutil.setCaretBefore(j)}else{if(l[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(l.children("div:last"))}else{if($.trim(l.html())==""){l.html(this.opts.invisibleSpace)}this.caret.setEnd(l)}}x.cancel=true;break;case 83:if($.browser.mobile||$.browser.touch){return}var c=false;if(navigator.platform.match(/^Mac/)){if(x.event.ctrlKey&&x.event.altKey){c=true}}else{if(x.event.altKey&&!x.event.ctrlKey){c=true}}if(c){var g={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),g);if(g.cancel){x.cancel=true}}break}},_keyupCallback:function(d){switch(d.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(h,j){var i=$(j);if(!i.children("header").length){i.remove()}});break;case $.ui.keyCode.ENTER:for(var g=0,f=this.$editor[0].children.length;g<f;g++){var c=this.$editor[0].children[g];if(c.nodeType!==Node.ELEMENT_NODE||c.tagName!=="P"){continue}if(c.textContent.length>0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},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){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("<div>"+this.opts.invisibleSpace+"</div>")}this.caret.setStart(h.children("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("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))}e=e.replace(/^<p>/,"").replace(/<\/p>$/,"");e=e.replace(/<blockquote/,'<blockquote id="'+o+'"');if(!window.getSelection().rangeCount){this.wutil.restoreSelection();if(!window.getSelection().rangeCount){this.$editor.focus();if(!window.getSelection().rangeCount){this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}}window.getSelection().getRangeAt(0).deleteContents();this.wutil.restoreSelection();var h=window.getSelection().getRangeAt(0);var b=h.startContainer;while(b){var f=b.parentNode;if(f===this.$editor[0]){break}b=f}if(b&&b.parentNode===this.$editor[0]){if(b.innerHTML.length){if(b.innerHTML==="\u200b"){this.caret.setEnd(b)}else{this.wutil.setCaretAfter(b)}}}this.insert.html(e,false);p=this.$editor.find("#"+o);if(p.length){var n=p.find("> div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="<br>")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+='<a href="'+d+'" tabindex="-1">'}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();if($.browser.mozilla){c=c.replace(/\r/g,"").replace(/\u200b/g,"");c=c.replace(/(\n+)/g,function(m,o){var n=o.match(/\n/g).length;n=~~(n/2);o="";while(n>0){o+="\n";n--}return o})}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+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}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.wutil.setCaretAfter(q[0]);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().replace(/^\u200b$/,"")+"\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(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},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 i=0,f=__REDACTOR_BUTTONS.length;i<f;i++){this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[i])}var d={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 e={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 c=this.wutil.getOption("buttons");var g="";for(var i=0,f=c.length;i<f;i++){var a=c[i];if(a=="separator"){this.button.get(g).parent().addClass("separator");continue}var h=this.button.get(a);if(h.length){if(d[a]){this.button.setAwesome(a,d[a])}if(a==="table"&&g){h.parent().insertAfter(this.button.get(g).parent())}}else{this.wbutton._addCoreButton(a,(e[a]?e[a]:null),(d[a]?d[a]:null),g)}g=a}this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this));if(this.utils.isDesktop()){var b=this.button.addAfter("html","undo",WCF.Language.get("wcf.bbcode.button.undo"));var j=this.button.addAfter("undo","redo",WCF.Language.get("wcf.bbcode.button.redo"));this.button.addCallback(b,this.buffer.undo);this.button.addCallback(j,this.buffer.redo);j.parent().addClass("separator")}},_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();c=c.replace(/<p>@@@wcf_empty_line@@@<\/p>/g,"<p><br></p>");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
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wfontcolor=function(){return{init:function(){var a=this.button.addDropdown(this.button.get("fontcolor"));this.wfontcolor._createDropdown(a)},_createDropdown:function(h){var b=["#000000","#800000","#8B4513","#2F4F4F","#008080","#000080","#4B0082","#696969","#B22222","#A52A2A","#DAA520","#006400","#40E0D0","#0000CD","#800080","#808080","#FF0000","#FF8C00","#FFD700","#008000","#00FFFF","#0000FF","#EE82EE","#A9A9A9","#FFA07A","#FFA500","#FFFF00","#00FF00","#AFEEEE","#ADD8E6","#DDA0DD","#D3D3D3","#FFF0F5","#FAEBD7","#FFFFE0","#F0FFF0","#F0FFFF","#F0F8FF","#E6E6FA","#FFFFFF"];var e=$('<li class="redactorColorPallet" />');for(var g=0,d=b.length;g<d;g++){var f=b[g];var c=$('<a href="#" title="'+f+'" />').data("color",f).css("background-color",f);e.append(c);c.click($.proxy(this.wfontcolor._onColorPick,this))}var a=$('<a href="#" />').html(this.lang.get("none")).data("color","none");a.click($.proxy(this.wfontcolor._onColorPick,this));e.appendTo(h);$('<li class="dropdownDivider" />').appendTo(h);a.appendTo(h);a.wrap("<li />")},_onColorPick:function(a){a.preventDefault();var b=$(a.currentTarget).data("color");if(b==="none"){this.inline.removeStyleRule("color")}else{this.inline.format("span","style","color: "+b+";")}}}};
// wfontfamily.js
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){window.addEventListener("unload",(function(l){this.code.startSync();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()))}).bind(this));if($.browser.msie){this.$editor.addClass("msie")}this.$textarea[0].setAttribute("data-is-dirty",true);var j=$.trim(this.wutil.getOption("woltlab.originalValue"));if(j.length){this.wutil.replaceText(j);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection();var k=this.$editor[0],i=this.$textarea[0];setTimeout(function(){if($.browser.iOS&&k.scrollHeight===0){if(document.activeElement===k||document.activeElement===i){document.activeElement.blur()}}},10)}).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){i=i.replace(/\u200C/g,"__wcf_zwnj__");i=i.replace(/\u200D/g,"__wcf_zwj__");if(a===true){a=false}else{i=i.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).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.wutil.fixDOM();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);if(/ Edge\//.test(navigator.userAgent)){var i=this.$editor[0];window.dtdesign=i;if(i.childElementCount>1&&i.children[0].innerHTML==="\u200b"){i.removeChild(i.children[0])}}this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(i){if(i.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}setTimeout(this.wutil.saveSelection.bind(this),10)}).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(j,i,e){if(e){this.wbbcode.registerSmiley(j,i)}if(this.opts.visual){this.wutil.restoreSelection();var f=null;if(window.getSelection().rangeCount&&window.getSelection().getRangeAt(0).collapsed){f=window.getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.TEXT_NODE){f=f.parentElement}if(!this.utils.isRedactorParent(f)){f=null}}this.insert.html('<img src="'+i+'" class="smiley" alt="'+j+'" id="redactorSmiley">',false);var b=document.getElementById("redactorSmiley");b.removeAttribute("id");if(f!==null){var d=window.getSelection().getRangeAt(0).startContainer;if(d.nodeType===Node.TEXT_NODE){d=d.parentElement}if(f!==d){f.appendChild(b)}}var h=function(k){if(k===null){return false}if((k.nodeType===Node.ELEMENT_NODE&&k.nodeName==="SPAN")||k.nodeType===Node.TEXT_NODE){if(k.textContent==="\u00A0"){return true}}return false};var g=b.parentElement;if(!h(b.previousSibling)){var c=document.createTextNode("\u00A0");g.insertBefore(c,b)}if(!h(b.nextSibling)){var c=document.createTextNode("\u00A0");if(g.lastChild===b){g.appendChild(c)}else{g.insertBefore(c,b.nextSibling)}}this.wutil.saveSelection()}else{this.wutil.insertAtCaret(" "+j+" ")}},registerSmiley:function(b,c){if(__REDACTOR_SMILIES[b]){return false}__REDACTOR_SMILIES[b]=c;return true},convertFromHtml:function(n){var w=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:n});n=n.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");n=n.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");n=n.replace(/&#(8203|x200b);/g,"");n=n.replace(/™/gi,"\u2122");n=n.replace(/©/gi,"\u00a9");n=n.replace(/…/gi,"\u2026");n=n.replace(/—/gi,"\u2014");n=n.replace(/‐/gi,"\u2010");var s={};n=n.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(F,D,C,E,B){var J=D+" "+C;var G="";var H="";if(J.match(/data-highlighter="([a-zA-Z]+)"/)){G=RegExp.$1}if(J.match(/data-filename="([^"]+)"/)){H=$.trim(RegExp.$1)}var I=WCF.getUUID();s[I]={codeContent:B.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:H.replace(/['"]/g,""),highlighter:(G==="plain"?"":G),lineNumber:(E>1?E:0)};return"@@@"+I+"@@@"});n=n.replace(/\r?\n/g,"");n=n.replace(/<a[^>]*?><\/a>/g,"");n=n.replace(/<p><\/p><table/g,"<table");n=n.replace(/<\/table><p><\/p>/g,"</table>");for(var A in s){n=n.replace(new RegExp("<p></p>@@@"+A+"@@@<p></p>"),"@@@"+A+"@@@")}n=n.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>");n=n.replace(/<br( \/)?><\/p>/g,"</p>");var h=n.split(/(<\/?(?:div|p)>)/);var i="";var y="";for(var b=0;b<h.length;b++){var z=h[b];if(z=="<p>"||z=="<div>"){continue}else{if(z=="</p>"||z=="</div>"){y=$.trim(y);if(y!="@@@wcf_empty_line@@@"){y+="\n"}i+=y;y=""}else{if(b==0||b+1==h.length){i+=z}else{y+=z}}}}if(y){i+=y;y=""}n=i;n=n.replace(/@@@wcf_empty_line@@@/g,"\n");n=n.replace(/\n\n$/,"\n");n=n.replace(/<br>$/,"");n=n.replace(/<br>/g,"\n");n=n.replace(/<br>/g,"");n=n.replace(/ /gi," ");n=n.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(D,C,F){var G;var E="";var B="";if(C.match(/data-author="([^"]+)"/)){E=WCF.String.unescapeHTML(RegExp.$1)}if(C.match(/cite="([^"]+)"/)){B=WCF.String.unescapeHTML(RegExp.$1)}if(B){G="[quote='"+E+"','"+B+"']"}else{if(E){G="[quote='"+E+"']"}else{G="[quote]"}}return G});n=n.replace(/(?:\n*)<\/blockquote>\n?/gi,"\n[/quote]\n");n=n.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");n=n.replace(/<a[^>]+><\/a>/,"");n=n.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(D,B,C,E){if(C==E){return"[url]"+C+"[/url]"}return"[url='"+C+"']"+E+"[/url]"});n=n.replace(/<(?:b|strong)>/gi,function(){if(w.indexOf("b")===-1){w.push("b")}return"[b]"});n=n.replace(/<\/(?:b|strong)>/gi,"[/b]");n=n.replace(/<(?:i|em)>/gi,function(){if(w.indexOf("i")===-1){w.push("i")}return"[i]"});n=n.replace(/<\/(?:i|em)>/gi,"[/i]");n=n.replace(/<u>/gi,function(){if(w.indexOf("u")===-1){w.push("u")}return"[u]"});n=n.replace(/<\/u>/gi,"[/u]");n=n.replace(/<sub>/gi,function(){if(w.indexOf("sub")===-1){w.push("sub")}return"[sub]"});n=n.replace(/<\/sub>/gi,"[/sub]");n=n.replace(/<sup>/gi,function(){if(w.indexOf("sup")===-1){w.push("sup")}return"[sup]"});n=n.replace(/<\/sup>/gi,"[/sup]");n=n.replace(/<(?:s(trike)?|del)>/gi,function(){if(w.indexOf("s")===-1){w.push("s")}return"[s]"});n=n.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var f=n.split(/(<\/?span[^>]*>)/);var y=[];var p=[];var q="";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=p.pop();var i=e.start+y.pop()+e.end;if(y.length){y[y.length-1]+=i}else{q+=i}}else{if(j.match(/^<span/)){if(j.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var l=RegExp.$1;var v;var o;if(l.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var u=RegExp.$1;var c=RegExp.$2;var g=RegExp.$3;var r=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((g-g%16)/16)+""+"0123456789ABCDEF".charAt(g%16));v="[color=#"+r+"]";o="[/color=#"+r+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/(?:^|;\s*)color: ?([^;]+);?/i)){v="[color="+RegExp.$1+"]";o="[/color="+RegExp.$1+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){v="[size="+RegExp.$1+"]";o="[/size="+RegExp.$1+"]";if(w.indexOf("size")===-1){w.push("size")}}else{if(d[RegExp.$1]){v="[size="+d[RegExp.$1]+"]";o="[/size="+d[RegExp.$1]+"]";if(w.indexOf("size")===-1){w.push("size")}}else{v="";o=""}}}else{if(l.match(/font-family: ?([^;]+);?/)){v="[font='"+RegExp.$1.replace(/'/g,"")+"']";o="[/font='"+RegExp.$1.replace(/'/g,"")+"']";if(w.indexOf("font")===-1){w.push("font")}}else{v='<span style="'+l+'">';o="</span>"}}}}y[y.length]="";p[y.length]={start:v,end:o}}else{if(j.match(/^<span class="inlineCode">/)){y[y.length]="";p[y.length]={start:"[tt]",end:"[/tt]"}}else{y[y.length]="";p[y.length]={start:"",end:""}}}}else{if(y.length){y[y.length-1]+=j}else{q+=j}}}}n=q;n=n.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(C,B,E,D){if(w.indexOf("align")===-1){w.push("align")}return"[align="+E+"]"+$.trim(D)+"[/align="+E+"]\n"});if(w.length){var m=true;while(m){m=false;n=n.replace(new RegExp("\\[\\/((?:"+w.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){m=true;return"\n"})}n=n.replace(new RegExp("\\[\\/("+w.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}n=n.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 ");n=n.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 ");n=n.replace(/<img([^>]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi,function(E,H,J){var K=H+" "+J;var G;if(K.match(/data-attachment-id="(\d+)"/)){G=RegExp.$1}else{return E}var D="none";var C=null;if(K.match(/style="([^"]+)"/)){var F=RegExp.$1.split(";");for(var I=0;I<F.length;I++){var B=$.trim(F[I]);if(B.match(/^float: (left|right)$/)){D=RegExp.$1}else{if(B.match(/^width: (\d+)px$/)){C=RegExp.$1}}}if(C!==null){return"[attach="+G+","+D+","+C+"][/attach]"}else{if(D!=="none"){return"[attach="+G+","+D+"][/attach]"}}}return"[attach="+G+"][/attach]"});n=n.replace(/<img([^>]*)?src=(["'])([^"']+?)\2([^>]*)?>/gi,function(G,I,M,C,L){var J=I+" "+L;var E="";if(J.match(/style="([^"]+)"/)){E=RegExp.$1}var F="none";var D=0;var H=E.split(";");for(var K=0;K<H.length;K++){var B=H[K];if(B.match(/float: (left|right|none)/)){F=RegExp.$1}else{if(B.match(/width: (\d+)px/)){D=parseInt(RegExp.$1)}}}if(D){return"[img='"+C+"',"+F+","+D+"][/img]"}else{if(F!=="none"){return"[img='"+C+"',"+F+"][/img]"}}return"[img]"+C+"[/img]"});n=n.replace(/<li>/gi,"[*]");n=n.replace(/<\/li>/gi,"\n");n=n.replace(/<ul>/gi,"[list]");n=n.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");n=n.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]");n=n.replace(/<\/(ul|ol)>/gi,"[/list]");n=n.replace(/\n?\[list\]/g,"\n[list]");n=n.replace(/\[\/list\]\n\[\*\]/g,"[/list][*]");n=n.replace(/\[\/list\]\n\[\/list\]/g,"[/list][/list]");n=n.replace(/<table[^>]*>/gi,"[table]\n");n=n.replace(/<\/table>\n?/gi,"[/table]\n");n=n.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(B,C){return $.trim(C)});n=n.replace(/<tr><\/tr>/gi,"");n=n.replace(/<tr>/gi,"[tr]\n");n=n.replace(/<\/tr>/gi,"[/tr]\n");n=n.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");n=n.replace(/(\t)*<td>(\t)*/gi,"[td]");n=n.replace(/(\t)*<\/td>/gi,"[/td]\n");var x={};n.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(B){var C=B.hashCode();x[C]=B.replace(/\$/g,"$$$$");return"@@"+C+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:n});n=n.replace(/<[^(<|>)]+>/g,"");if($.getLength(x)){for(var k in x){var t=new RegExp("@@"+k+"@@","g");n=n.replace(t,x[k])}}if($.getLength(s)){$.each(s,function(D,F){var C=0;if(F.highlighter){C++}if(F.lineNumber){C++}if(F.filename){C++}var B="";switch(C){case 1:if(F.highlighter){B=F.highlighter}else{if(F.filename){B="'"+F.filename+"'"}else{B=F.lineNumber}}break;case 2:if(F.lineNumber){B=F.lineNumber}if(F.highlighter){if(B.length){B+=","}B+=F.highlighter}if(F.filename){if(B.length){B+=","}B+="'"+F.filename+"'"}break;case 3:B=F.highlighter+","+F.lineNumber+",'"+F.filename+"'";break}var E="[code"+(B.length?"="+B:"")+"]"+F.codeContent+"[/code]\n";n=n.replace(new RegExp("@@@"+D+"@@@\n?","g"),E.replace(/\$/g,"$$$"))})}n=n.replace(/</g,"<");n=n.replace(/>/g,">");n=n.replace(/&/g,"&");n=n.replace(/%28/g,"(");n=n.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:n});n=$.trim(n);if(n.length){n+="\n"}return n},convertToHtml:function(I){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:I});I=this.wutil.removeZeroWidthSpace(I);I=I.replace(/&/g,"&");I=I.replace(/</g,"<");I=I.replace(/>/g,">");var u=[];var o=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");I=I.replace(o,function(J){var K=J.hashCode();u.push({key:K,value:J.replace(/\$/g,"$$$$")});return"@@"+K+"@@"});I=I.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\1\]/gi,"[$1]");I=I.replace(/\[(\/(?:b|i|s|sub|sup|u))\]\[\1\]/gi,"[$1]");I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\/\1\]/gi,"");I=I.replace(/\[b\]([\s\S]*?)\[\/b]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<strong>","</strong>")}).bind(this));I=I.replace(/\[i\]([\s\S]*?)\[\/i]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<em>","</em>")}).bind(this));I=I.replace(/\[u\]([\s\S]*?)\[\/u]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<u>","</u>")}).bind(this));I=I.replace(/\[s\]([\s\S]*?)\[\/s]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<del>","</del>")}).bind(this));I=I.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sub>","</sub>")}).bind(this));I=I.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sup>","</sup>")}).bind(this));I=I.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(K,L,M){var J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+L+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(K,M,N,L){var J="float: "+N+"; width: "+L+"px;";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+M+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(J,K,L){return this.wbbcode._expandFormatting(L,'<span style="font-size: '+K+'pt">',"</span>")}).bind(this));I=I.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="color: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="font-family: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,(function(J,L,K){return this.wbbcode._expandFormatting(K,'<p style="text-align: '+L+'">',"</p>")}).bind(this));var s=I.indexOf("[list");if(s>0){var h=I.substr(0,s);h=h.replace(/\[\*\]/g,"");I=h+I.substr(s)}var x=I.lastIndexOf("[/list]");if(x===-1){I=I.replace(/\[\*\]/g,"");I=I.replace(/\[list[^\]]*\]/g,"")}else{var h=I.substr(x+7);h=h.replace(/\[\*\]/g,"");I=I.substr(0,x+7)+h}I=I.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(J,K){return"<li>"+$.trim(K)+"</li>"});I=I.replace(/\n*(\[list\]<\/li>)/g,"$1");I=I.replace(/\[list\]/gi,"<ul>");I=I.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');I=I.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');I=I.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">');I=I.replace(/\[\/list\]/gi,"</ul>");I=I.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(J,K){return"[table]"+$.trim(K)+"[/table]"});I=I.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');I=I.replace(/\[\/table\](\n*)?/gi,function(J,K){if(K){if(K.match(/\n/g).length>2){K=K.replace(/^\n/,"")}return"</table>"+K}return"</table>"});I=I.replace(/\[tr\]\n*/gi,"<tr>");I=I.replace(/\[\/tr\]\n*/gi,"</tr>");I=I.replace(/\[td\]\n*/gi,"<td>");I=I.replace(/\[\/td\]\n*/gi,"</td>");I=I.replace(/<td>([\S\s]*?)<\/td>/gi,function(J,L){var K=$.trim(L);if(!K.length){K="​"}return"<td>"+K+"</td>"});var d=this.wutil.getOption("woltlab.attachmentUrl");var H=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(d){var F=this.wbbcode._getImageAttachments();I=I.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(J,K,L){K=parseInt(K);if(F[K]!==undefined){return'<img src="'+H.replace(/987654321/,K)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+K+'" />'}return J});I=I.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(K,L,M){L=parseInt(L);if(F[L]!==undefined){var J="";if(M==="left"||M==="right"){J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+H.replace(/987654321/,L)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+L+'"'+J+" />"}return K});I=I.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(K,M,N,L){M=parseInt(M);if(F[M]!==undefined){var J="width: "+L+"px; max-height: "+F[M].height+"px; max-width: "+F[M].width+"px;";if(N==="left"||N==="right"){J+="float: "+N+";";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+d.replace(/987654321/,M)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+M+'"'+J+" />"}return K})}for(var w in __REDACTOR_SMILIES){var k=w.replace(/</g,"<").replace(/>/g,">");var j=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(k)+"(?=\\s|<|$)","gi");I=I.replace(j,'$1<img src="'+__REDACTOR_SMILIES[w]+'" class="smiley" alt="'+k+'" />')}I=I.replace(/(javascript):/gi,"$1<span></span>:");I=I.replace(/(\r|\r\n)/g,"\n");var B=[];var E=[];var g=I.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var e=WCF.getUUID();while(true){var p=false;for(var b=0;b<g.length;b++){var D=g[b];if(D.toLowerCase()==="[/quote]"){p=true;var f="";var n=g.slice(0,b);var c=false;while(n.length){var C=n.pop();f=C+f;if(C.match(/^\[quote/i)){D=f+D;var m=WCF.getUUID();B.push({hashCode:m,content:D.replace(/\$/g,"$$$$")});E.push(m);D="@@"+m+"@@";c=true;break}}if(!c){n=g.slice(0,b);D=e}g=n.concat(D,g.slice(b+1));break}}if(!p){break}}I=g.join("");I=I.replace(new RegExp(e,"g"),"[/quote]");I=I.replace(/\n*$/,"");var y=[];I=I.replace(/(<li>[\s\S]*?<\/li>)/g,function(J){J=$.trim(J).replace(/\n/g,"<br>");var K=WCF.getUUID();y.push({key:K,content:J});return K});var h=I.split("\n");I="";for(var b=0,l=h.length;b<l;b++){var t=$.trim(h[b]);if(t.match(/^<([a-z]+)/)||t.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())||RegExp.$1.toUpperCase()==="TABLE"){if(t.match(/^<([a-z]+).*<\/\1>/)){I+=t}else{I+=t+"<br />"}}else{I+="<p>"+t+"</p>"}}else{if(!t){t="<br>"}else{if(t.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){I+=t;continue}}}I+="<p>"+t+"</p>"}}I=I.replace(/<td>([\s\S]+?)<\/td>/g,function(J,K){K=K.replace(/<br(?: \/)?>(<[uo]l)/g,"$1");return"<td>"+K.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"});if(y.length){for(var b=y.length-1;b>=0;b--){I=I.replace(y[b].key,y[b].content)}}if(B.length){var G=function(J){return J.replace(/^['"]/,"").replace(/['"]$/,"")};var r=this;var q=function(J){return J.replace(/\[quote(=(['"]).+?\2)?\]([\S\s]*)\[\/quote\]/gi,function(N,L,M,P){var T="";var O="";if(L){L=L.substr(1);L=L.split(",");switch(L.length){case 1:T=L[0];break;case 2:T=L[0];O=L[1];break}T=WCF.String.escapeHTML(G($.trim(T)));O=WCF.String.escapeHTML(G($.trim(O)))}var U='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+O+'" data-author="'+T+'"><header contenteditable="false"><h3>'+r.wbbcode._buildQuoteHeader(T,O)+'</h3><a class="redactorQuoteEdit"></a></header>';P=$.trim(P);var K="";if(P.length){var S=P.split("\n");for(var R=0;R<S.length;R++){var Q=S[R];if(Q.length===0){Q=r.opts.invisibleSpace}else{if(Q.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){K+=Q;continue}}}K+="<div>"+Q+"</div>"}}else{K="<div>"+r.opts.invisibleSpace+"</div>"}U+=K;U+="</blockquote>";return U})};for(var b=B.length-1;b>=0;b--){var v=B[b];var z=new RegExp("@@"+v.hashCode+"@@","g");I=I.replace(z,q(v.content))}}I=I.replace(/<(?:div|p)><(blockquote|div)/g,"<$1");I=I.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>");if(u.length){for(var b=u.length-1;b>=0;b--){var A=u[b];var z=new RegExp("@@"+A.key+"@@","g");var i=A.value;i=i.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,(function(J,L){var K=L.split("\n");L="";for(var O=0,N=K.length;O<N;O++){var M=K[O];if(M.length){if(L.length){L+="</p><p>"}L+="[tt]"+M+"[/tt]"}else{if(O===0||(O+1)===N){continue}if(L.match(/\[\/tt\]$/)){L+="</p><p>"+this.opts.invisibleSpace+""}else{L+="</p><p><br>"}}}return L}).bind(this));i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,(function(M,U,O){var N="plain";var S=0;var Q="";if(U){U=U.substring(1);U=U.split(",");var P=function(W){return W.match(/^\d+$/)};var L=function(W){return(W.indexOf(".")!==-1)||(W.match(/^(["']).*\1$/))};var K=function(W){return(__REDACTOR_CODE_HIGHLIGHTERS[W]!==undefined)};var J=function(W){return W.replace(/^(["'])(.*)\1$/,"$2")};switch(U.length){case 1:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0}else{if(L(U[0])){Q=J(U[0])}else{if(K(U[0])){N=U[0]}}}break;case 2:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0;if(K(U[1])){N=U[1]}else{if(L(U[1])){Q=J(U[1])}}}else{if(K(U[0])){N=U[0]}if(L(U[1])){Q=J(U[1])}}break;case 3:if(K(U[0])){N=U[0]}if(P(U[1])){S=U[1]}if(L(U[2])){Q=J(U[2])}break}}O=O.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var V="";for(var T=0;T<O.length;T++){var R=O[T];if(!R.length){R=this.opts.invisibleSpace}V+="<li>"+R+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+N+'"'+(Q?' data-filename="'+WCF.String.escapeHTML(Q)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'</h3></div><ol start="'+(S>1?S:1)+'">'+V+"</ol></div></div>"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i<h;i++){var g=d[i];if(g.length===0){g=this.opts.invisibleSpace}if(e.length){e+="\n"}e+=c+g+f}return e},_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]");if(/<p class="MsoNormal/.test(b)){b=b.replace(/([^>\s])\n([^<\s])/g,"$1 $2");b=b.replace(/<a name="[^"]+">/g,"")}b=b.replace(/<o:p> <\/o:p>/g,"<br>");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>");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");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>");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i<f;i++){var h=d[i];if(!h.match(/^\s*background-color/)){g.push(h)}}return'style="'+g.join(";")+'"'});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(x){switch(x.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 p=this.selection.getCurrent();var n=this.selection.getParent();n=(n)?$(n):n;var j=(n)?n.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(x.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var h=false;if(j.length){var k=true;for(var b=0;b<j[0].children.length;b++){var w=j[0].children[b];if(w.tagName==="DIV"){if(w.textContent.replace(/\u200b/,"").length){k=false;break}}}if(k){h=true}else{var m=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;if(m.startOffset===0){var d=m.startContainer,o;while((d=d.parentNode)!==null){o=d.previousSibling;if(o!==null){if(o.nodeType===Node.ELEMENT_NODE&&o.nodeName==="HEADER"){h=true}break}}}}}else{var f=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var q=f.startContainer;if(q.nodeType===Node.TEXT_NODE){if(f.startOffset===0||(f.startOffset===1&&q.textContent==="\u200b")){if(!q.previousSibling){q=q.parentElement}}}if(q.nodeType===Node.ELEMENT_NODE){var i=q.previousSibling;if(i&&i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BLOCKQUOTE"){j=i;h=true}}}if(h){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(j[0]||j);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(p)){var v=p.nextElementSibling;if(v&&v.tagName==="BLOCKQUOTE"){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(v);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DOWN:var e=$(p);if(e.next("blockquote").length){this.caret.setStart(e.next().children("div:first"));x.cancel=true}else{if(n){if(n.next("blockquote").length){this.caret.setStart(n.next().children("div:first"));x.cancel=true}else{if(j.length){var s=e.closest("div",j[0]);if(!s.next().length){if(j.next().length){this.caret.setStart(j.next())}else{this.wutil.setCaretAfter(j)}x.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(j.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!n||!j.length){return}var s=$(p).closest("div",j[0]);var u=s.prev();if(u[0].tagName==="DIV"){return}else{if(u[0].tagName==="BLOCKQUOTE"){return}}var l=j.prev();if(l.length===0){this.wutil.setCaretBefore(j)}else{if(l[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(l.children("div:last"))}else{if($.trim(l.html())==""){l.html(this.opts.invisibleSpace)}this.caret.setEnd(l)}}x.cancel=true;break;case 83:if($.browser.mobile||$.browser.touch){return}var c=false;if(navigator.platform.match(/^Mac/)){if(x.event.ctrlKey&&x.event.altKey){c=true}}else{if(x.event.altKey&&!x.event.ctrlKey){c=true}}if(c){var g={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),g);if(g.cancel){x.cancel=true}}break}},_keyupCallback:function(d){switch(d.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(h,j){var i=$(j);if(!i.children("header").length){i.remove()}});break;case $.ui.keyCode.ENTER:for(var g=0,f=this.$editor[0].children.length;g<f;g++){var c=this.$editor[0].children[g];if(c.nodeType!==Node.ELEMENT_NODE||c.tagName!=="P"){continue}if(c.textContent.length>0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},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){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("<div>"+this.opts.invisibleSpace+"</div>")}this.caret.setStart(h.children("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("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))}e=e.replace(/^<p>/,"").replace(/<\/p>$/,"");e=e.replace(/<blockquote/,'<blockquote id="'+o+'"');if(!window.getSelection().rangeCount){this.wutil.restoreSelection();if(!window.getSelection().rangeCount){this.$editor.focus();if(!window.getSelection().rangeCount){this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}}window.getSelection().getRangeAt(0).deleteContents();this.wutil.restoreSelection();var h=window.getSelection().getRangeAt(0);var b=h.startContainer;while(b){var f=b.parentNode;if(f===this.$editor[0]){break}b=f}if(b&&b.parentNode===this.$editor[0]){if(b.innerHTML.length){if(b.innerHTML==="\u200b"){this.caret.setEnd(b)}else{this.wutil.setCaretAfter(b)}}}this.insert.html(e,false);p=this.$editor.find("#"+o);if(p.length){var n=p.find("> div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="<br>")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+='<a href="'+d+'" tabindex="-1">'}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();if($.browser.mozilla){c=c.replace(/\r/g,"").replace(/\u200b/g,"");c=c.replace(/(\n+)/g,function(m,o){var n=o.match(/\n/g).length;n=~~(n/2);o="";while(n>0){o+="\n";n--}return o})}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+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}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.wutil.setCaretAfter(q[0]);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().replace(/^\u200b$/,"")+"\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(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},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.wfontfamily=function(){return{init:function(){var a=this.button.addDropdown(this.button.get("fontfamily"));this.wfontfamily._createDropdown(a)},_createDropdown:function(d){var c={Arial:"Arial, Helvetica, sans-serif","Comic Sans MS":"Comic Sans MS, cursive","Courier New":"Consolas, Courier New, Courier, monospace",Georgia:"Georgia, serif","Lucida Sans Unicode":"Lucida Sans Unicode, Lucida Grande, sans-serif",Tahoma:"Tahoma, Geneva, sans-serif","Times New Roman":"Times New Roman, Times, serif","Trebuchet MS":"Trebuchet MS, Helvetica, sans-serif",Verdana:"Verdana, Geneva, sans-serif"};var a=this;$.each(c,function(h,e){var g=$('<li><a href="#">'+h+"</a></li>").appendTo(d);var f=g.children("a").data("fontFamily",e).css("font-family",e);f.click(function(i){i.preventDefault();a.inline.format("span","style","font-family: "+$(this).data("fontFamily")+";")})});$('<li class="dropdownDivider" />').appendTo(d);var b=$('<li><a href="#">'+this.lang.get("none")+"</a></li>").appendTo(d);b.children("a").click(function(e){e.preventDefault();a.inline.removeStyleRule("font-family")})}}};
// wfontsize.js
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbutton=function(){return{_bbcodes:{},init:function(){this._bbcodes={};for(var i=0,f=__REDACTOR_BUTTONS.length;i<f;i++){this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[i])}var d={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 e={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 c=this.wutil.getOption("buttons");var g="";for(var i=0,f=c.length;i<f;i++){var a=c[i];if(a=="separator"){this.button.get(g).parent().addClass("separator");continue}var h=this.button.get(a);if(h.length){if(d[a]){this.button.setAwesome(a,d[a])}if(a==="table"&&g){h.parent().insertAfter(this.button.get(g).parent())}}else{this.wbutton._addCoreButton(a,(e[a]?e[a]:null),(d[a]?d[a]:null),g)}g=a}this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this));if(this.utils.isDesktop()){var b=this.button.addAfter("html","undo",WCF.Language.get("wcf.bbcode.button.undo"));var j=this.button.addAfter("undo","redo",WCF.Language.get("wcf.bbcode.button.redo"));this.button.addCallback(b,this.buffer.undo);this.button.addCallback(j,this.buffer.redo);j.parent().addClass("separator")}},_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();c=c.replace(/<p>@@@wcf_empty_line@@@<\/p>/g,"<p><br></p>");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
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.wfontcolor=function(){return{init:function(){var a=this.button.addDropdown(this.button.get("fontcolor"));this.wfontcolor._createDropdown(a)},_createDropdown:function(h){var b=["#000000","#800000","#8B4513","#2F4F4F","#008080","#000080","#4B0082","#696969","#B22222","#A52A2A","#DAA520","#006400","#40E0D0","#0000CD","#800080","#808080","#FF0000","#FF8C00","#FFD700","#008000","#00FFFF","#0000FF","#EE82EE","#A9A9A9","#FFA07A","#FFA500","#FFFF00","#00FF00","#AFEEEE","#ADD8E6","#DDA0DD","#D3D3D3","#FFF0F5","#FAEBD7","#FFFFE0","#F0FFF0","#F0FFFF","#F0F8FF","#E6E6FA","#FFFFFF"];var e=$('<li class="redactorColorPallet" />');for(var g=0,d=b.length;g<d;g++){var f=b[g];var c=$('<a href="#" title="'+f+'" />').data("color",f).css("background-color",f);e.append(c);c.click($.proxy(this.wfontcolor._onColorPick,this))}var a=$('<a href="#" />').html(this.lang.get("none")).data("color","none");a.click($.proxy(this.wfontcolor._onColorPick,this));e.appendTo(h);$('<li class="dropdownDivider" />').appendTo(h);a.appendTo(h);a.wrap("<li />")},_onColorPick:function(a){a.preventDefault();var b=$(a.currentTarget).data("color");if(b==="none"){this.inline.removeStyleRule("color")}else{this.inline.format("span","style","color: "+b+";")}}}};
+// wfontfamily.js
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wfontfamily=function(){return{init:function(){var a=this.button.addDropdown(this.button.get("fontfamily"));this.wfontfamily._createDropdown(a)},_createDropdown:function(d){var c={Arial:"Arial, Helvetica, sans-serif","Comic Sans MS":"Comic Sans MS, cursive","Courier New":"Consolas, Courier New, Courier, monospace",Georgia:"Georgia, serif","Lucida Sans Unicode":"Lucida Sans Unicode, Lucida Grande, sans-serif",Tahoma:"Tahoma, Geneva, sans-serif","Times New Roman":"Times New Roman, Times, serif","Trebuchet MS":"Trebuchet MS, Helvetica, sans-serif",Verdana:"Verdana, Geneva, sans-serif"};var a=this;$.each(c,function(h,e){var g=$('<li><a href="#">'+h+"</a></li>").appendTo(d);var f=g.children("a").data("fontFamily",e).css("font-family",e);f.click(function(i){i.preventDefault();a.inline.format("span","style","font-family: "+$(this).data("fontFamily")+";")})});$('<li class="dropdownDivider" />').appendTo(d);var b=$('<li><a href="#">'+this.lang.get("none")+"</a></li>").appendTo(d);b.children("a").click(function(e){e.preventDefault();a.inline.removeStyleRule("font-family")})}}};
+// wfontsize.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.indent();this.wmonkeypatch.inline();this.wmonkeypatch.insert();this.wmonkeypatch.keydown();this.wmonkeypatch.keyup();this.wmonkeypatch.link();this.wmonkeypatch.list();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(f){var e={cancel:false,event:f};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+a,e);return(e.cancel?false:true)});this.wutil.setOption("keyupCallback",(function(f){this.wutil.saveSelection();var e={cancel:false,event:f};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+a,e);return(e.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(e,f){if(f){if(e.previousElementSibling&&(e.previousElementSibling.tagName==="P"||e.previousElementSibling.tagName==="DIV")){this.caret.setEnd(e.previousElementSibling)}else{this.wutil.setCaretBefore(e)}}else{if(e.nextElementSibling&&(e.nextElementSibling.tagName==="P"||e.nextElementSibling.tagName==="DIV")){this.caret.setEnd(e.nextElementSibling)}else{this.wutil.setCaretAfter(e)}}}).bind(this);var d=null;this.$editor.on("click.wmonkeypatch",(function(f){if(f.target===this.$editor[0]){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(k&&k.collapsed){var g=k.startContainer;var m=this.$editor.offset();if(d===null){d={left:this.$editor.cssAsNumber("padding-left"),top:this.$editor.cssAsNumber("padding-top")}}if(f.pageY<=m.top+d.top){var j=this.$editor[0].children[0];if(j.tagName!=="BLOCKQUOTE"&&(j.tagName!=="DIV"||!/\bcodeBox\b/.test(j.className))){return}}else{if(f.pageX<=m.left+d.left){return}else{if(f.pageX>m.left+this.$editor.width()){return}}}while(g&&g!==this.$editor[0]){if(g.nodeType===Node.ELEMENT_NODE){if(g.tagName==="BLOCKQUOTE"||(g.tagName==="DIV"&&/\bcodeBox\b/.test(g.className))){var n=$(g).offset();if(f.pageY<=n.top){b(g,true)}else{b(g,false)}return false}}g=g.parentElement}}var l=this.$editor.children("blockquote, div.codeBox");l.each(function(r,s){var p=$(s);var o=p.offset();if(f.pageY<=o.top){b(s,true);return false}else{var q=p.outerHeight()+(parseInt(p.css("margin-bottom"),10)||0);if(f.pageY<=o.top+q){b(s,false);return false}}});return false}else{if(f.target.tagName==="LI"){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;var e=false;if(k!==null){if(!k.collapsed){return}var g=k.startContainer;while(g!==null&&g!==this.$editor[0]){if(g.tagName==="LI"){e=true;break}g=g.parentElement}}if(!e||k===null){var h=document.createTextNode("\u200b");var j=f.target.children[0];j.appendChild(h);this.caret.setEnd(j)}}else{if(f.target.tagName==="BLOCKQUOTE"){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(k!==null&&k.collapsed){var i=null;var g=(k.startContainer.nodeType===Node.TEXT_NODE)?k.startContainer.parentElement:k.startContainer;while(g!==null&&g!==this.$editor[0]){if(g.tagName==="BLOCKQUOTE"){i=g;break}g=g.parentElement}if(i!==null&&i!==f.target){if(f.pageY<=$(i).offset().top){b(i,true)}else{b(i,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 d=function(f){f=f.replace(/\u201D/g,"__wcf_preserve_character_1__");f=f.replace(/\u201C/g,"__wcf_preserve_character_2__");f=f.replace(/\u2018/g,"__wcf_preserve_character_3__");f=f.replace(/\u2019/g,"__wcf_preserve_character_4__");return f};var c=function(f){f=f.replace(/__wcf_preserve_character_1__/g,"\u201D");f=f.replace(/__wcf_preserve_character_2__/g,"\u201C");f=f.replace(/__wcf_preserve_character_3__/g,"\u2018");f=f.replace(/__wcf_preserve_character_4__/g,"\u2019");return f};var e=this.clean.onPaste;this.clean.onPaste=(function(g,f){this.opts.replaceDivs=true;g=d(g);g=e.call(this,g,f);this.opts.replaceDivs=false;return c(g)}).bind(this);this.clean.onPasteRemoveEmpty=function(f){return f.replace(/<br\s?\/?>$/i,"")};var a=this.clean.removeSpaces;this.clean.removeSpaces=(function(f){f=f.replace(/\u200C/g,"__wcf_zwnj__");f=f.replace(/\u200D/g,"__wcf_zwj__");f=a.call(this,f);f=f.replace(/__wcf_zwnj__/g,"\u200C");return f.replace(/__wcf_zwj__/g,"\u200D")});var b=this.clean.onSet;this.clean.onSet=(function(f){f=d(f);f=b.call(this,f);return c(f)}).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){k.preventDefault();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.dropdown.hideAll()},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")){return}d.off("click.redactor touchstart.redactor");c.call(this,d)}).bind(this);var b=this.image.loadEditableControls;this.image.loadEditableControls=(function(d){if(d[0].parentNode.id==="redactor-image-box"){return $("#redactor-image-resizer",this.$editor[0])}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));$("#redactorImageLinkHrefContainer").hide();this.selection.save();this.modal.show()}).bind(this);this.image.showEdit=(function(e){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(e)}).bind(this));var d=e.closest("a",this.$editor[0]);$("#redactor-image-link-source").val(e.attr("src"));$("#redactor-image-link-href").val(d.length?d.attr("href"):"");$("#redactor-image-align").val(e.css("float"));this.modal.show();setTimeout(function(){$(".redactor-link-tooltip").remove()},1)}).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(h){this.image.hideResize();this.buffer.set();h.attr("src",$("#redactor-image-link-source").val());this.image.setFloating(h);a(h);var g=$("#redactor-image-link-href").val().trim();var d=h.closest("a",this.$editor[0]);if(d.length){if(g===""){d=d[0];var e=d.children.length,f=d.parentNode;while(e--){f.insertBefore(d.children[0],d)}f.removeChild(d)}else{d.attr("href",g)}}else{if(g!==""){d=document.createElement("a");d.href=g;h[0].parentNode.insertBefore(d,h[0]);d.appendChild(h[0])}}this.modal.close();this.observe.images()}).bind(this)},indent:function(){var a=this.indent.increase;this.indent.increase=(function(){var b=this.selection.getBlock();if(b&&b.tagName==="LI"){if(b.parentElement.firstChild!==b){a.call(this)}}}).bind(this)},inline:function(){var c=(function(e,d){var f=e.parent();while(f[0]!==this.$editor[0]){if(f.children(":not(.redactor-selection-marker)").length>1){break}if(f[0].tagName==="SPAN"&&f[0].style.getPropertyValue(d)){f.contents().unwrap();break}f=f.parent()}}).bind(this);var b=this.inline.format;this.inline.format=(function(d,e,f){if($.browser.iOS){this.wutil.restoreSelection()}b.call(this,d,e,f)}).bind(this);var a=this.inline.removeStyleRule;this.inline.removeStyleRule=(function(d){if($.browser.iOS){this.wuil.restoreSelection()}a.call(this,d)}).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(i,e,g){if(/\sEdge\//.test(window.navigator.userAgent)){i=$.trim(i.replace(/<|>/g,""));this.selection.restore();var h=this.selection.getBlocks();if(i===""&&e===""){return}if(i===""&&e!==""){i=e}if(!this.link.$node){var f=$('<a href="'+e+'">').text(i);if(g!==""){f.attr("target",g)}f=$(this.insert.node(f));if(this.selection.getText().match(/\s$/)){f.after(" ")}this.selection.selectElement(f);this.code.sync();this.core.setCallback("insertedLink",f)}else{a.call(this,i,e,g)}}else{a.call(this,i,e,g)}var d=window.getSelection();if(d.rangeCount){var c=d.getRangeAt(0);if(!c.collapsed){c.collapse(false);this.wutil.saveSelection()}}}).bind(this)},list:function(){var a=this.list.insert;this.list.insert=(function(e){var d=window.getSelection();if(d.rangeCount){var b=d.getRangeAt(0);if(b.collapsed){var c=b.startContainer;if(c.nodeType===Node.TEXT_NODE){c=c.parentNode}if(c.nodeName==="DIV"){if(c.parentNode.nodeName==="BLOCKQUOTE"){var f=document.createElement("div");c.parentNode.insertBefore(f,c);f.appendChild(c)}}}}a.call(this,e)}).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{if(this.modal.dialog){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.createPasteBox;this.paste.createPasteBox=(function(){if($.browser.iOS){var e=0;if(window.getSelection().rangeCount){var d=window.getSelection().getRangeAt(0).endContainer;if(d.nodeType!==Node.ELEMENT_NODE){d=d.parentElement}d=$(d);e=$(d).offset().top}else{e=$(window).scrollTop()}this.$pasteBox=$("<div>").html("").attr("contenteditable","true").css({position:"fixed",top:e+"px",fontSize:"16px"});this.$box.parent().append(this.$pasteBox);this.$pasteBox.focus()}else{a.call(this)}}).bind(this);var c=function(){var d=window.getSelection();if(!d.rangeCount){return}var i=d.getRangeAt(0);if(!i.collapsed){return}var f=i.startContainer;if(f.nodeType===Node.ELEMENT_NODE&&f.tagName==="DIV"){var h=f.parentNode;if(h!==null&&h.tagName==="BLOCKQUOTE"&&h.classList.contains("quoteBox")){var g=i.startContainer.childNodes[i.startContainer.childNodes.length-1];var e=document.createRange();e.setStart(i.startContainer.childNodes[0],0);e.setEnd(g,g.length);e.collapse(false);d.removeAllRanges();d.addRange(e)}}};var b=this.paste.insert;this.paste.insert=(function(d){c();b.call(this,d);setTimeout((function(){this.wutil.fixDOM();if($.browser.msie){getSelection().getRangeAt(0).collapse(false)}else{if($.browser.mozilla){var e=getSelection().getRangeAt(0);if(e.startContainer===this.$editor[0]&&e.endContainer===this.$editor[0]){this.wutil.selectionEndOfEditor()}}}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}if($.browser.iOS&&c.innerHTML.length){c.outerHTML=c.innerHTML}else{c.parentNode.removeChild(c)}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">'+WCF.Language.get("wcf.bbcode.image.source")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long" /></dd></dl><dl id="redactorImageLinkHrefContainer"><dt><label for="redactor-image-link-href">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-href" 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 monospace" 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.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.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(!this.$editor.is(":visible")){return}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
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil=function(){var c="";var d=null;var a=false;var b=false;var e=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var f=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();f.call(this)}).bind(this)},saveSelection:function(g){var f=getSelection();if(f.rangeCount){this.wutil._range=f.getRangeAt(0)}else{if(g){this.wutil._range=null}}},restoreSelection:function(){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}if(this.wutil._range!==null){var f=window.getSelection();f.removeAllRanges();f.addRange(this.wutil._range);this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(g){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var h=this.$textarea.getCaret();if(h==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var f=this.$textarea.val();f=f.substr(0,h)+g+f.substr(h);this.$textarea.val(f);return true},insertDynamic:function(f,g){if(this.wutil.inWysiwygMode()){this.insert.html(f,false)}else{if(g===undefined||g===null){g=f}this.wutil.insertAtCaret(g)}},setOption:function(f,g){if(f.indexOf(".")!==-1){f=f.split(".",2);this.opts[f[0]][f[1]]=g}else{this.opts[f]=g}},getOption:function(f){if(f.indexOf(".")!==-1){f=f.split(".",2);if(this.opts[f[0]][f[1]]){return this.opts[f[0]][f[1]]}}else{if(this.opts[f]){return this.opts[f]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(f){getSelection().removeAllRanges();getSelection().addRange(f)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(f)))}var g=$.trim(this.$textarea.val());g=this.wutil._removeSuperfluousNewlines(g);return g},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));f=this.wutil._removeSuperfluousNewlines(f);this.$textarea.val(f)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",f);return f.text},addNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",f);return f.text},reset:function(){if(this.opts.visual){this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>");this.wutil.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(f){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:f})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter((function(g){this.wutil.saveTextToStorage(false)}).bind(this),15*1000)}return true},saveTextToStorage:function(g){var f=this.wutil.getText();if(c==f&&!g){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:f,timestamp:Date.now()}));c=f;a=true;if(e===null){e=new WCF.PeriodicalExecuter((function(i){if(b===true){return}if(a===false){i.stop();e=null;return}this.wutil.autosaveShowNotice("saved");a=false}).bind(this),120*1000)}}catch(h){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+h.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(f){console.debug("[wutil.autosavePurge] Unable to access local storage: "+f.message)}},autosaveRestore:function(){var f=this.wutil.getOption("woltlab.autosave");var g=null;try{g=localStorage.getItem(f.key)}catch(h){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+h.message)}try{g=(g===null)?null:JSON.parse(g)}catch(h){g=null}if(g===null||!g.content){return false}if(f.lastEditTime&&(f.lastEditTime*1000)>g.timestamp){this.wutil.autosavePurge();return false}if(f.prompt){this.wutil.autosaveShowNotice("prompt",g);return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",g.content)}else{this.$textarea.val(g.content)}this.wutil.autosaveShowNotice("restored",{timestamp:g.timestamp});return true},autosaveShowNotice:function(j,l){if(d===null){d=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>');d.appendTo(this.$box);var h=(function(m){if(m!==null&&m.originalEvent.propertyName!=="opacity"){return}if(d.hasClass("open")&&m!==null){if(d.data("callbackOpen")){d.data("callbackOpen")()}}else{if(d.data("callbackClose")){d.data("callbackClose")()}d.removeData("callbackClose");d.removeData("callbackOpen");d.removeClass("redactorAutosaveNoticeIcons");d.empty();$('<span class="redactorAutosaveMessage" />').appendTo(d)}}).bind(this);d.on("transitionend webkitTransitionEnd",h)}var i="";switch(j){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(l.timestamp).toLocaleString()})+'"></span>').prependTo(d);var k=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(d);var f=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').appendTo(d);k.click((function(){this.wutil.replaceText(l.content);h(null);this.wutil.autosaveShowNotice("restored",l)}).bind(this));f.click((function(){this.wutil.autosavePurge();d.removeClass("open")}).bind(this));i=WCF.Language.get("wcf.message.autosave.prompt");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){d.removeClass("open")},3000)}).bind(this));break;case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(l.timestamp).toLocaleString()})+'"></span>').prependTo(d);var k=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(d);var f=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(d);k.click(function(){d.removeClass("open")});f.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(m){if(m==="confirm"){this.wutil.reset();this.wutil.autosavePurge();d.removeClass("open")}}).bind(this))}).bind(this));i=WCF.Language.get("wcf.message.autosave.restored");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){k.trigger("click")},3000)}).bind(this));break;case"saved":if(d.hasClass("open")){return}setTimeout(function(){d.removeClass("open")},2000);i=WCF.Language.get("wcf.message.autosave.saved");break}d.children("span.redactorAutosaveMessage").text(i);d.addClass("open");if(j!=="saved"){WCF.DOMNodeInsertedHandler.execute()}},autosavePurgeOutdated:function(){var j=0;var m=this.wutil.getOption("woltlab.autosave").prefix;var l=m+"_wcf_master";try{j=localStorage.getItem(l)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}if(j===0){return}var f=Date.now()-(7*24*3600*1000);if(j===null||j<f){var i=new RegExp("^"+m+"_");for(var h in localStorage){if(h.match(i)&&h!==l){var g=localStorage.getItem(h);try{g=JSON.parse(g)}catch(k){g={timestamp:0}}if(g===null||!g.timestamp||g.timestamp<f){try{localStorage.removeItem(h)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}}}}try{localStorage.setItem(l,Date.now())}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}}},autosavePause:function(){b=true},autosaveResume:function(){b=false},buttonReplace:function(i,g,j,l,k){var f=this.buttonGet(i);var h=this.buttonAddAfter(i,g,j,l,k);if(f.parent().hasClass("separator")){h.parent().addClass("separator")}f.parent().remove();return h},removeZeroWidthSpace:function(f){var g="";for(var j=0,i=f.length;j<i;j++){var h=f.charCodeAt(j).toString(16);if(h!="200b"){g+=f[j]}}return g},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var f=this.$editor.children(":last")[0];if(f.tagName==="P"){if(f.innerHTML===""){f.remove();f=$(this.opts.emptyHtml).appendTo(this.$editor)[0]}if(f.lastChild.nodeType===Element.TEXT_NODE){this.caret.set(f.lastChild,f.lastChild.length,f.lastChild,f.lastChild.length)}else{this.caret.setEnd(f)}}else{this.wutil.setCaretAfter(f)}this.wutil.saveSelection()},adjustSelectionForBlockElement:function(){if(document.activeElement!==this.$editor[0]){this.wutil.restoreSelection()}if(getSelection().getRangeAt(0).collapsed){var g=getSelection().getRangeAt(0).startContainer;if(g.nodeType===Node.TEXT_NODE&&g.textContent==="\u200b"&&g.parentElement&&g.parentElement.tagName==="P"&&g.parentElement.parentElement===this.$editor[0]){return}else{var f=$(g).parentsUntil(this.$editor[0]).last();if(f[0]===document.body.parentElement){this.wutil.selectionEndOfEditor()}else{this.caret.setAfter(f)}}}},isCaret:function(){this.selection.get();return this.range.collapsed},isEndOfElement:function(f){var h=this.selection.implicitRange;if(h===null){this.selection.get();h=this.range}if(!this.wutil.isCaret()){return false}if(h.endContainer.nodeType===Element.TEXT_NODE){if(h.endOffset<h.endContainer.length){return false}}if(!this.wutil.isNodeWithin(h.endContainer,f)){return false}var g=h.endContainer;while(g!==f){if(g.nextSibling){return false}g=g.parentNode}return true},isNodeWithin:function(g,f){while(g&&g!==this.$editor[0]){if(g===f){return true}g=g.parentNode}return false},containsTag:function(g,f){switch(g.nodeType){case Element.ELEMENT_NODE:if(g.tagName===f){return true}case Element.DOCUMENT_FRAGMENT_NODE:for(var h=0;h<g.childNodes.length;h++){if(this.wutil.containsTag(g.childNodes[h],f)){return true}}return false;break;default:return false;break}},replaceText:function(h){var i=$(document);var f=i.scrollTop();var g=false;if(this.wutil.inWysiwygMode()){this.code.toggle();g=true}h=this.wutil.addNewlines(h);this.$textarea.val(h);if(g){this.code.toggle();i.scrollTop(f)}i.trigger("resize")},setCaretBefore:function(f){this.wutil._setCaret(f,true)},setCaretAfter:function(f){this.wutil._setCaret(f,false)},_setCaret:function(g,h){var f;if((g[0]||g).parentElement&&(g[0]||g).parentElement.tagName==="BLOCKQUOTE"){f=$("<div>"+this.opts.invisibleSpace+"</div>")}else{f=$("<p>"+this.opts.invisibleSpace+"</p>")}f[(h?"insertBefore":"insertAfter")](g);this.caret.setEnd(f[0])},fixDOM:function(){var f=this.$editor[0].childNodes[0];var j=f;var m=null;while(j){f=j;j=f.nextSibling;if(f.nodeType===Element.ELEMENT_NODE){if(this.reIsBlock.test(f.tagName)){m=null}else{if(m===null){m=$("<p />").insertBefore(f)}m.append(f)}}else{if(f.nodeType===Element.TEXT_NODE){if(m===null){if(j){if(j.nodeType===Element.ELEMENT_NODE&&j.tagName==="P"&&j.innerHTML==="\u200B"){var l=j.nextSibling;this.$editor[0].removeChild(j);j=l}}m=$("<p />").insertBefore(f)}m.append(f)}}}var i=this.$editor[0].getElementsByTagName("li");for(var q=0,o=i.length;q<o;q++){var n=i[q];if(!n.innerHTML.length){var k=n.parentElement;if(k.children.length>1){n.parentElement.removeChild(n);q--;o--}}}for(var q=0,o=this.$editor[0].children.length;q<o;q++){var h=this.$editor[0].children[q];if(h.nodeType!==Node.ELEMENT_NODE||h.tagName!=="P"){continue}if(h.innerHTML==="\n"){h.parentElement.removeChild(h);q--;o--;continue}if(h.textContent.length>0){continue}if(h.children.length>1||(h.children.length===1&&h.children[0].tagName==="BR")){continue}while(h.children.length===1){h=h.children[0]}if(h.childNodes.length===0&&h.tagName!=="BR"){var g=document.createTextNode("\u200b");h.appendChild(g)}}var p=this.$editor[0].getElementsByTagName("INPUT");while(p.length){p[0].parentNode.removeChild(p[0])}}}};
+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.indent();this.wmonkeypatch.inline();this.wmonkeypatch.insert();this.wmonkeypatch.keydown();this.wmonkeypatch.keyup();this.wmonkeypatch.link();this.wmonkeypatch.list();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(f){var e={cancel:false,event:f};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+a,e);return(e.cancel?false:true)});this.wutil.setOption("keyupCallback",(function(f){this.wutil.saveSelection();var e={cancel:false,event:f};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+a,e);return(e.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(e,f){if(f){if(e.previousElementSibling&&(e.previousElementSibling.tagName==="P"||e.previousElementSibling.tagName==="DIV")){this.caret.setEnd(e.previousElementSibling)}else{this.wutil.setCaretBefore(e)}}else{if(e.nextElementSibling&&(e.nextElementSibling.tagName==="P"||e.nextElementSibling.tagName==="DIV")){this.caret.setEnd(e.nextElementSibling)}else{this.wutil.setCaretAfter(e)}}}).bind(this);var d=null;this.$editor.on("click.wmonkeypatch",(function(f){if(f.target===this.$editor[0]){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(k&&k.collapsed){var g=k.startContainer;var m=this.$editor.offset();if(d===null){d={left:this.$editor.cssAsNumber("padding-left"),top:this.$editor.cssAsNumber("padding-top")}}if(f.pageY<=m.top+d.top){var j=this.$editor[0].children[0];if(j.tagName!=="BLOCKQUOTE"&&(j.tagName!=="DIV"||!/\bcodeBox\b/.test(j.className))){return}}else{if(f.pageX<=m.left+d.left){return}else{if(f.pageX>m.left+this.$editor.width()){return}}}while(g&&g!==this.$editor[0]){if(g.nodeType===Node.ELEMENT_NODE){if(g.tagName==="BLOCKQUOTE"||(g.tagName==="DIV"&&/\bcodeBox\b/.test(g.className))){var n=$(g).offset();if(f.pageY<=n.top){b(g,true)}else{b(g,false)}return false}}g=g.parentElement}}var l=this.$editor.children("blockquote, div.codeBox");l.each(function(r,s){var p=$(s);var o=p.offset();if(f.pageY<=o.top){b(s,true);return false}else{var q=p.outerHeight()+(parseInt(p.css("margin-bottom"),10)||0);if(f.pageY<=o.top+q){b(s,false);return false}}});return false}else{if(f.target.tagName==="LI"){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;var e=false;if(k!==null){if(!k.collapsed){return}var g=k.startContainer;while(g!==null&&g!==this.$editor[0]){if(g.tagName==="LI"){e=true;break}g=g.parentElement}}if(!e||k===null){var h=document.createTextNode("\u200b");var j=f.target.children[0];j.appendChild(h);this.caret.setEnd(j)}}else{if(f.target.tagName==="BLOCKQUOTE"){var k=(window.getSelection().rangeCount)?window.getSelection().getRangeAt(0):null;if(k!==null&&k.collapsed){var i=null;var g=(k.startContainer.nodeType===Node.TEXT_NODE)?k.startContainer.parentElement:k.startContainer;while(g!==null&&g!==this.$editor[0]){if(g.tagName==="BLOCKQUOTE"){i=g;break}g=g.parentElement}if(i!==null&&i!==f.target){if(f.pageY<=$(i).offset().top){b(i,true)}else{b(i,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 d=function(f){f=f.replace(/\u201D/g,"__wcf_preserve_character_1__");f=f.replace(/\u201C/g,"__wcf_preserve_character_2__");f=f.replace(/\u2018/g,"__wcf_preserve_character_3__");f=f.replace(/\u2019/g,"__wcf_preserve_character_4__");return f};var c=function(f){f=f.replace(/__wcf_preserve_character_1__/g,"\u201D");f=f.replace(/__wcf_preserve_character_2__/g,"\u201C");f=f.replace(/__wcf_preserve_character_3__/g,"\u2018");f=f.replace(/__wcf_preserve_character_4__/g,"\u2019");return f};var e=this.clean.onPaste;this.clean.onPaste=(function(g,f){this.opts.replaceDivs=true;g=d(g);g=e.call(this,g,f);this.opts.replaceDivs=false;return c(g)}).bind(this);this.clean.onPasteRemoveEmpty=function(f){return f.replace(/<br\s?\/?>$/i,"")};var a=this.clean.removeSpaces;this.clean.removeSpaces=(function(f){f=f.replace(/\u200C/g,"__wcf_zwnj__");f=f.replace(/\u200D/g,"__wcf_zwj__");f=a.call(this,f);f=f.replace(/__wcf_zwnj__/g,"\u200C");return f.replace(/__wcf_zwj__/g,"\u200D")});var b=this.clean.onSet;this.clean.onSet=(function(f){f=d(f);f=b.call(this,f);return c(f)}).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){k.preventDefault();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.dropdown.hideAll()},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")){return}d.off("click.redactor touchstart.redactor");c.call(this,d)}).bind(this);var b=this.image.loadEditableControls;this.image.loadEditableControls=(function(d){if(d[0].parentNode.id==="redactor-image-box"){return $("#redactor-image-resizer",this.$editor[0])}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));$("#redactorImageLinkHrefContainer").hide();this.selection.save();this.modal.show()}).bind(this);this.image.showEdit=(function(e){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(e)}).bind(this));var d=e.closest("a",this.$editor[0]);$("#redactor-image-link-source").val(e.attr("src"));$("#redactor-image-link-href").val(d.length?d.attr("href"):"");$("#redactor-image-align").val(e.css("float"));this.modal.show();setTimeout(function(){$(".redactor-link-tooltip").remove()},1)}).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(h){this.image.hideResize();this.buffer.set();h.attr("src",$("#redactor-image-link-source").val());this.image.setFloating(h);a(h);var g=$("#redactor-image-link-href").val().trim();var d=h.closest("a",this.$editor[0]);if(d.length){if(g===""){d=d[0];var e=d.children.length,f=d.parentNode;while(e--){f.insertBefore(d.children[0],d)}f.removeChild(d)}else{d.attr("href",g)}}else{if(g!==""){d=document.createElement("a");d.href=g;h[0].parentNode.insertBefore(d,h[0]);d.appendChild(h[0])}}this.modal.close();this.observe.images()}).bind(this)},indent:function(){var a=this.indent.increase;this.indent.increase=(function(){var b=this.selection.getBlock();if(b&&b.tagName==="LI"){if(b.parentElement.firstChild!==b){a.call(this)}}}).bind(this)},inline:function(){var c=(function(e,d){var f=e.parent();while(f[0]!==this.$editor[0]){if(f.children(":not(.redactor-selection-marker)").length>1){break}if(f[0].tagName==="SPAN"&&f[0].style.getPropertyValue(d)){f.contents().unwrap();break}f=f.parent()}}).bind(this);var b=this.inline.format;this.inline.format=(function(d,e,f){if($.browser.iOS){this.wutil.restoreSelection()}b.call(this,d,e,f)}).bind(this);var a=this.inline.removeStyleRule;this.inline.removeStyleRule=(function(d){if($.browser.iOS){this.wuil.restoreSelection()}a.call(this,d)}).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(i,e,g){if(/\sEdge\//.test(window.navigator.userAgent)){i=$.trim(i.replace(/<|>/g,""));this.selection.restore();var h=this.selection.getBlocks();if(i===""&&e===""){return}if(i===""&&e!==""){i=e}if(!this.link.$node){var f=$('<a href="'+e+'">').text(i);if(g!==""){f.attr("target",g)}f=$(this.insert.node(f));if(this.selection.getText().match(/\s$/)){f.after(" ")}this.selection.selectElement(f);this.code.sync();this.core.setCallback("insertedLink",f)}else{a.call(this,i,e,g)}}else{a.call(this,i,e,g)}var d=window.getSelection();if(d.rangeCount){var c=d.getRangeAt(0);if(!c.collapsed){c.collapse(false);this.wutil.saveSelection()}}}).bind(this)},list:function(){var a=this.list.insert;this.list.insert=(function(e){var d=window.getSelection();if(d.rangeCount){var b=d.getRangeAt(0);if(b.collapsed){var c=b.startContainer;if(c.nodeType===Node.TEXT_NODE){c=c.parentNode}if(c.nodeName==="DIV"){if(c.parentNode.nodeName==="BLOCKQUOTE"){var f=document.createElement("div");c.parentNode.insertBefore(f,c);f.appendChild(c)}}}}a.call(this,e)}).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{if(this.modal.dialog){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.createPasteBox;this.paste.createPasteBox=(function(){if($.browser.iOS){var e=0;if(window.getSelection().rangeCount){var d=window.getSelection().getRangeAt(0).endContainer;if(d.nodeType!==Node.ELEMENT_NODE){d=d.parentElement}d=$(d);e=$(d).offset().top}else{e=$(window).scrollTop()}this.$pasteBox=$("<div>").html("").attr("contenteditable","true").css({position:"fixed",top:e+"px",fontSize:"16px"});this.$box.parent().append(this.$pasteBox);this.$pasteBox.focus()}else{a.call(this)}}).bind(this);var c=function(){var d=window.getSelection();if(!d.rangeCount){return}var i=d.getRangeAt(0);if(!i.collapsed){return}var f=i.startContainer;if(f.nodeType===Node.ELEMENT_NODE&&f.tagName==="DIV"){var h=f.parentNode;if(h!==null&&h.tagName==="BLOCKQUOTE"&&h.classList.contains("quoteBox")){var g=i.startContainer.childNodes[i.startContainer.childNodes.length-1];var e=document.createRange();e.setStart(i.startContainer.childNodes[0],0);e.setEnd(g,g.length);e.collapse(false);d.removeAllRanges();d.addRange(e)}}};var b=this.paste.insert;this.paste.insert=(function(d){c();b.call(this,d);setTimeout((function(){this.wutil.fixDOM();if($.browser.msie){getSelection().getRangeAt(0).collapse(false)}else{if($.browser.mozilla){var e=getSelection().getRangeAt(0);if(e.startContainer===this.$editor[0]&&e.endContainer===this.$editor[0]){this.wutil.selectionEndOfEditor()}}}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}if($.browser.iOS&&c.innerHTML.length){c.outerHTML=c.innerHTML}else{c.parentNode.removeChild(c)}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">'+WCF.Language.get("wcf.bbcode.image.source")+'</label></dt><dd><input type="text" id="redactor-image-link-source" class="long" /></dd></dl><dl id="redactorImageLinkHrefContainer"><dt><label for="redactor-image-link-href">'+this.lang.get("link")+'</label></dt><dd><input type="text" id="redactor-image-link-href" 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 monospace" 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.wutil=function(){var c="";var d=null;var a=false;var b=false;var e=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var f=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();f.call(this)}).bind(this)},saveSelection:function(g){var f=getSelection();if(f.rangeCount){this.wutil._range=f.getRangeAt(0)}else{if(g){this.wutil._range=null}}},restoreSelection:function(){if(document.activeElement!==this.$editor[0]){this.$editor.focus()}if(this.wutil._range!==null){var f=window.getSelection();f.removeAllRanges();f.addRange(this.wutil._range);this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(g){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var h=this.$textarea.getCaret();if(h==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var f=this.$textarea.val();f=f.substr(0,h)+g+f.substr(h);this.$textarea.val(f);return true},insertDynamic:function(f,g){if(this.wutil.inWysiwygMode()){this.insert.html(f,false)}else{if(g===undefined||g===null){g=f}this.wutil.insertAtCaret(g)}},setOption:function(f,g){if(f.indexOf(".")!==-1){f=f.split(".",2);this.opts[f[0]][f[1]]=g}else{this.opts[f]=g}},getOption:function(f){if(f.indexOf(".")!==-1){f=f.split(".",2);if(this.opts[f[0]][f[1]]){return this.opts[f[0]][f[1]]}}else{if(this.opts[f]){return this.opts[f]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(f){getSelection().removeAllRanges();getSelection().addRange(f)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(f)))}var g=$.trim(this.$textarea.val());g=this.wutil._removeSuperfluousNewlines(g);return g},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var f=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));f=this.wutil._removeSuperfluousNewlines(f);this.$textarea.val(f)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",f);return f.text},addNewlines:function(g){g=g.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var f={text:g};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",f);return f.text},reset:function(){if(this.opts.visual){this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>");this.wutil.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(f){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:f})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter((function(g){this.wutil.saveTextToStorage(false)}).bind(this),15*1000)}return true},saveTextToStorage:function(g){var f=this.wutil.getText();if(c==f&&!g){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:f,timestamp:Date.now()}));c=f;a=true;if(e===null){e=new WCF.PeriodicalExecuter((function(i){if(b===true){return}if(a===false){i.stop();e=null;return}this.wutil.autosaveShowNotice("saved");a=false}).bind(this),120*1000)}}catch(h){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+h.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(f){console.debug("[wutil.autosavePurge] Unable to access local storage: "+f.message)}},autosaveRestore:function(){var f=this.wutil.getOption("woltlab.autosave");var g=null;try{g=localStorage.getItem(f.key)}catch(h){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+h.message)}try{g=(g===null)?null:JSON.parse(g)}catch(h){g=null}if(g===null||!g.content){return false}if(f.lastEditTime&&(f.lastEditTime*1000)>g.timestamp){this.wutil.autosavePurge();return false}if(f.prompt){this.wutil.autosaveShowNotice("prompt",g);return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",g.content)}else{this.$textarea.val(g.content)}this.wutil.autosaveShowNotice("restored",{timestamp:g.timestamp});return true},autosaveShowNotice:function(j,l){if(d===null){d=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>');d.appendTo(this.$box);var h=(function(m){if(m!==null&&m.originalEvent.propertyName!=="opacity"){return}if(d.hasClass("open")&&m!==null){if(d.data("callbackOpen")){d.data("callbackOpen")()}}else{if(d.data("callbackClose")){d.data("callbackClose")()}d.removeData("callbackClose");d.removeData("callbackOpen");d.removeClass("redactorAutosaveNoticeIcons");d.empty();$('<span class="redactorAutosaveMessage" />').appendTo(d)}}).bind(this);d.on("transitionend webkitTransitionEnd",h)}var i="";switch(j){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(l.timestamp).toLocaleString()})+'"></span>').prependTo(d);var k=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(d);var f=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').appendTo(d);k.click((function(){this.wutil.replaceText(l.content);h(null);this.wutil.autosaveShowNotice("restored",l)}).bind(this));f.click((function(){this.wutil.autosavePurge();d.removeClass("open")}).bind(this));i=WCF.Language.get("wcf.message.autosave.prompt");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){d.removeClass("open")},3000)}).bind(this));break;case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(l.timestamp).toLocaleString()})+'"></span>').prependTo(d);var k=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(d);var f=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(d);k.click(function(){d.removeClass("open")});f.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(m){if(m==="confirm"){this.wutil.reset();this.wutil.autosavePurge();d.removeClass("open")}}).bind(this))}).bind(this));i=WCF.Language.get("wcf.message.autosave.restored");d.addClass("redactorAutosaveNoticeIcons");var g="";g=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),(function(m){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),g);setTimeout(function(){k.trigger("click")},3000)}).bind(this));break;case"saved":if(d.hasClass("open")){return}setTimeout(function(){d.removeClass("open")},2000);i=WCF.Language.get("wcf.message.autosave.saved");break}d.children("span.redactorAutosaveMessage").text(i);d.addClass("open");if(j!=="saved"){WCF.DOMNodeInsertedHandler.execute()}},autosavePurgeOutdated:function(){var j=0;var m=this.wutil.getOption("woltlab.autosave").prefix;var l=m+"_wcf_master";try{j=localStorage.getItem(l)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}if(j===0){return}var f=Date.now()-(7*24*3600*1000);if(j===null||j<f){var i=new RegExp("^"+m+"_");for(var h in localStorage){if(h.match(i)&&h!==l){var g=localStorage.getItem(h);try{g=JSON.parse(g)}catch(k){g={timestamp:0}}if(g===null||!g.timestamp||g.timestamp<f){try{localStorage.removeItem(h)}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}}}}try{localStorage.setItem(l,Date.now())}catch(k){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+k.message)}}},autosavePause:function(){b=true},autosaveResume:function(){b=false},buttonReplace:function(i,g,j,l,k){var f=this.buttonGet(i);var h=this.buttonAddAfter(i,g,j,l,k);if(f.parent().hasClass("separator")){h.parent().addClass("separator")}f.parent().remove();return h},removeZeroWidthSpace:function(f){var g="";for(var j=0,i=f.length;j<i;j++){var h=f.charCodeAt(j).toString(16);if(h!="200b"){g+=f[j]}}return g},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var f=this.$editor.children(":last")[0];if(f.tagName==="P"){if(f.innerHTML===""){f.remove();f=$(this.opts.emptyHtml).appendTo(this.$editor)[0]}if(f.lastChild.nodeType===Element.TEXT_NODE){this.caret.set(f.lastChild,f.lastChild.length,f.lastChild,f.lastChild.length)}else{this.caret.setEnd(f)}}else{this.wutil.setCaretAfter(f)}this.wutil.saveSelection()},adjustSelectionForBlockElement:function(){if(document.activeElement!==this.$editor[0]){this.wutil.restoreSelection()}if(getSelection().getRangeAt(0).collapsed){var g=getSelection().getRangeAt(0).startContainer;if(g.nodeType===Node.TEXT_NODE&&g.textContent==="\u200b"&&g.parentElement&&g.parentElement.tagName==="P"&&g.parentElement.parentElement===this.$editor[0]){return}else{var f=$(g).parentsUntil(this.$editor[0]).last();if(f[0]===document.body.parentElement){this.wutil.selectionEndOfEditor()}else{this.caret.setAfter(f)}}}},isCaret:function(){this.selection.get();return this.range.collapsed},isEndOfElement:function(f){var h=this.selection.implicitRange;if(h===null){this.selection.get();h=this.range}if(!this.wutil.isCaret()){return false}if(h.endContainer.nodeType===Element.TEXT_NODE){if(h.endOffset<h.endContainer.length){return false}}if(!this.wutil.isNodeWithin(h.endContainer,f)){return false}var g=h.endContainer;while(g!==f){if(g.nextSibling){return false}g=g.parentNode}return true},isNodeWithin:function(g,f){while(g&&g!==this.$editor[0]){if(g===f){return true}g=g.parentNode}return false},containsTag:function(g,f){switch(g.nodeType){case Element.ELEMENT_NODE:if(g.tagName===f){return true}case Element.DOCUMENT_FRAGMENT_NODE:for(var h=0;h<g.childNodes.length;h++){if(this.wutil.containsTag(g.childNodes[h],f)){return true}}return false;break;default:return false;break}},replaceText:function(h){var i=$(document);var f=i.scrollTop();var g=false;if(this.wutil.inWysiwygMode()){this.code.toggle();g=true}h=this.wutil.addNewlines(h);this.$textarea.val(h);if(g){this.code.toggle();i.scrollTop(f)}i.trigger("resize")},setCaretBefore:function(f){this.wutil._setCaret(f,true)},setCaretAfter:function(f){this.wutil._setCaret(f,false)},_setCaret:function(g,h){var f;if((g[0]||g).parentElement&&(g[0]||g).parentElement.tagName==="BLOCKQUOTE"){f=$("<div>"+this.opts.invisibleSpace+"</div>")}else{f=$("<p>"+this.opts.invisibleSpace+"</p>")}f[(h?"insertBefore":"insertAfter")](g);this.caret.setEnd(f[0])},fixDOM:function(){var f=this.$editor[0].childNodes[0];var j=f;var m=null;while(j){f=j;j=f.nextSibling;if(f.nodeType===Element.ELEMENT_NODE){if(this.reIsBlock.test(f.tagName)){m=null}else{if(m===null){m=$("<p />").insertBefore(f)}m.append(f)}}else{if(f.nodeType===Element.TEXT_NODE){if(m===null){if(j){if(j.nodeType===Element.ELEMENT_NODE&&j.tagName==="P"&&j.innerHTML==="\u200B"){var l=j.nextSibling;this.$editor[0].removeChild(j);j=l}}m=$("<p />").insertBefore(f)}m.append(f)}}}var i=this.$editor[0].getElementsByTagName("li");for(var q=0,o=i.length;q<o;q++){var n=i[q];if(!n.innerHTML.length){var k=n.parentElement;if(k.children.length>1){n.parentElement.removeChild(n);q--;o--}}}for(var q=0,o=this.$editor[0].children.length;q<o;q++){var h=this.$editor[0].children[q];if(h.nodeType!==Node.ELEMENT_NODE||h.tagName!=="P"){continue}if(h.innerHTML==="\n"){h.parentElement.removeChild(h);q--;o--;continue}if(h.textContent.length>0){continue}if(h.children.length>1||(h.children.length===1&&h.children[0].tagName==="BR")){continue}while(h.children.length===1){h=h.children[0]}if(h.childNodes.length===0&&h.tagName!=="BR"){var g=document.createTextNode("\u200b");h.appendChild(g)}}var p=this.$editor[0].getElementsByTagName("INPUT");while(p.length){p[0].parentNode.removeChild(p[0])}}}};
+// wupload.js
+