"),i=0;l>i;i++)a=$(""+this.opts.invisibleSpace+" "),0===t&&0===i&&a.append(this.selection.getMarker()),$(e).append(a);o.append(e)}n.append(o);var d=n.html();if(this.modal.close(),this.selection.restore(),!this.table.getTable()){this.buffer.set();var h=this.selection.getBlock()||this.selection.getCurrent();h&&"BODY"!=h.tagName?("LI"==h.tagName&&(h=$(h).closest("ul, ol")),$(h).after(d)):this.insert.html(d),this.selection.restore();var c=this.$editor.find("#table"+r);if(!this.opts.linebreaks&&(this.utils.browser("mozilla")||this.utils.browser("msie"))){var b=c.next();0===b.length&&c.after(this.opts.emptyHtml)}this.observe.buttons(),c.find("span.redactor-selection-marker").remove(),c.removeAttr("id"),this.code.sync(),this.core.setCallback("insertedTable",c)}},getTable:function(){var t=$(this.selection.getParent()).closest("table");return this.utils.isRedactorParent(t)?0===t.size()?!1:t:!1},restoreAfterDelete:function(t){this.selection.restore(),t.find("span.redactor-selection-marker").remove(),this.code.sync()},deleteTable:function(){var t=this.table.getTable();if(t){this.buffer.set();var e=t.next();this.opts.linebreaks||0===e.length?this.caret.setAfter(t):this.caret.setStart(e),t.remove(),this.code.sync()}},deleteRow:function(){var t=this.table.getTable();if(t){var e=$(this.selection.getCurrent());this.buffer.set();var i=e.closest("tr"),a=i.prev().length?i.prev():i.next();if(a.length){var s=a.children("td, th").first();s.length&&s.prepend(this.selection.getMarker())}i.remove(),this.table.restoreAfterDelete(t)}},deleteColumn:function(){var t=this.table.getTable();if(t){this.buffer.set();var e=$(this.selection.getCurrent()),i=e.closest("td, th"),a=i[0].cellIndex;t.find("tr").each($.proxy(function(t,e){var i=$(e),s=0>a-1?a+1:a-1;0===t&&i.find("td, th").eq(s).prepend(this.selection.getMarker()),i.find("td, th").eq(a).remove()},this)),this.table.restoreAfterDelete(t)}},addHead:function(){var t=this.table.getTable();if(t){if(this.buffer.set(),0!==t.find("thead").size())return void this.table.deleteHead();var e=t.find("tr").first().clone();e.find("td").html(this.opts.invisibleSpace),$thead=$(" ").append(e),t.prepend($thead),this.code.sync()}},deleteHead:function(){var t=this.table.getTable();if(t){var e=t.find("thead");0!==e.size()&&(this.buffer.set(),e.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(t){var e=this.table.getTable();if(e){this.buffer.set();var i=$(this.selection.getCurrent()),a=i.closest("tr"),s=a.clone();s.find("th").replaceWith(function(){var t=$("");return t[0].attributes=this.attributes,t.append($(this).contents())}),s.find("td").html(this.opts.invisibleSpace),"after"==t?a.after(s):a.before(s),this.code.sync()}},addColumn:function(t){var e=this.table.getTable();if(e){var i=0,a=$(this.selection.getCurrent());this.buffer.set();var s=a.closest("tr"),l=a.closest("td, th");s.find("td, th").each($.proxy(function(t,e){$(e)[0]===l[0]&&(i=t)},this)),e.find("tr").each($.proxy(function(e,a){var s=$(a).find("td, th").eq(i),l=s.clone();l.html(this.opts.invisibleSpace),"after"==t?s.after(l):s.before(l)},this)),this.code.sync()}}}};
// wbbcode.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wbbcode=function(){"use strict";var e=!1;return{init:function(){var t=this.$textarea.wcfIdentify();this.opts.initCallback=function(){window.addEventListener("unload",function(){this.code.startSync(),this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()))}.bind(this)),$.browser.msie&&this.$editor.addClass("msie"),this.$textarea[0].setAttribute("data-is-dirty",!0);var e=$.trim(this.wutil.getOption("woltlab.originalValue"));e.length&&(this.wutil.replaceText(e),this.wutil.selectionEndOfEditor()),delete this.opts.woltlab.originalValue,$(document).trigger("resize"),this.wutil.saveSelection();var t=this.$editor[0],i=this.$textarea[0];setTimeout(function(){$.browser.iOS&&0===t.scrollHeight&&(document.activeElement===t||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 i=this.clean.onSync;this.clean.onSync=function(t){return t=t.replace(/\u200C/g,"__wcf_zwnj__"),t=t.replace(/\u200D/g,"__wcf_zwj__"),e===!0?e=!1:t=t.replace(/ ]+)?><\/p>/g,"
@@@wcf_empty_line@@@
"),t=i.call(this,t),t=t.replace(/__wcf_zwnj__/g,""),t.replace(/__wcf_zwj__/g,"")}.bind(this),this.wutil.getOption("woltlab.autosaveOnce")&&(this.wutil.saveTextToStorage(),delete this.opts.woltlab.autosaveOnce);var a=this.button.get("table");if(a.length){var r=a.data("dropdown");r.find(".redactor-dropdown-add_head").parent().remove(),r.find(".redactor-dropdown-delete_head").parent().remove(),$(' ').insertBefore(r.find(".redactor-dropdown-delete_table").parent()),a.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+t,$.proxy(function(e){e.cancel=!0,this.wbbcode._handleInsertQuote()},this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_code_"+t,$.proxy(function(e){e.cancel=!0,this.wbbcode._handleInsertCode(null,!0)},this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+t,$.proxy(this.wbbcode._keydownCallback,this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+t,$.proxy(this.wbbcode._keyupCallback,this)),this.code.sync=function(){};var n=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode")),l=function(e){e.find("br").each(function(e,t){t.children.length&&$(t).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"),n.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"));else{if(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"),n.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode")),this.wutil.fixDOM(),l(this.$editor),/ Edge\//.test(navigator.userAgent)){var e=this.$editor[0];window.dtdesign=e,e.childElementCount>1&&""===e.children[0].innerHTML&&e.removeChild(e.children[0])}this.wutil.saveSelection()}}.bind(this),this.wutil.setOption("clickCallback",function(e){e.target===this.$editor[0]&&this.$editor[0].lastElementChild&&"BLOCKQUOTE"===this.$editor[0].lastElementChild.tagName&&this.wutil.setCaretAfter($(this.$editor[0].lastElementChild)),setTimeout(this.wutil.saveSelection.bind(this),10)}.bind(this));var o=this.opts.verifiedTags.indexOf("ul");o>-1&&this.opts.verifiedTags.splice(o,1),WCF.System.Event.addListener("com.woltlab.wcf.redactor","observe_load_"+t,function(){this.wbbcode.observeCodeListings(),this.wbbcode.observeQuotes()}.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor","fixFormatting_"+t,$.proxy(this.wbbcode.fixFormatting,this))},_tableButtonClick:function(e){var t=$(e.currentTarget);if(t.hasClass("dropact")){var i=this.selection.getBlock()||this.selection.getCurrent(),a=t.data("dropdown");a.children("li").show();var r=a.find("> li > .redactor-dropdown-insert_table").parent();"TD"==i.tagName?r.hide():r.nextAll().hide()}},insertSmiley:function(e,t,i){if(i&&this.wbbcode.registerSmiley(e,t),this.opts.visual){this.wutil.restoreSelection();var a=window.getSelection();a.rangeCount&&this.utils.isRedactorParent(a.getRangeAt(0).startContainer)||this.focus.setEnd();var r=a.getRangeAt(0);r.deleteContents();var n=document.createElement("img");n.src=t,n.className="smiley",n.alt=e,r.insertNode(n);var l,o=function(e){return null===e?!1:(e.nodeType===Node.ELEMENT_NODE&&"SPAN"===e.nodeName||e.nodeType===Node.TEXT_NODE)&&" "===e.textContent?!0:!1},c=n,s=n.parentElement;o(n.previousSibling)||(l=document.createTextNode(" "),s.insertBefore(l,n)),o(n.nextSibling)||(l=document.createTextNode(" "),s.lastChild===n?s.appendChild(l):s.insertBefore(l,n.nextSibling),c=l),r=document.createRange(),r.selectNode(c),r.collapse(!1),a.removeAllRanges(),a.addRange(r),this.wutil.saveSelection()}else this.wutil.insertAtCaret(" "+e+" ")},registerSmiley:function(e,t){return __REDACTOR_SMILIES[e]?!1:(__REDACTOR_SMILIES[e]=t,!0)},convertFromHtml:function(e){var t=[],i={html:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",i),e=i.html,e=e.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1"),e=e.replace(/(<[^>]+?) rel="[^"]+"/g,"$1"),e=e.replace(/(8203|x200b);/g,""),e=e.replace(/™/gi,"™"),e=e.replace(/©/gi,"©"),e=e.replace(/…/gi,"…"),e=e.replace(/—/gi,"—"),e=e.replace(/‐/gi,"‐");var a={};e=e.replace(/]+?)class="codeBox[^"]+"([^>]*?)>\n*
[\s\S]+?
([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(e,t,i,r,n){var l=t+" "+i,o="",c="";l.match(/data-highlighter="([a-zA-Z]+)"/)&&(o=RegExp.$1),l.match(/data-filename="([^"]+)"/)&&(c=$.trim(RegExp.$1));var s=WCF.getUUID();return a[s]={codeContent:n.replace(//g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:c.replace(/['"]/g,""),highlighter:"plain"===o?"":o,lineNumber:r>1?r:0},"@@@"+s+"@@@"}),e=e.replace(/\r?\n/g,""),e=e.replace(/]*?><\/a>/g,""),e=e.replace(/<\/p>
");for(var r in a)e=e.replace(new RegExp("
@@@"+r+"@@@
"),"@@@"+r+"@@@");e=e.replace(/<\/p>
(?! )/g,"
@@@wcf_empty_line@@@
"),e=e.replace(/ <\/p>/g,"
");for(var n=e.split(/(<\/?(?:div|p)>)/),l="",o="",c=0;c"!=s&&""!=s&&(""==s||"
"==s?(o=$.trim(o),"@@@wcf_empty_line@@@"!=o&&(o+="\n"),l+=o,o=""):0==c||c+1==n.length?l+=s:o+=s)}o&&(l+=o,o=""),e=l,e=e.replace(/<\/table>@@@wcf_empty_line@@@/g,"@@@wcf_after_table_empty_line@@@"),e=e.replace(/@@@wcf_empty_line@@@/g,"\n"),e=e.replace(/\n\n$/,"\n"),e=e.replace(/@@@wcf_after_table_empty_line@@@/g,"\n\n"),e=e.replace(/ $/,""),e=e.replace(/ /g,"\n"),e=e.replace(/ /g,""),e=e.replace(/]+)>\n?]*?>[\s\S]*?<\/header>/gi,function(e,t){var i,a="",r="";return t.match(/data-author="([^"]+)"/)&&(a=WCF.String.unescapeHTML(RegExp.$1)),t.match(/cite="([^"]+)"/)&&(r=WCF.String.unescapeHTML(RegExp.$1)),i=r?"[quote='"+a+"','"+r+"']":a?"[quote='"+a+"']":"[quote]"}),e=e.replace(/(?:\n*)<\/blockquote>\n?/gi,"\n[/quote]\n"),e=e.replace(/]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]"),e=e.replace(/ ]+><\/a>/,""),e=e.replace(/ ]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(e,t,i,a){return i==a?"[url]"+i+"[/url]":"[url='"+i+"']"+a+"[/url]"}),e=e.replace(/<(?:b|strong)>/gi,function(){return-1===t.indexOf("b")&&t.push("b"),"[b]"}),e=e.replace(/<\/(?:b|strong)>/gi,"[/b]"),e=e.replace(/<(?:i|em)>/gi,function(){return-1===t.indexOf("i")&&t.push("i"),"[i]"}),e=e.replace(/<\/(?:i|em)>/gi,"[/i]"),e=e.replace(//gi,function(){return-1===t.indexOf("u")&&t.push("u"),"[u]"}),e=e.replace(/<\/u>/gi,"[/u]"),e=e.replace(//gi,function(){return-1===t.indexOf("sub")&&t.push("sub"),"[sub]"}),e=e.replace(/<\/sub>/gi,"[/sub]"),e=e.replace(//gi,function(){return-1===t.indexOf("sup")&&t.push("sup"),"[sup]"}),e=e.replace(/<\/sup>/gi,"[/sup]"),e=e.replace(/<(?:s(trike)?|del)>/gi,function(){return-1===t.indexOf("s")&&t.push("s"),"[s]"}),e=e.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");for(var d=e.split(/(<\/?span[^>]*>)/),o=[],h=[],p="",g={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36},c=0;c"==u){var f=h.pop(),l=f.start+o.pop()+f.end;o.length?o[o.length-1]+=l:p+=l}else if(u.match(/^]*?)>/)){var m,v,b=RegExp.$1.replace(/"/g,'"');if(b.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var w=RegExp.$1,E=RegExp.$2,C=RegExp.$3,x="0123456789ABCDEF".charAt((w-w%16)/16)+""+"0123456789ABCDEF".charAt(w%16)+("0123456789ABCDEF".charAt((E-E%16)/16)+""+"0123456789ABCDEF".charAt(E%16))+("0123456789ABCDEF".charAt((C-C%16)/16)+""+"0123456789ABCDEF".charAt(C%16));m="[color=#"+x+"]",v="[/color=#"+x+"]",-1===t.indexOf("color")&&t.push("color")}else b.match(/(?:^|;\s*)color: ?([^;]+);?/i)?(m="[color="+RegExp.$1+"]",v="[/color="+RegExp.$1+"]",-1===t.indexOf("color")&&t.push("color")):b.match(/font-size: ?(\d+)(pt|px);?/i)?"pt"==RegExp.$2?(m="[size="+RegExp.$1+"]",v="[/size="+RegExp.$1+"]",-1===t.indexOf("size")&&t.push("size")):g[RegExp.$1]?(m="[size="+g[RegExp.$1]+"]",v="[/size="+g[RegExp.$1]+"]",-1===t.indexOf("size")&&t.push("size")):(m="",v=""):b.replace(/"/g,"").match(/font-family: ?([^;]+);?/)?(m="[font='"+RegExp.$1.replace(/'/g,"")+"']",v="[/font='"+RegExp.$1.replace(/'/g,"")+"']",-1===t.indexOf("font")&&t.push("font")):(m='',v=" ");o[o.length]="",h[o.length]={start:m,end:v}}else u.match(/^/)?(o[o.length]="",h[o.length]={start:"[tt]",end:"[/tt]"}):(o[o.length]="",h[o.length]={start:"",end:""});else o.length?o[o.length-1]+=u:p+=u}if(e=p,e=e.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(e,i,a,r){return-1===t.indexOf("align")&&t.push("align"),"[align="+a+"]"+$.trim(r)+"[/align="+a+"]\n"}),t.length){for(var y=!0;y;)y=!1,e=e.replace(new RegExp("\\[((?:"+t.join("|")+")=[^\\]]+?)\\]\n\\[\\/\\1\\]","gi"),function(e,t){return y=!0,"["+t+"][/"+t+"]"});for(y=!0;y;)y=!1,e=e.replace(new RegExp("\\[\\/((?:"+t.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){return y=!0,"\n"});e=e.replace(new RegExp("\\[\\/("+t.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}e=e.replace(/ ? ]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 "),e=e.replace(/ ? ]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 "),e=e.replace(/ ]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi,function(e,t,i){var a,r=t+" "+i;if(!r.match(/data-attachment-id="(\d+)"/))return e;a=RegExp.$1;var n="none",l=null;if(r.match(/style="([^"]+)"/)){for(var o=RegExp.$1.split(";"),c=0;c]*)?src=(["'])([^"']+?)\2([^>]*)?>/gi,function(e,t,i,a,r){var n=t+" "+r,l="";n.match(/style="([^"]+)"/)&&(l=RegExp.$1);for(var o="none",c=0,s=l.split(";"),d=0;d/gi,"[*]"),e=e.replace(/<\/li>/gi,"\n"),e=e.replace(//gi,"[list]"),e=e.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]"),e=e.replace(//gi,"[list=$1]"),e=e.replace(/<\/(ul|ol)>/gi,"[/list]"),e=e.replace(/\n?\[list\]/g,"\n[list]"),e=e.replace(/\[\/list\]\n\[\*\]/g,"[/list][*]"),e=e.replace(/\[\/list\]\n\[\/list\]/g,"[/list][/list]"),e=e.replace(/]*>/gi,"[table]\n"),e=e.replace(/<\/table>\n?/gi,"[/table]\n"),e=e.replace(/([\s\S]*?)<\/tbody>/,function(e,t){return $.trim(t)}),e=e.replace(/<\/tr>/gi,""),e=e.replace(/ /gi,"[tr]\n"),e=e.replace(/<\/tr>/gi,"[/tr]\n"),e=e.replace(/([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]"),e=e.replace(/(\t)* (\t)*/gi,"[td]"),e=e.replace(/(\t)*<\/td>/gi,"[/td]\n");var S={};if(e.replace(/<\/span>/,function(e){var t=e.hashCode();return S[t]=e.replace(/\$/g,"$$$$"),"@@"+t+"@@"}),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:e}),e=e.replace(/<[^(<|>)]+>/g,""),$.getLength(S))for(var _ in S){var k=new RegExp("@@"+_+"@@","g");e=e.replace(k,S[_])}return $.getLength(a)&&$.each(a,function(t,i){var a=0;i.highlighter&&a++,i.lineNumber&&a++,i.filename&&a++;var r="";switch(a){case 1:r=i.highlighter?i.highlighter:i.filename?"'"+i.filename+"'":i.lineNumber;break;case 2:i.lineNumber&&(r=i.lineNumber),i.highlighter&&(r.length&&(r+=","),r+=i.highlighter),i.filename&&(r.length&&(r+=","),r+="'"+i.filename+"'");break;case 3:r=i.highlighter+","+i.lineNumber+",'"+i.filename+"'"}var n="[code"+(r.length?"="+r:"")+"]"+i.codeContent+"[/code]\n";e=e.replace(new RegExp("@@@"+t+"@@@\n?","g"),n.replace(/\$/g,"$$$"))}),e=e.replace(/</g,"<"),e=e.replace(/>/g,">"),e=e.replace(/&/g,"&"),e=e.replace(/%28/g,"("),e=e.replace(/%29/g,")"),i={html:e},WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",i),e=i.html,e=$.trim(e),e.length&&(e+="\n"),e},convertToHtml:function(e){var t={data:e};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",t),e=t.data,e=this.wutil.removeZeroWidthSpace(e),e=e.replace(/&/g,"&"),e=e.replace(//g,">");var i=[],a=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");e=e.replace(a,function(e){var t=e.hashCode();return i.push({key:t,value:e.replace(/\$/g,"$$$$")}),"@@"+t+"@@"}),e=e.replace(/\[url\]([^"]+?)\[\/url]/gi,'$1 '+this.opts.invisibleSpace),e=e.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'$2 '+this.opts.invisibleSpace),e=e.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'$2 '+this.opts.invisibleSpace),e=e.replace(/\[email\]([^"]+?)\[\/email]/gi,'$1 '+this.opts.invisibleSpace),e=e.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'$2 '+this.opts.invisibleSpace),e=e.replace(/\[(b|i|s|sub|sup|u)\]\[\1\]/gi,"[$1]"),e=e.replace(/\[(\/(?:b|i|s|sub|sup|u))\]\[\1\]/gi,"[$1]"),e=e.replace(/\[(b|i|s|sub|sup|u)\]\[\/\1\]/gi,""),e=e.replace(/\[b\]([\s\S]*?)\[\/b]/gi,function(e,t){return this.wbbcode._expandFormatting(t,""," ")}.bind(this)),e=e.replace(/\[i\]([\s\S]*?)\[\/i]/gi,function(e,t){return this.wbbcode._expandFormatting(t,""," ")}.bind(this)),e=e.replace(/\[u\]([\s\S]*?)\[\/u]/gi,function(e,t){return this.wbbcode._expandFormatting(t,""," ")}.bind(this)),e=e.replace(/\[s\]([\s\S]*?)\[\/s]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"","")}.bind(this)),e=e.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,function(e,t){return this.wbbcode._expandFormatting(t,""," ")}.bind(this)),e=e.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,function(e,t){return this.wbbcode._expandFormatting(t,""," ")}.bind(this)),e=e.replace(/\[img\]([^"]+?)\[\/img\]/gi,' '),e=e.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(e,t,i){var a="float: "+i+";";return a+="left"===i?"margin: 0 15px 7px 0":"margin: 0 0 7px 15px",' '}),e=e.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(e,t,i,a){var r="float: "+i+"; width: "+a+"px;";return r+="left"===i?"margin: 0 15px 7px 0":"margin: 0 0 7px 15px",' '}),e=e.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,' '),e=e.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,''," ")}.bind(this)),e=e.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,''," ")}.bind(this)),e=e.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,''," ")}.bind(this)),e=e.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'',"
")}.bind(this));var r=e.indexOf("[list");if(r>0){var n=e.substr(0,r);n=n.replace(/\[\*\]/g,""),e=n+e.substr(r)}var l=e.lastIndexOf("[/list]");if(-1===l)e=e.replace(/\[\*\]/g,""),e=e.replace(/\[list[^\]]*\]/g,"");else{var n=e.substr(l+7);n=n.replace(/\[\*\]/g,""),e=e.substr(0,l+7)+n}e=e.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(e,t){return""+$.trim(t)+" "}),e=e.replace(/\n*(\[list\]<\/li>)/g,"$1"),e=e.replace(/\[list\]/gi,""),e=e.replace(/\[list=1\]/gi,''),e=e.replace(/\[list=a\]/gi,''),e=e.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,''),e=e.replace(/\[\/list\]/gi," "),e=e.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(e,t){return"[table]"+$.trim(t)+"[/table]"}),e=e.replace(/\[table\]\n*/gi,''),e=e.replace(/\[\/table\](\n*)?/gi,function(e,t){return t?(t.match(/\n/g).length>2&&(t=t.replace(/^\n/,"")),"
"+t):"
"}),e=e.replace(/\[tr\]\n*/gi,""),e=e.replace(/\[\/tr\]\n*/gi," "),e=e.replace(/\[td\]\n*/gi,""),e=e.replace(/\[\/td\]\n*/gi," "),e=e.replace(/([\S\s]*?)<\/td>/gi,function(e,t){var i=$.trim(t);return i.length||(i="")," "+i+" "});var o=this.wutil.getOption("woltlab.attachmentUrl"),c=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(o){var s=this.wbbcode._getImageAttachments();e=e.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(e,t){return t=parseInt(t),void 0!==s[t]?' ':e}),e=e.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(e,t,i){if(t=parseInt(t),void 0!==s[t]){var a="";return("left"===i||"right"===i)&&(a="float: "+i+";",a+="left"===i?"margin: 0 15px 7px 0":"margin: 0 0 7px 15px"),a=' style="'+a+'"',' "}return e}),e=e.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(e,t,i,a){if(t=parseInt(t),void 0!==s[t]){var r="width: "+a+"px; max-height: "+s[t].height+"px; max-width: "+s[t].width+"px;";return("left"===i||"right"===i)&&(r+="float: "+i+";",r+="left"===i?"margin: 0 15px 7px 0":"margin: 0 0 7px 15px"),r=' style="'+r+'"',' "}return e})}for(var d in __REDACTOR_SMILIES){var h=d.replace(//g,">"),p=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(h)+"(?=\\s|<|$)","gi");e=e.replace(p,'$1 ')}e=e.replace(/(javascript):/gi,"$1 :"),e=e.replace(/(\r|\r\n)/g,"\n");for(var g=[],u=[],f=e.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i),m=WCF.getUUID();;){for(var v=!1,b=0;b[\s\S]*?<\/li>)/g,function(e){e=$.trim(e).replace(/\n/g," ");var t=WCF.getUUID();return _.push({key:t,content:e}),t});var n=e.split("\n");e="";for(var b=0,k=n.length;k>b;b++){var R=$.trim(n[b]);if(R.match(/^<([a-z]+)/)||R.match(/<\/([a-z]+)>$/))if(this.reIsBlock.test(RegExp.$1.toUpperCase())||"TABLE"===RegExp.$1.toUpperCase())if(R.match(/^<([a-z]+).*<\/\1>/)||R.match(/<\/table>$/))e+=R;else{if(R.match(/<\/p>$/)&&k>b+1){e+=R,0===$.trim(n[b+1]).indexOf("
");continue}e+=R+" "}else e+=""+R+"
";else{if(R){if(R.match(/^@@([0-9\-]+)@@$/)&&WCF.inArray(RegExp.$1,u)){e+=R;continue}}else R=" ";e+=""+R+"
"}}if(e=e.replace(/([\s\S]+?)<\/td>/g,function(e,t){t=t.replace(/ (<[uo]l)/g,"$1");var i=document.createElement("div");i.innerHTML=t;var a,r,n,l=["BR","DIV","OL","P","TABLE","UL"],o=[],c=function(e){o.length>0&&(n=document.createElement("p"),o.forEach(function(e){n.appendChild(e)}),i.insertBefore(n,e),n.nextElementSibling&&"BR"===n.nextElementSibling.nodeName&&i.removeChild(n.nextElementSibling),o=[])},s=[];for(a=0,r=i.childNodes.length;r>a;a++)s.push(i.childNodes[a]);s.forEach(function(e){return e.nodeType===Node.ELEMENT_NODE&&-1!==l.indexOf(e.nodeName)?void c(e):void o.push(e)}),c(null);var d,h,p=i.querySelectorAll("p");for(a=0,r=p.length;r>a;a++)if(n=p[a],""===n.style.getPropertyValue("text-align"))if(d=document.createElement("br"),h=n.parentNode,1!==n.childElementCount||"BR"!==n.children[0].nodeName||""!==n.textContent.trim().replace(/\u200B/g,"")){for(n.appendChild(d);n.childNodes.length>0;)h.insertBefore(n.childNodes[0],n);h.removeChild(n)}else h.insertBefore(d,n),h.removeChild(n);return i.childElementCount>0&&(d=i.children[i.childElementCount-1],"BR"===d.nodeName&&i.removeChild(d))," "+i.innerHTML+" "}),_.length)for(var b=_.length-1;b>=0;b--)e=e.replace(_[b].key,_[b].content);if(g.length)for(var T=function(e){return e.replace(/^['"]/,"").replace(/['"]$/,"")},L=this,F=function(e){return e.replace(/\[quote(=(['"]).+?\2)?\]([\S\s]*)\[\/quote\]/gi,function(e,t,i,a){var r="",n="";if(t){switch(t=t.substr(1),t=t.split(","),t.length){case 1:r=t[0];break;case 2:r=t[0],n=t[1]}r=WCF.String.escapeHTML(T($.trim(r))),n=WCF.String.escapeHTML(T($.trim(n)))}var l=''+L.wbbcode._buildQuoteHeader(r,n)+' ';a=$.trim(a);var o="";if(a.length){var c=[];a=a.replace(/(<(ol|ul)[^>]*>[\s\S]+?<\/\2>)/g,function(e){var t=WCF.getUUID();return c.push({hash:t,content:e}),"@@"+t+"@@"});for(var s=a.split("\n"),d=0;d"+h+" "}if(c.length)for(var d=0,p=c.length;p>d;d++){var g=c[d].content;g=g.replace(/(
[\s\S]*?<\/li>)/g,function(e){return $.trim(e).replace(/\n/g," ")}),o=o.replace(new RegExp("@@"+c[d].hash+"@@"),g)}}else o=""+L.opts.invisibleSpace+"
";return l+=o,l+=""})},b=g.length-1;b>=0;b--){var B=g[b],N=new RegExp("@@"+B.hashCode+"@@","g");e=e.replace(N,F(B.content))}if(e=e.replace(/<(?:div|p)><(blockquote|div)/g,"<$1"),e=e.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"$1>"),i.length)for(var b=i.length-1;b>=0;b--){var A=i[b],N=new RegExp("@@"+A.key+"@@","g"),O=A.value;O=O.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,function(e,t){var i=t.split("\n");t="";for(var a=0,r=i.length;r>a;a++){var n=i[a];if(n.length)t.length&&(t+=""),t+="[tt]"+n+"[/tt]";else{if(0===a||a+1===r)continue;t+=t.match(/\[\/tt\]$/)?"
"+this.opts.invisibleSpace:"
"}}return t}.bind(this)),O=O.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,function(e,t,i){var a="plain",r=0,n="";if(t){t=t.substring(1),t=t.split(",");var l=function(e){return e.match(/^\d+$/)},o=function(e){return-1!==e.indexOf(".")||e.match(/^(["']).*\1$/)},c=function(e){return void 0!==__REDACTOR_CODE_HIGHLIGHTERS[e]},s=function(e){return e.replace(/^(["'])(.*)\1$/,"$2")};switch(t.length){case 1:l(t[0])?r=parseInt(t[0])>1?t[0]:0:o(t[0])?n=s(t[0]):c(t[0])&&(a=t[0]);break;case 2:l(t[0])?(r=parseInt(t[0])>1?t[0]:0,c(t[1])?a=t[1]:o(t[1])&&(n=s(t[1]))):(c(t[0])&&(a=t[0]),o(t[1])&&(n=s(t[1])));break;case 3:c(t[0])&&(a=t[0]),l(t[1])&&(r=t[1]),o(t[2])&&(n=s(t[2]))}}i=i.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);for(var d="",h=0;h"+p+"
"}return'
"+__REDACTOR_CODE_HIGHLIGHTERS[a]+(n?": "+WCF.String.escapeHTML(n):"")+' '+d+" "}.bind(this)),e=e.replace(N,O)}return e=e.replace(/ /g,"&nbsp;"),t={data:e},WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",t),e=t.data},_expandFormatting:function(e,t,i){if(!e.length)return t+this.opts.invisibleSpace+i;var a=e.indexOf("[/td]");if(-1!==a){var r=e.substring(0,a);if(-1===r.indexOf("[td]"))return t+r+i+e.substring(a)}var r=e.split("\n");e="";for(var n=0,l=r.length;l>n;n++){var o=r[n];0===o.length&&(o=this.opts.invisibleSpace),e.length&&(e+="\n"),e+=t+o+i}return e},_pasteBeforeCallback:function(e){var t={1:24,2:22,3:18,4:14,5:12,6:10};return e=e.replace(/
]*)>/g,function(e,i,a){if(a&&a.match(/style="([^"]+?)"/)&&/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var r=$('
').appendTo(document.body),n=parseInt(r[0].clientWidth);r.remove();var l=-1,o=!1;$.each(t,function(e,i){-1===l?l=e:Math.abs(n-i)l?parseInt(l)+1:l),i=l}return"[size="+t[i]+"]"}),e=e.replace(/<\/h[1-6]>/g,"[/size]"),(//g,"")),e=e.replace(/ <\/o:p>/g," "),e=e.replace(/<(article|header)[^>]+>/g,""),e=e.replace(/<\/(article|header)>/g,"
"),e=e.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,""),e=e.replace(/<\/(div|p)><\/(div|p)>/g,"
"),e=e.replace(/<(?:div|p|span)[^>]+>/gi,function(e){return e.replace(/ class="[^"]+"/,"")}),e=e.replace(/<\/?wbr[^>]*>/g,""),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:e}),e},_pasteCallback:function(e){return e=e.replace(/\[size=(\d+)\]/g,''),e=e.replace(/\[\/size\]/g,"
"),e=e.replace(/style="([^"]+)"/,function(e,t){for(var i=t.split(";"),a=[],r=0,n=i.length;n>r;r++){var l=i[r];l.match(/^\s*background-color/)||a.push(l)}return'style="'+a.join(";")+'"'}),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:e}),e},insertAttachment:function(e,t){e=parseInt(e);var i=this.wutil.getOption("woltlab.attachment"+(t?"":"Thumbnail")+"Url"),a=this.wbbcode._getImageAttachments();if(i&&void 0!==a[e]){var r="";t&&(r=' style="width: '+a[e].width+"px; max-height: "+a[e].height+"px; max-width: "+a[e].width+'px;"'),this.wutil.insertDynamic(' ","[attach="+e+(t?",none,"+a[e].width:"")+"][/attach]")}else this.wutil.insertDynamic("[attach="+e+"][/attach]")},removeAttachment:function(e){this.opts.visual&&this.$editor.find("img.redactorEmbeddedAttachment").each(function(t,i){var a=$(i);a.data("attachmentID")==e&&a.remove()})},_getImageAttachments:function(){var e=this.wutil.getOption("woltlab.attachmentImages")||[];if(e.length)return delete this.opts.attachmentImages,e;var t={imageAttachments:{}};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),t),t.imageAttachments},_keydownCallback:function(e){switch(e.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}this.selection.get();var t=this.selection.getCurrent(),i=this.selection.getParent();i=i?$(i):i;var a=i?i.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(e.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var r=!1;if(a.length){for(var n=!0,l=0;lt;t++){var a=this.$editor[0].children[t];if(a.nodeType===Node.ELEMENT_NODE&&"P"===a.tagName&&!(a.textContent.length>0||a.children.length>1||"BR"===a.children[0].tagName)){for(a=a.children[0];1===a.children.length;)a=a.children[0];if(0===a.children.length&&"BR"===a.tagName){var r=a.parentNode,n=document.createTextNode("");r.appendChild(n),r.removeChild(a)}}}}},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this));
},_observeQuotesClick:function(e){var t=$(e.currentTarget).closest("header"),i=$(' ');$(' '+WCF.Language.get("wcf.bbcode.quote.edit")+" ").on("click touchstart",$.proxy(function(t){t.preventDefault(),t.stopPropagation(),this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),!1),$(".redactor-link-tooltip").remove()},this)).appendTo(i),$(''+WCF.Language.get("wcf.bbcode.quote.delete")+" ").on("click touchstart",function(e){e.preventDefault(),e.stopPropagation();var i=t.parent(),a=i.parent();i.remove(),$(".redactor-link-tooltip").remove(),"BLOCKQUOTE"===a[0].nodeName&&0===a.children("div").length&&$("
").appendTo(a)}).appendTo(i);var a=t.offset();i.css({left:a.left+"px",top:a.top+20+"px"}),$(".redactor-link-tooltip").remove(),i.appendTo(document.body),this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each(function(e,t){var i=$(t),a=i.find(".redactorEditCodeBox");a.length||(a=$(''+WCF.Language.get("wcf.bbcode.code.edit")+"
").insertAfter(i.find("> div > div > h3"))),a.off("click.wbbcode").on("click.wbbcode",function(){this.wbbcode._handleInsertCode(i,!1)}.bind(this))}.bind(this))},_openQuoteEditOverlay:function(t,i){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(i?"insert":"edit")),400);var a=this.modal.createActionButton(this.lang.get("save"));i?(this.selection.save(),a.click($.proxy(function(){var t=$("#redactorQuoteAuthor").val(),i=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore(),e=!0;var a=this.selection.getHtml();this.utils.isEmpty(a)&&(a="");var r=this.wbbcode.insertQuoteBBCode(t,i,a);null!==r&&(a.length||($.browser.mozilla&&r.children("br[type=_moz]").replaceWith(""+this.opts.invisibleSpace+"
"),this.caret.setStart(r.children("div")[0]))),this.modal.close()},this))):($("#redactorQuoteAuthor").val(t.data("author")),$("#redactorQuoteLink").val(WCF.String.unescapeHTML(t.attr("cite"))),a.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();t.data("author",e),t.attr("data-author",e),t.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val())),this.wbbcode._updateQuoteHeader(t),this.modal.close()},this))),this.modal.show()},_updateQuoteHeader:function(e){var t=e.data("author"),i=e.attr("cite");i&&(i=WCF.String.escapeHTML(i)),e.find("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(t,i))},insertQuoteBBCode:function(e,t,i,a){var r="[quote]",n="[/quote]";e&&(r=t?"[quote='"+e+"','"+t+"']":"[quote='"+e+"']");var l=null;if(this.wutil.inWysiwygMode()){var o="quote"+WCF.getUUID(),c="";a?c=this.wbbcode.convertToHtml(r+a+n):(c=this.wbbcode.convertToHtml(r+o+n),c=c.replace(o,i.replace(/^/,"").replace(/<\/p>$/,""))),c=c.replace(/^
/,"").replace(/<\/p>$/,""),c=c.replace(/
0)for(var u=0;u ").html(c)[0].innerHTML;var b=v.previousElementSibling;if(b&&"P"===b.nodeName&&""===b.innerHTML&&g.removeChild(b),v.outerHTML=c,l=this.$editor.find("#"+o),l.length){var w=l.find("> div");if(1===w.length)""===w[0].innerHTML&&(w[0].innerHTML=this.opts.invisibleSpace);else if($.browser.mozilla){var E=l.find("> div > br[type=_moz]");E.length&&($(""+this.opts.invisibleSpace+"
").insertBefore(E),E.remove())}l.removeAttr("id"),this.wutil.setCaretAfter(l[0]);var C=l[0].previousElementSibling;null!==C&&"P"===C.nodeName&&""===C.innerHTML&&(C=C.previousElementSibling,null===C||"P"!==C.nodeName||""!==C.innerHTML&&" "!==C.innerHTML||C.parentNode.removeChild(C.nextElementSibling))}this.wbbcode.observeQuotes(),this.wbbcode.fixBlockLevelElements(),this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else this.wutil.insertAtCaret(r+a+n);return this.wutil.saveSelection(),l},_buildQuoteHeader:function(e,t){var i="";return!e&&t&&(e=t,t=""),e?(t&&(i+=''),i+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(e)}),t&&(i+=" ")):i=""+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+" ",i},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,!0)},_handleInsertCode:function(e,t){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(t?"insert":"edit")),400);var i=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(t){this.selection.get();var a=this.selection.getText();$.browser.mozilla&&(a=a.replace(/\r/g,"").replace(/\u200b/g,""),a=a.replace(/(\n+)/g,function(e,t){var i=t.match(/\n/g).length;for(i=~~(i/2),t="";i>0;)t+="\n",i--;return t})),this.selection.save(),this.modal.show();var r=$("#redactorCodeBox").focus();r.val(a),i.click($.proxy(function(){var e=$("#redactorCodeBox"),t=$("#redactorCodeFilename"),i=$("#redactorCodeHighlighter"),a=$("#redactorCodeLineNumber"),r=e.val().replace(/^\n+/,"").replace(/\n+$/,"");if(0===$.trim(r).length)return void(e.next("small.innerError").length||$(''+WCF.Language.get("wcf.global.form.error.empty")+" ").insertAfter(e));var n=$.trim(t.val().replace(/['"]/g,"")),l="[code="+i.val()+","+a.val()+(n.length?",'"+n+"'":"")+"]";l.match(/\[code=([^,]+),(\d+)\]/)&&(l="[code="+RegExp.$2+","+RegExp.$1+"]"),l+=r,l+="[/code]",this.wutil.adjustSelectionForBlockElement(),this.wutil.saveSelection();var o=this.wbbcode.convertToHtml(l);this.buffer.set(),this.insert.html(o,!1);var e=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings(),this.wbbcode.fixBlockLevelElements(),e.attr("contenteditable","false"),this.wutil.setCaretAfter(e[0]),this.modal.close()},this))}else{var n=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));n.click(function(){this.buffer.set(),e.remove(),this.modal.close()}.bind(this)),this.modal.show();var r=$("#redactorCodeBox").focus(),l=$("#redactorCodeFilename"),o=$("#redactorCodeHighlighter"),c=$("#redactorCodeLineNumber");o.val(e.data("highlighter")),l.val(e.data("filename")||"");var s=e.find("> div > ol");c.val(parseInt(s.prop("start")));var d="";s.children("li").each(function(e,t){d+=$(t).text().replace(/^\u200b$/,"")+"\n"}),r.val(d.replace(/^\n+/,"").replace(/\n+$/,"")),i.click($.proxy(function(){var t=r.val().replace(/^\n+/,"").replace(/\n+$/,"");if(0===$.trim(t).length)return void(r.next("small.innerError").length||$(''+WCF.Language.get("wcf.global.form.error.empty")+" ").insertAfter(r));var i=o.val();e.data("highlighter",i),e.attr("data-highlighter",i);var a=__REDACTOR_CODE_HIGHLIGHTERS[i],n=$.trim(l.val().replace(/['"]/g,""));n?(a+=": "+WCF.String.escapeHTML(n),e.data("filename",n),e.attr("data-filename",n)):(e.removeAttr("data-filename"),e.removeData("filename")),e.data("highlighter",o.val()),e.find("> div > div > h3").html(a);var s=e.find("> div > ol").empty(),d=parseInt(c.val());s.prop("start",d>1?d:1),t=t.split("\n");for(var h,p="",g=0;g"+(h.length?WCF.String.escapeHTML(h):this.opts.invisibleSpace)+"";s.append($(p)),this.modal.close()},this))}},fixBlockLevelElements:function(){var e=function(e,t){var i=e[t];i&&i.nodeType===Node.ELEMENT_NODE&&"P"===i.tagName&&(i.innerHTML.length||i.parentElement.removeChild(i))}.bind(this);this.$editor.find("blockquote, .codeBox").each(function(){e(this,"previousElementSibling"),e(this,"nextElementSibling")})},fixFormatting:function(){for(var e=function(t){t.style.removeProperty("text-align");for(var i=0;it;t++)this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[t]);for(var n={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"},i={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")},a=this.wutil.getOption("buttons"),o="",t=0,e=a.length;e>t;t++){var s=a[t];if("separator"!=s){var r=this.button.get(s);r.length?(n[s]&&this.button.setAwesome(s,n[s]),"table"===s&&o&&r.parent().insertAfter(this.button.get(o).parent())):this.wbutton._addCoreButton(s,i[s]?i[s]:null,n[s]?n[s]:null,o),o=s}else this.button.get(o).parent().addClass("separator")}if(this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this)),this.utils.isDesktop()){var l=this.button.addAfter("html","undo",WCF.Language.get("wcf.bbcode.button.undo")),u=this.button.addAfter("undo","redo",WCF.Language.get("wcf.bbcode.button.redo"));this.button.addCallback(l,this.buffer.undo),this.button.addCallback(u,this.buffer.redo),u.parent().addClass("separator")}},_addCoreButton:function(t,e,n,i){var a={title:null===e?t:e};("subscript"===t||"superscript"===t)&&(a.command=t);var o=this.button.build(t,a);$(" ").append(o).insertAfter(this.button.get(i).parent()),null!==n&&this.button.setAwesome(t,n)},_addBBCodeButton:function(t){var e="__wcf_"+t.name,n=this.button.add(e,t.label);this.button.addCallback(n,this.wbutton._insertBBCode),this._bbcodes[e]={name:t.name,voidElement:t.voidElement===!0},t.icon.match(/^fa\-[a-z\-]+$/)?this.button.setAwesome(e,t.icon):n.css("background-image","url("+__REDACTOR_ICON_PATH+t.icon+")")},_insertBBCode:function(t){var e=this._bbcodes[t].name,n={buttonName:t,cancel:!1,redactor:this};if(WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+e+"_"+this.$textarea.wcfIdentify(),n),n.cancel===!1){var i=this.selection.getHtml();i=i.replace(/@@@wcf_empty_line@@@<\/p>/g,"
");if(this.buffer.set(),this.utils.browser("mozilla")&&!i.length){var a=getSelection().getRangeAt(0).startContainer;a.nodeType===Node.ELEMENT_NODE&&"P"===a.tagName&&" "===a.innerHTML&&a.removeChild(a.children[0])}this._bbcodes[t].voidElement?this.insert.html(i+this.selection.getMarkerAsHtml()+"["+e+"]",!1):this.insert.html("["+e+"]"+i+this.selection.getMarkerAsHtml()+"[/"+e+"]",!1),this.selection.restore()}},insertImage:function(){this.image.show()},_insertImage:function(){var t=$("#redactor-image-link-source"),e=t.val().trim();if(e.length){this.buffer.set();var n=$("#redactor-image-align").val(),i="";("left"===n||"right"===n)&&(i=' style="float: '+n+'"'),this.insert.html(' ",!1),this.modal.close(),this.observe.images()}else t.next("small.innerError")||$(''+WCF.Language.get("wcf.global.form.error.empty")+" ").insertAfter(t)}}};
// wfontcolor.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontcolor=function(){"use strict";return{init:function(){var o=this.button.addDropdown(this.button.get("fontcolor"));this.wfontcolor._createDropdown(o)},_createDropdown:function(o){for(var F=["#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"],t=$(' '),r=0,n=F.length;n>r;r++){var e=F[r],l=$(' ').data("color",e).css("background-color",e);t.append(l),l.click($.proxy(this.wfontcolor._onColorPick,this))}var i=$(' ').html(this.lang.get("none")).data("color","none");i.click($.proxy(this.wfontcolor._onColorPick,this)),t.appendTo(o),$(' ').appendTo(o),i.appendTo(o),i.wrap(" ")},_onColorPick:function(o){o.preventDefault();var F=$(o.currentTarget).data("color");"none"===F?this.inline.removeStyleRule("color"):this.inline.format("span","style","color: "+F+";")}}};
// wfontfamily.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontfamily=function(){"use strict";return{init:function(){var a=this.button.addDropdown(this.button.get("fontfamily"));this.wfontfamily._createDropdown(a)},_createDropdown:function(a){var e={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"},i=this;$.each(e,function(e,n){var o=$(''+e+" ").appendTo(a),r=o.children("a").data("fontFamily",n).css("font-family",n);r.click(function(a){a.preventDefault(),i.inline.format("span","style","font-family: "+$(this).data("fontFamily")+";")})}),$(' ').appendTo(a);var n=$(''+this.lang.get("none")+" ").appendTo(a);n.children("a").click(function(a){a.preventDefault(),i.inline.removeStyleRule("font-family")})}}};
// wfontsize.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wfontsize=function(){"use strict";return{init:function(){var t=this.button.addDropdown(this.button.get("fontsize"));this.wfontsize._createDropdown(t)},_createDropdown:function(t){for(var n=[8,10,12,14,18,24,36],e=this,i=0;i'+o+" ").appendTo(t),r=a.children("a").data("fontSize",o).css("font-size",o+"pt");o>18&&r.css("line-height","1em"),r.click(function(t){t.preventDefault(),e.inline.format("span","style","font-size: "+$(this).data("fontSize")+"pt;")})}$(' ').appendTo(t);var a=$(''+this.opts.curLang.none+" ").appendTo(t);a.children("a").click(function(t){t.preventDefault(),e.inline.removeStyleRule("font-size")})}}};
// wmonkeypatch.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wmonkeypatch=function(){"use strict";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 e=this.$textarea.wcfIdentify();this.wutil.setOption("keydownCallback",function(t){var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keydown_"+e,i),i.cancel?!1:!0}),this.wutil.setOption("keyupCallback",function(t){this.wutil.saveSelection();var i={cancel:!1,event:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","keyup_"+e,i),i.cancel?!1:!0}.bind(this)),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 t=!1;this.$editor.on("mousedown.wmonkeypatch",function(){t=!0}.bind(this)),$(document).on("mouseup.wmonkeypatch",function(){t&&(t=!1,this.wutil.saveSelection())}.bind(this));var i=function(e,t){t?!e.previousElementSibling||"P"!==e.previousElementSibling.tagName&&"DIV"!==e.previousElementSibling.tagName?this.wutil.setCaretBefore(e):this.caret.setEnd(e.previousElementSibling):!e.nextElementSibling||"P"!==e.nextElementSibling.tagName&&"DIV"!==e.nextElementSibling.tagName?this.wutil.setCaretAfter(e):this.caret.setEnd(e.nextElementSibling)}.bind(this),n=null;this.$editor.on("click.wmonkeypatch",function(e){if(e.target===this.$editor[0]){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(t&&t.collapsed){var a=t.startContainer,o=this.$editor.offset();if(null===n&&(n={left:this.$editor.cssAsNumber("padding-left"),top:this.$editor.cssAsNumber("padding-top")}),e.pageY<=o.top+n.top){var s=this.$editor[0].children[0];if("BLOCKQUOTE"!==s.tagName&&("DIV"!==s.tagName||!/\bcodeBox\b/.test(s.className)))return}else{if(e.pageX<=o.left+n.left)return;if(e.pageX>o.left+this.$editor.width())return}for(;a&&a!==this.$editor[0];){if(a.nodeType===Node.ELEMENT_NODE&&("BLOCKQUOTE"===a.tagName||"DIV"===a.tagName&&/\bcodeBox\b/.test(a.className))){var r=$(a).offset();return e.pageY<=r.top?i(a,!0):i(a,!1),!1}a=a.parentElement}}var l=this.$editor.children("blockquote, div.codeBox");return l.each(function(t,n){var a=$(n),o=a.offset();if(e.pageY<=o.top)return i(n,!0),!1;var s=a.outerHeight()+(parseInt(a.css("margin-bottom"),10)||0);return e.pageY<=o.top+s?(i(n,!1),!1):void 0}),!1}if("LI"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null,d=!1;if(null!==t){if(!t.collapsed)return;for(var a=t.startContainer;null!==a&&a!==this.$editor[0];){if("LI"===a.tagName){d=!0;break}a=a.parentElement}}if(!d||null===t){var c=document.createTextNode(""),s=e.target.children[0];s.appendChild(c),this.caret.setEnd(s)}}else if("BLOCKQUOTE"===e.target.tagName){var t=window.getSelection().rangeCount?window.getSelection().getRangeAt(0):null;if(null!==t&&t.collapsed){for(var h=null,a=t.startContainer.nodeType===Node.TEXT_NODE?t.startContainer.parentElement:t.startContainer;null!==a&&a!==this.$editor[0];){if("BLOCKQUOTE"===a.tagName){h=a;break}a=a.parentElement}null!==h&&h!==e.target&&(e.pageY<=$(h).offset().top?i(h,!0):i(h,!1))}}}.bind(this))},alignment:function(){var e=this.alignment.setBlocks;this.alignment.setBlocks=function(t){e.call(this,t),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","fixFormatting_"+this.$textarea.wcfIdentify())}.bind(this)},button:function(){var e=this.button.addDropdown;this.button.addDropdown=function(t,i){var n=e.call(this,t,i);return i||n.addClass("dropdownMenu"),n}.bind(this)},caret:function(){this.caret.set=function(e,t,i,n){if(this.utils.browser("msie")||(this.utils.isMobile()&&this.utils.browser("webkit")&&navigator.userAgent.match(/(iPad|iPhone|iPod)/i)?document.activeElement!==this.$editor[0]&&this.$editor.focus():this.$editor.focus()),e=e[0]||e,i=i[0]||i,this.utils.isBlockTag(e.tagName)&&""===e.innerHTML&&(e.innerHTML=this.opts.invisibleSpace),"BR"==e.tagName&&this.opts.linebreaks===!1){var a=$(this.opts.emptyHtml)[0];$(e).replaceWith(a),e=a,i=e}this.selection.get();try{this.range.setStart(e,t),this.range.setEnd(i,n)}catch(e){}this.selection.addRange()}.bind(this),this.caret.setOffset=function(e,t){"undefined"==typeof t&&(t=e),this.focus.isFocused()||this.focus.setStart();for(var i,n=document.createRange(),a=document.getSelection(),o=0,s=document.createTreeWalker(this.$editor[0],NodeFilter.SHOW_TEXT,null,null);i=s.nextNode();)if(o+=i.nodeValue.length,(o>e||e===t&&o===e)&&(n.setStart(i,i.nodeValue.length+e-o),e=1/0),o>=t){n.setEnd(i,i.nodeValue.length+t-o);break}a.removeAllRanges(),a.addRange(n)}.bind(this)},clean:function(){var e=function(e){return e=e.replace(/\u201D/g,"__wcf_preserve_character_1__"),e=e.replace(/\u201C/g,"__wcf_preserve_character_2__"),e=e.replace(/\u2018/g,"__wcf_preserve_character_3__"),e=e.replace(/\u2019/g,"__wcf_preserve_character_4__")},t=function(e){return e=e.replace(/__wcf_preserve_character_1__/g,"”"),e=e.replace(/__wcf_preserve_character_2__/g,"“"),e=e.replace(/__wcf_preserve_character_3__/g,"‘"),e=e.replace(/__wcf_preserve_character_4__/g,"’")},i=this.clean.onPaste;this.clean.onPaste=function(n,a){return this.opts.replaceDivs=!0,n=e(n),n=i.call(this,n,a),this.opts.replaceDivs=!1,t(n)}.bind(this),this.clean.onPasteRemoveEmpty=function(e){return e.replace(/ $/i,"")};var n=this.clean.removeSpaces;this.clean.removeSpaces=function(e){return e=e.replace(/\u200C/g,"__wcf_zwnj__"),e=e.replace(/\u200D/g,"__wcf_zwj__"),e=n.call(this,e),e=e.replace(/__wcf_zwnj__/g,""),e.replace(/__wcf_zwj__/g,"")};var a=this.clean.onSet;this.clean.onSet=function(i){return i=e(i),i=a.call(this,i),t(i)}.bind(this)},code:function(){var e=this.code.startSync;this.code.startSync=function(){this.code.syncCode=void 0,e.call(this)}.bind(this);var t=this.code.textareaIndenting;this.code.textareaIndenting=function(e){return 9!==e.keyCode||e.ctrlKey?!0:t.call(this,e)}.bind(this);var i=this.code.showCode;this.code.showCode=function(){var e=null;this.$textarea.is(":visible")||(e=this.$textarea.parentsUntil(":visible").last(),e.show()),i.call(this),null!==e&&e.hide()}.bind(this)},dropdown:function(){this.dropdown.build=function(e,t,i){t.addClass("dropdownMenu"),$.each(i,function(e,i){if("dropdownDivider"==e)$(' ').appendTo(t);else{var n=$(" "),a=$(''+i.title+" ");a.on("click",$.proxy(function(t){t.preventDefault();var n="func",a=i.func;i.command?(n="command",a=i.command):i.dropdown&&(n="dropdown",a=i.dropdown),this.button.onClick(t,e,n,a),this.dropdown.hideAll()},this)),a.appendTo(n),n.appendTo(t)}}.bind(this))}.bind(this);var e=this.dropdown.show;this.dropdown.show=$.proxy(function(i,n){var a=this.button.get(n).data("dropdown");t(a),$.browser.iOS&&this.wutil.saveSelection(),e.call(this,i,n),a.off("mouseover mouseout")},this);var t=function(e){if(!e.hasClass("dropdownMenu")){e.addClass("dropdownMenu");for(var t=e.children("a").detach(),i=0;i ").appendTo(e);n.append(t[i])}}}},image:function(){var e=this.image.setEditable;this.image.setEditable=function(t){t.hasClass("smiley")||(t.off("click.redactor touchstart.redactor"),e.call(this,t))}.bind(this);var t=this.image.loadEditableControls;this.image.loadEditableControls=function(e){if("redactor-image-box"===e[0].parentNode.id)return $("#redactor-image-resizer",this.$editor[0]);var i=t.call(this,e);return e.hasClass("redactorDisableResize")&&i!==!1&&i.hide(),i}.bind(this),this.image.show=function(){this.modal.load("image",this.lang.get("image"),0);var e=this.modal.createActionButton(this.lang.get("insert"));e.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 t=e.closest("a",this.$editor[0]);$("#redactor-image-link-source").val(e.attr("src")),$("#redactor-image-link-href").val(t.length?t.attr("href"):""),$("#redactor-image-align").val(e.css("float")),this.modal.show(),setTimeout(function(){$(".redactor-link-tooltip").remove()},1)}.bind(this);var i=function(e){var t=e.parent();e=e.detach(),e.prependTo(t)}.bind(this);this.image.update=function(e){this.image.hideResize(),this.buffer.set(),e.attr("src",$("#redactor-image-link-source").val()),this.image.setFloating(e);var t=e.css("float");("left"===t||"right"===t)&&i(e),this.caret.setAfter(e);var n=$("#redactor-image-link-href").val().trim(),a=e.closest("a",this.$editor[0]);if(a.length)if(""===n){a=a[0];for(var o=a.children.length,s=a.parentNode;o--;)s.insertBefore(a.children[0],a);s.removeChild(a)}else a.attr("href",n);else""!==n&&(a=document.createElement("a"),a.href=n,e[0].parentNode.insertBefore(a,e[0]),a.appendChild(e[0]));this.modal.close(),this.observe.images()}.bind(this)},indent:function(){var e=this.indent.increase;this.indent.increase=function(){var t=this.selection.getBlock();t&&"LI"===t.tagName&&t.parentElement.firstChild!==t&&e.call(this)}.bind(this)},inline:function(){var e=(function(e,t){for(var i=e.parent();i[0]!==this.$editor[0]&&!(i.children(":not(.redactor-selection-marker)").length>1);){if("SPAN"===i[0].tagName&&i[0].style.getPropertyValue(t)){i.contents().unwrap();break}i=i.parent()}}.bind(this),this.inline.format);this.inline.format=function(t,i,n){$.browser.iOS&&this.wutil.restoreSelection(),e.call(this,t,i,n)}.bind(this);var t=this.inline.removeStyleRule;this.inline.removeStyleRule=function(e){$.browser.iOS&&this.wuil.restoreSelection(),t.call(this,e)}.bind(this)},insert:function(){var e=$.browser.webkit||document.documentElement.style.hasOwnProperty("WebkitAppearance")||window.hasOwnProperty("chrome"),t=function(e){var t=this.$editor.html();if(this.utils.isEmpty(t)){var i=!1;e.match(/^<(blockquote|div|p)/i)&&(this.$editor.empty(),i=!0),this.$editor.focus(),i||this.caret.setEnd(this.$editor.children("p:eq(0)"))}else{var n=window.getSelection();if((document.activeElement!==this.$editor[0]||0===n.rangeCount)&&this.wutil.restoreSelection(),e.match(/^<(blockquote|div|p)/i)&&n.getRangeAt(0).collapsed){var a=n.getRangeAt(0).startContainer;a.nodeType===Node.TEXT_NODE&&""===a.textContent&&this.caret.setEnd($(a.parentElement).html(" "))}}}.bind(this),i=function(){var e=!1;this.$editor.find("span").each(function(){var t=$(this);if("redactor"!==t.data("verified")){var i=$("helper ").insertBefore(t);i.after(t.contents()),i.remove(),t.remove(),e=!0}}),e&&this.wutil.saveSelection()}.bind(this),n=this.insert.html;if(this.insert.html=function(a,o){t(a),n.call(this,a,o),this.wutil.saveSelection(),e&&setTimeout(function(){i()},10)}.bind(this),navigator.userAgent.match(/safari/i)){var a=this.insert.execHtml;this.insert.execHtml=function(e){try{a.call(this,e)}catch(e){console.debug("[Redactor.wmonkeypatch] Suppressed error in Safari: "+e.message)}}.bind(this)}},keydown:function(){this.keydown.enterWithinBlockquote=!1;var e=this.keydown.onTab;this.keydown.onTab=function(t,i){var n=this.selection.getBlock();return n&&"LI"===n.tagName?e.call(this,t,i):!0}.bind(this);var t=this.keydown.replaceDivToParagraph;this.keydown.replaceDivToParagraph=function(){this.keydown.enterWithinBlockquote?this.keydown.enterWithinBlockquote=!1:t.call(this)}.bind(this);var i=this.keydown.setupBuffer;this.keydown.setupBuffer=function(e,t){return!this.keydown.ctrl||89!==t||e.shiftKey||e.altKey||0===this.opts.rebuffer.length?void i.call(this,e,t):(e.preventDefault(),void this.buffer.redo())}.bind(this)},keyup:function(){var e=this.keyup.replaceToParagraph;this.keyup.replaceToParagraph=function(t){("DIV"!==this.keyup.current.tagName||"BLOCKQUOTE"!==this.keyup.current.parentElement.tagName)&&e.call(this,t)}.bind(this)},link:function(){var e=this.link.insert;this.link.insert=function(){this.link.$inputUrl[0].value=this.link.$inputUrl[0].value.trim().replace(/\u200B/,""),e.call(this),this.selection.get();var t=this.selection.getCurrent();t.nodeType===Node.TEXT_NODE&&(t=t.parentElement),"A"===t.tagName&&this.caret.setAfter(t)}.bind(this);var t=this.link.set;this.link.set=function(e,i,n){if(/\sEdge\//.test(window.navigator.userAgent)){e=$.trim(e.replace(/<|>/g,"")),this.selection.restore();{this.selection.getBlocks()}if(""===e&&""===i)return;if(""===e&&""!==i&&(e=i),this.link.$node)t.call(this,e,i,n);else{var a=$('').text(e);""!==n&&a.attr("target",n),a=$(this.insert.node(a)),this.selection.getText().match(/\s$/)&&a.after(" "),this.selection.selectElement(a),this.code.sync(),this.core.setCallback("insertedLink",a)}}else t.call(this,e,i,n);var o=window.getSelection();if(o.rangeCount){var s=o.getRangeAt(0);s.collapsed||(s.collapse(!1),this.wutil.saveSelection())}}.bind(this)},list:function(){var e=this.list.insert;this.list.insert=function(t){var i=window.getSelection();if(i.rangeCount){var n=i.getRangeAt(0);if(n.collapsed){var a=n.startContainer;if(a.nodeType===Node.TEXT_NODE&&(a=a.parentNode),"DIV"===a.nodeName&&"BLOCKQUOTE"===a.parentNode.nodeName){var o=document.createElement("div");a.parentNode.insertBefore(o,a),o.appendChild(a)}}}e.call(this,t)}.bind(this)},modal:function(){this.modal.dialog=null;var e=this.modal.addTemplate;this.modal.addTemplate=function(t,i){"table"!==t&&e.call(this,t,i)}.bind(this),this.modal.build=function(){},this.modal.load=function(e,t){this.modal.templateName=e,this.modal.title=t,this.modal.dialog=$("
").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 t=this.modal.createButton;this.modal.createButton=function(e,i){return null===this.$modalFooter&&(this.$modalFooter=$('
').appendTo(this.modal.dialog),this.modal.dialog.addClass("dialogForm")),t.call(this,e,i)}.bind(this),this.modal.close=function(){if(null!==this.modal.dialog){try{this.modal.dialog.wcfDialog("close")}catch(e){}finally{if(this.modal.dialog){var e=this.modal.dialog.parents(".dialogContainer:eq(0)");e.length&&setTimeout(function(){e.remove()},500)}}this.modal.dialog=null}}.bind(this),this.modal.createCancelButton=function(){return $()},this.modal.createDeleteButton=function(){return $()}},observe:function(){var e=function(e,t,i,n,a,o){var s=this.$toolbar.find(i);if(e&&0!=e.closest(t,this.$editor[0]).length)s[n?"removeClass":"addClass"](a);else{if(o&&!this.opts.visual)return;s[n?"addClass":"removeClass"](a)}}.bind(this),t=this.observe.buttons;this.observe.buttons=function(i,n){t.call(this,i,n);var a=this.selection.getParent();a=a===!1?null:$(a),e(a,"ul, ol","a.re-indent, a.re-outdent",!0,"redactor-button-disabled"),e(a,"blockquote.quoteBox","a.re-__wcf_quote",!1,"redactor-button-disabled",!0),e(a,"sub","a.re-subscript",!1,"redactor-act"),e(a,"sup","a.re-superscript",!1,"redactor-act")}.bind(this);var i=this.observe.load;this.observe.load=function(){i.call(this),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","observe_load_"+this.$textarea.wcfIdentify())}.bind(this);var n=this.observe.showTooltip;this.observe.showTooltip=function(e){var t=$(e.target);t.hasClass("redactorQuoteEdit")||n.call(this,e),$(".redactor-link-tooltip").each(function(e,t){var i,n,a,o=[];for(i=0,n=t.childNodes.length;n>i;i++)a=t.childNodes[i],a.nodeType===Node.TEXT_NODE&&o.push(a);for(i=0,n=o.length;n>i;i++)a=o[i],"|"===a.textContent.trim()&&a.parentNode.removeChild(a)})}.bind(this)},paste:function(){var e=this.paste.createPasteBox;this.paste.createPasteBox=function(){if($.browser.iOS){var t=0;if(window.getSelection().rangeCount){var i=window.getSelection().getRangeAt(0).endContainer;i.nodeType!==Node.ELEMENT_NODE&&(i=i.parentElement),i=$(i),t=$(i).offset().top}else t=$(window).scrollTop();this.$pasteBox=$("").html("").attr("contenteditable","true").css({position:"fixed",top:t+"px",fontSize:"16px"}),this.$box.parent().append(this.$pasteBox),this.$pasteBox.focus()}else e.call(this)}.bind(this);var t=function(){var e=window.getSelection();if(e.rangeCount){var t=e.getRangeAt(0);if(t.collapsed){var i=t.startContainer;if(i.nodeType===Node.ELEMENT_NODE&&"DIV"===i.tagName){var n=i.parentNode;if(null!==n&&"BLOCKQUOTE"===n.tagName&&n.classList.contains("quoteBox")){var a=t.startContainer.childNodes[t.startContainer.childNodes.length-1],o=document.createRange();o.setStart(t.startContainer.childNodes[0],0),o.setEnd(a,a.length),o.collapse(!1),e.removeAllRanges(),e.addRange(o)}}}}},i=this.paste.insert;this.paste.insert=function(e){t(),i.call(this,e),setTimeout(function(){if(this.wutil.fixDOM(),$.browser.msie)getSelection().getRangeAt(0).collapse(!1);else if($.browser.mozilla){var e=getSelection().getRangeAt(0);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 e=function(e,t){var i=t.nextSibling;null!==i&&i.nodeType===Node.TEXT_NODE&&0===i.length&&$(i).remove();var n=null;("selection-marker-1"===t.id&&!this.$editor.find("#selection-marker-2").length||"nodes-marker-1"===t.id&&!this.$editor.find("#nodes-marker-2").length)&&(n=t.previousSibling?t.previousSibling:null);var a=!1;$.browser.iOS&&t.innerHTML.replace(/\u200b/g,"").length?(t.outerHTML=t.innerHTML,a=!0):t.parentNode.removeChild(t),null!==n?(this.selection.implicitRange=document.createRange(),this.selection.implicitRange.setStartAfter(n),this.selection.implicitRange.setEndAfter(n),getSelection().removeAllRanges(),getSelection().addRange(this.selection.implicitRange)):this.selection.implicitRange=null,$.browser.iOS&&a&&window.setTimeout(function(){this.focus.setEnd()}.bind(this),10)}.bind(this);this.selection.selectElement=function(e){this.caret.set(e,0,e,1)}.bind(this),this.selection.removeMarkers=function(){this.$editor.find("span.redactor-selection-marker").each(e)}.bind(this),this.selection.removeNodesMarkers=function(){$(document).find("span.redactor-nodes-marker").each(e),this.$editor.find("span.redactor-nodes-marker").each(e)}.bind(this),this.selection.createMarkers=function(){this.selection.get();var e=this.selection.getMarker(1);if(this.selection.setMarker(this.range,e,!0),this.range.collapsed===!1){var t=this.selection.getMarker(2);this.selection.setMarker(this.range,t,!1);var i=document.createRange();i.setStartAfter(e),i.setEndBefore(t);var n=window.getSelection();n.removeAllRanges(),n.addRange(i)}this.savedSel=this.$editor.html()}.bind(this)},utils:function(){this.utils.removeEmpty=function(){}},rebuildTemplates:function(){this.opts.modal.image='
'+WCF.Language.get("wcf.bbcode.image.source")+' '+this.lang.get("link")+' '+this.opts.curLang.image_position+' '+WCF.Language.get("wcf.global.noSelection")+' '+this.lang.get("left")+' '+this.lang.get("right")+" ",this.opts.modal.imageEdit=this.opts.modal.image,this.opts.modal.link='
URL '+this.lang.get("text")+' ',this.opts.modal.quote='
'+WCF.Language.get("wcf.bbcode.quote.edit.author")+' '+WCF.Language.get("wcf.bbcode.quote.edit.link")+' ';var e="";$.each(__REDACTOR_CODE_HIGHLIGHTERS,function(t,i){return"plain"===t?!0:void(e+='
'+i+" ")}),this.opts.modal.code="
"+WCF.Language.get("wcf.bbcode.code.settings")+' '+WCF.Language.get("wcf.bbcode.code.highlighter")+' '+WCF.Language.get("wcf.bbcode.code.highlighter.none")+" "+e+""+WCF.Language.get("wcf.bbcode.code.highlighter.description")+' '+WCF.Language.get("wcf.bbcode.code.lineNumber")+' '+WCF.Language.get("wcf.bbcode.code.lineNumber.description")+' '+WCF.Language.get("wcf.bbcode.code.filename")+' '+WCF.Language.get("wcf.bbcode.code.filename.description")+" "+WCF.Language.get("wcf.bbcode.code")+' ',this.opts.modal.table='
'+this.lang.get("rows")+' '+this.lang.get("columns")+' '},fixWebKit:function(){return}}};
// wupload.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wupload=function(){"use strict";return{_boundGlobalUploadEvents:!1,_dropArea:{},_timer:null,_isDragging:!1,_isFile:!1,init:function(){var t=".redactor_"+this.$textarea.wcfIdentify();$(document).on("dragover"+t,$.proxy(this.wupload._dragOver,this)),$(document).on("dragleave"+t,$.proxy(this.wupload._dragLeave,this)),$(document).on("drop"+t,function(t){t.preventDefault(),this.wupload._revertDropArea(void 0,this.$textarea.wcfIdentify())}.bind(this)),this.wupload._boundGlobalUploadEvents||(this.wupload._boundGlobalUploadEvents=!0,$(document).on("dragend",function(t){t.preventDefault()})),WCF.System.Event.addListener("com.woltlab.wcf.attachment","autoInsert_"+this.$textarea.wcfIdentify(),$.proxy(this.wupload.insertPastedImageAttachment,this))},_dragOver:function(t){if(t=t.originalEvent,this.$editor.is(":visible")&&t.dataTransfer&&t.dataTransfer.types){var e=!1;for(var a in t.dataTransfer)if(/^moz/.test(a)){e=!0;break}if(this.wupload._isFile=!1,e)"application/x-moz-file"===t.dataTransfer.types[0]&&(this.wupload._isFile=!0);else for(var i=0;i
'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+" ").hide().appendTo(document.body),this.wupload._dropArea[r].on("dragover",$.proxy(this.wupload._hoverDropArea,this)).on("dragleave",$.proxy(this.wupload._revertDropArea,this)).on("drop",$.proxy(this.wupload._drop,this)));var o=this.wutil.inWysiwygMode()?this.$editor.getDimensions("outer"):this.$textarea.getDimensions("outer"),s=this.wutil.inWysiwygMode()?this.$editor.getOffsets("offset"):this.$textarea.getOffsets("offset");this.wupload._dropArea[r].css({height:o.height+"px",left:s.left+"px",lineHeight:o.height+"px",top:s.top+"px",width:o.width+"px"}).show(),this.wupload._isDragging=!0}t.preventDefault()}}},_hoverDropArea:function(){this.wupload._dropArea[this.$textarea.wcfIdentify()].addClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropNow"))},_revertDropArea:function(t,e){if(this.wupload._isFile){var a=e||this.$textarea.wcfIdentify();this.wupload._dropArea[a].removeClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")),e&&this.wupload._dropArea[a].hide()}},_dragLeave:function(){this.wupload._isDragging&&this.wupload._isFile&&(null===this.wupload._timer?this.wupload._timer=new WCF.PeriodicalExecuter(function(t){t.stop(),this.wupload._isDragging||this.wupload._dropArea[this.$textarea.wcfIdentify()].hide()}.bind(this),100):this.wupload._timer.resume(),this.wupload._isDragging=!1)},_drop:function(t){if(this.wupload._isFile&&(t=t.originalEvent||t,t.dataTransfer&&t.dataTransfer.files.length)){t.preventDefault();var e=this.$textarea.wcfIdentify();this.wupload._revertDropArea(void 0,e);for(var a=0;a ')},this))},insertPastedImageAttachment:function(t){var e=this.$editor.find("span.redactor-pastedImageFromClipboard-"+t.uploadID);e.before(t.attachment),e.remove()}}};
// wutil.js
if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wutil=function(){"use strict";var t="",e=null,i=!1,a=!1,n=null;return{_autosaveWorker:null,_range:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this)),this.wutil.getOption("woltlab.autosave").active&&(this.wutil.autosaveEnable(),this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")?this.wutil.setOption("woltlab.autosaveOnce",!0):this.wutil.autosaveRestore()),this.wutil.setOption("autosave",!1);var t=this.core.destroy;this.core.destroy=function(){this.wutil.autosaveDisable(),t.call(this)}.bind(this)},saveSelection:function(t){var e=getSelection();e.rangeCount?this.wutil._range=e.getRangeAt(0):t&&(this.wutil._range=null)},restoreSelection:function(){if(document.activeElement!==this.$editor[0]&&this.$editor.focus(),null!==this.wutil._range){var t=window.getSelection();t.removeAllRanges(),t.addRange(this.wutil._range),this.wutil._range=null}},clearSelection:function(){this.wutil._range=null},getSelection:function(){return this.wutil._range},insertAtCaret:function(t){if(this.opts.visual)return console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode."),!1;this.$textarea.focus();var e=this.$textarea.getCaret();-1==e&&console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.");var i=this.$textarea.val();return i=i.substr(0,e)+t+i.substr(e),this.$textarea.val(i),!0},insertDynamic:function(t,e){this.wutil.inWysiwygMode()?this.insert.html(t,!1):((void 0===e||null===e)&&(e=t),this.wutil.insertAtCaret(e))},setOption:function(t,e){-1!==t.indexOf(".")?(t=t.split(".",2),this.opts[t[0]][t[1]]=e):this.opts[t]=e},getOption:function(t){if(-1!==t.indexOf(".")){if(t=t.split(".",2),this.opts[t[0]][t[1]])return this.opts[t[0]][t[1]]}else if(this.opts[t])return this.opts[t];return null},inPlainMode:function(){return!this.opts.visual},inWysiwygMode:function(){return this.opts.visual},replaceRangesWith:function(t){getSelection().removeAllRanges(),getSelection().addRange(t)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(t)))}var e=$.trim(this.$textarea.val());return e=this.wutil._removeSuperfluousNewlines(e)},isEmptyEditor:function(){return this.opts.visual?this.utils.isEmpty(this.$editor.html()):!$.trim(this.$textarea.val())},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var t=$.trim(this.wbbcode.convertFromHtml(this.$textarea.val()));t=this.wutil._removeSuperfluousNewlines(t),this.$textarea.val(t)}this.wutil.autosavePurge()},_removeSuperfluousNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])\n/g,"$1");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_removeSuperfluousNewlines",e),e.text},addNewlines:function(t){t=t.replace(/(\[\/(?:align|code|quote)\])/g,"$1\n");var e={text:t};return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","wutil_addNewlines",e),e.text},reset:function(){this.opts.visual&&(this.$editor.html(""+this.opts.invisibleSpace+"
"),this.wutil.saveSelection()),this.$textarea.val(""),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(t){return this.wutil.getOption("woltlab.autosave").active||this.wutil.setOption("woltlab.autosave",{active:!0,key:t}),null===this.wutil._autosaveWorker&&(this.wutil.autosavePurgeOutdated(),this.wutil._autosaveWorker=new WCF.PeriodicalExecuter(function(){this.wutil.saveTextToStorage(!1)}.bind(this),15e3)),!0},saveTextToStorage:function(e){var s=this.wutil.getText();if(t!=s||e)try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:s,timestamp:Date.now()})),t=s,i=!0,null===n&&(n=new WCF.PeriodicalExecuter(function(t){if(a!==!0){if(i===!1)return t.stop(),void(n=null);this.wutil.autosaveShowNotice("saved"),i=!1}}.bind(this),12e4))}catch(t){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+t.message)}},autosaveDisable:function(){return this.wutil.getOption("woltlab.autosave").active?(this.wutil._autosaveWorker.stop(),this.wutil._autosaveWorker=null,this.wutil.setOption("woltlab.autosave",{active:!1,key:""}),!0):!1},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(t){console.debug("[wutil.autosavePurge] Unable to access local storage: "+t.message)}},autosaveRestore:function(){var t=this.wutil.getOption("woltlab.autosave"),e=null;try{e=localStorage.getItem(t.key)}catch(t){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+t.message)}try{e=null===e?null:JSON.parse(e)}catch(t){e=null}return null!==e&&e.content?t.lastEditTime&&1e3*t.lastEditTime>e.timestamp?(this.wutil.autosavePurge(),!1):t.prompt?(this.wutil.autosaveShowNotice("prompt",e),!1):(this.wutil.inWysiwygMode()?this.wutil.setOption("woltlab.originalValue",e.content):this.$textarea.val(e.content),this.wutil.autosaveShowNotice("restored",{timestamp:e.timestamp}),!0):!1},autosaveShowNotice:function(t,i){if(null===e){e=$('
'),e.appendTo(this.$box);var a=function(t){(null===t||"opacity"===t.originalEvent.propertyName)&&(e.hasClass("open")&&null!==t?e.data("callbackOpen")&&e.data("callbackOpen")():(e.data("callbackClose")&&e.data("callbackClose")(),e.removeData("callbackClose"),e.removeData("callbackOpen"),e.removeClass("redactorAutosaveNoticeIcons"),e.empty(),$(' ').appendTo(e)))}.bind(this);e.on("transitionend webkitTransitionEnd",a)}var n="";switch(t){case"prompt":$(' ').prependTo(e);var s=$(' ').appendTo(e),o=$(' ').appendTo(e);s.click(function(){this.wutil.replaceText(i.content),a(null),this.wutil.autosaveShowNotice("restored",i)}.bind(this)),o.click(function(){this.wutil.autosavePurge(),e.removeClass("open")}.bind(this)),n=WCF.Language.get("wcf.message.autosave.prompt"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){e.removeClass("open")},3e3)}.bind(this));break;case"restored":$(' ').prependTo(e);var s=$(' ').appendTo(e),o=$(' ').appendTo(e);s.click(function(){e.removeClass("open")}),o.click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),function(t){"confirm"===t&&(this.wutil.reset(),this.wutil.autosavePurge(),e.removeClass("open"))}.bind(this))}.bind(this)),n=WCF.Language.get("wcf.message.autosave.restored"),e.addClass("redactorAutosaveNoticeIcons");var r="";r=WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),function(){WCF.System.Event.removeListener("com.woltlab.wcf.redactor","keydown_"+this.$textarea.wcfIdentify(),r),setTimeout(function(){s.trigger("click")},3e3)}.bind(this));break;case"saved":if(e.hasClass("open"))return;setTimeout(function(){e.removeClass("open")},2e3),n=WCF.Language.get("wcf.message.autosave.saved")}e.children("span.redactorAutosaveMessage").text(n),e.addClass("open"),"saved"!==t&&WCF.DOMNodeInsertedHandler.execute()},autosavePurgeOutdated:function(){var t=0,e=this.wutil.getOption("woltlab.autosave").prefix,i=e+"_wcf_master";try{t=localStorage.getItem(i)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}if(0!==t){var a=Date.now()-6048e5;if(null===t||a>t){var n=new RegExp("^"+e+"_");for(var s in localStorage)if(s.match(n)&&s!==i){var o=localStorage.getItem(s);try{o=JSON.parse(o)}catch(t){o={timestamp:0}}if(null===o||!o.timestamp||o.timestamp i;i++){var n=t.charCodeAt(i).toString(16);"200b"!=n&&(e+=t[i])}return e},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var t=this.$editor.children(":last")[0];"P"===t.tagName?(""===t.innerHTML&&(t.remove(),t=$(this.opts.emptyHtml).appendTo(this.$editor)[0]),t.lastChild.nodeType===Element.TEXT_NODE?this.caret.set(t.lastChild,t.lastChild.length,t.lastChild,t.lastChild.length):this.caret.setEnd(t)):this.wutil.setCaretAfter(t),this.wutil.saveSelection()},adjustSelectionForBlockElement:function(){document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection();var t=getSelection().getRangeAt(0).startContainer;if(t===this.$editor[0]||this.utils.isRedactorParent(t)||this.wutil.selectionEndOfEditor(),getSelection().getRangeAt(0).collapsed){if(t=getSelection().getRangeAt(0).startContainer,t.nodeType===Node.TEXT_NODE&&""===t.textContent&&t.parentElement&&"P"===t.parentElement.tagName&&t.parentElement.parentElement===this.$editor[0])return;var e=t;e!==this.$editor[0]&&(e=$(t).parentsUntil(this.$editor[0]).last()),e[0]===document.body.parentElement?this.wutil.selectionEndOfEditor():this.caret.setAfter(e)}},isCaret:function(){return this.selection.get(),this.range.collapsed},isEndOfElement:function(t){var e=this.selection.implicitRange;if(null===e&&(this.selection.get(),e=this.range),!this.wutil.isCaret())return!1;if(e.endContainer.childNodes.length>e.endOffset)return!1;if(e.endContainer.nodeType===Element.TEXT_NODE&&e.endOffset"+this.opts.invisibleSpace+"
":""+this.opts.invisibleSpace+"
"),i[e?"insertBefore":"insertAfter"](t),this.caret.setEnd(i[0])},fixDOM:function(){for(var t=this.$editor[0].childNodes[0],e=t,i=null;e;)if(t=e,e=t.nextSibling,t.nodeType===Element.ELEMENT_NODE)this.reIsBlock.test(t.tagName)?i=null:(null===i&&(i=$("
").insertBefore(t)),i.append(t));else if(t.nodeType===Element.TEXT_NODE){if(null===i){if(e&&e.nodeType===Element.ELEMENT_NODE&&"P"===e.tagName&&""===e.innerHTML){var a=e.nextSibling;this.$editor[0].removeChild(e),e=a}i=$("
").insertBefore(t)}i.append(t)}for(var n=this.$editor[0].getElementsByTagName("li"),s=0,o=n.length;o>s;s++){var r=n[s];if(!r.innerHTML.length){var l=r.parentElement;l.children.length>1&&(r.parentElement.removeChild(r),s--,o--)}}for(var s=0,o=this.$editor[0].children.length;o>s;s++){var u=this.$editor[0].children[s];if(u.nodeType===Node.ELEMENT_NODE&&"P"===u.tagName)if("\n"!==u.innerHTML){if(!(u.textContent.length>0||u.children.length>1||1===u.children.length&&"BR"===u.children[0].tagName)){for(;1===u.children.length;)u=u.children[0];if(0===u.childNodes.length&&"BR"!==u.tagName){var c=document.createTextNode("");u.appendChild(c)}}}else u.parentElement.removeChild(u),s--,o--}for(var d=this.$editor[0].getElementsByTagName("INPUT");d.length;)d[0].parentNode.removeChild(d[0])}}};