Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Mon, 23 May 2016 16:35:49 +0000 (18:35 +0200)
committerwoltlab.com <woltlab@woltlab.com>
Mon, 23 May 2016 16:35:49 +0000 (18:35 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js

index a3ed0c0c4cffe36832ca554a02436ca86cea7668..6ce89644a48856766d2991452dd038766fb346b2 100644 (file)
@@ -1,8 +1,9 @@
 // table.js
 if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'<section id="redactor-modal-table-insert"><label>'+this.lang.get("rows")+'</label><input type="text" size="5" value="2" id="redactor-table-rows" /><label>'+this.lang.get("columns")+'</label><input type="text" size="5" value="3" id="redactor-table-columns" /></section>'},init:function(){var t={};t.insert_table={title:this.lang.get("insert_table"),func:this.table.show},t.insert_row_above={title:this.lang.get("insert_row_above"),func:this.table.addRowAbove},t.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow},t.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft},t.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight},t.add_head={title:this.lang.get("add_head"),func:this.table.addHead},t.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead},t.delete_column={title:this.lang.get("delete_column"),func:this.table.deleteColumn},t.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow},t.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable},this.observe.addButton("td","table"),this.observe.addButton("th","table");var e=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(e,t)},show:function(){this.modal.addTemplate("table",this.table.getTemplate()),this.modal.load("table",this.lang.get("insert_table"),300),this.modal.createCancelButton();var t=this.modal.createActionButton(this.lang.get("insert"));t.on("click",this.table.insert),this.selection.save(),this.modal.show(),$("#redactor-table-rows").focus()},insert:function(){var t,e,i,a,s=$("#redactor-table-rows").val(),l=$("#redactor-table-columns").val(),n=$("<div>"),r=Math.floor(99999*Math.random()),o=$('<table id="table'+r+'"><tbody></tbody></table>');for(t=0;s>t;t++){for(e=$("<tr>"),i=0;l>i;i++)a=$("<td>"+this.opts.invisibleSpace+"</td>"),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=$("<thead></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=$("<td>");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><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>"),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(),$('<li class="dropdownDivider" />').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.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=function(e){return null===e?!1:(e.nodeType===Node.ELEMENT_NODE&&"SPAN"===e.nodeName||e.nodeType===Node.TEXT_NODE)&&" "===e.textContent?!0:!1},o=n,c=n.parentElement;if(!l(n.previousSibling)){var s=document.createTextNode(" ");c.insertBefore(s,n)}if(!l(n.nextSibling)){var s=document.createTextNode(" ");c.lastChild===n?c.appendChild(s):c.insertBefore(s,n.nextSibling),o=s}var r=document.createRange();r.selectNode(o),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=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:e}),e=e.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1"),e=e.replace(/(<[^>]+?) rel="[^"]+"/g,"$1"),e=e.replace(/&#(8203|x200b);/g,""),e=e.replace(/&trade;/gi,"™"),e=e.replace(/&copy;/gi,"©"),e=e.replace(/&hellip;/gi,"…"),e=e.replace(/&mdash;/gi,"—"),e=e.replace(/&dash;/gi,"‐");var i={};e=e.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(e,t,a,r,n){var l=t+" "+a,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 i[s]={codeContent:n.replace(/<li>/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[^>]*?><\/a>/g,""),e=e.replace(/<p><\/p><table/g,"<table"),e=e.replace(/<\/table><p><\/p>/g,"</table>");for(var a in i)e=e.replace(new RegExp("<p></p>@@@"+a+"@@@<p></p>"),"@@@"+a+"@@@");e=e.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>"),e=e.replace(/<br( \/)?><\/p>/g,"</p>");for(var r=e.split(/(<\/?(?:div|p)>)/),n="",l="",o=0;o<r.length;o++){var c=r[o];"<p>"!=c&&"<div>"!=c&&("</p>"==c||"</div>"==c?(l=$.trim(l),"@@@wcf_empty_line@@@"!=l&&(l+="\n"),n+=l,l=""):0==o||o+1==r.length?n+=c:l+=c)}l&&(n+=l,l=""),e=n,e=e.replace(/@@@wcf_empty_line@@@/g,"\n"),e=e.replace(/\n\n$/,"\n"),e=e.replace(/<br>$/,""),e=e.replace(/<br>/g,"\n"),e=e.replace(/<br>/g,""),e=e.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\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(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]"),e=e.replace(/<a[^>]+><\/a>/,""),e=e.replace(/<a [^>]*?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(/<u>/gi,function(){return-1===t.indexOf("u")&&t.push("u"),"[u]"}),e=e.replace(/<\/u>/gi,"[/u]"),e=e.replace(/<sub>/gi,function(){return-1===t.indexOf("sub")&&t.push("sub"),"[sub]"}),e=e.replace(/<\/sub>/gi,"[/sub]"),e=e.replace(/<sup>/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 s=e.split(/(<\/?span[^>]*>)/),l=[],d=[],h="",p={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36},o=0;o<s.length;o++){var g=s[o];if("</span>"==g){var u=d.pop(),n=u.start+l.pop()+u.end;l.length?l[l.length-1]+=n:h+=n}else if(g.match(/^<span/))if(g.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var f,m,v=RegExp.$1;if(v.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var b=RegExp.$1,w=RegExp.$2,C=RegExp.$3,x="0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16)+("0123456789ABCDEF".charAt((w-w%16)/16)+""+"0123456789ABCDEF".charAt(w%16))+("0123456789ABCDEF".charAt((C-C%16)/16)+""+"0123456789ABCDEF".charAt(C%16));f="[color=#"+x+"]",m="[/color=#"+x+"]",-1===t.indexOf("color")&&t.push("color")}else v.match(/(?:^|;\s*)color: ?([^;]+);?/i)?(f="[color="+RegExp.$1+"]",m="[/color="+RegExp.$1+"]",-1===t.indexOf("color")&&t.push("color")):v.match(/font-size: ?(\d+)(pt|px);?/i)?"pt"==RegExp.$2?(f="[size="+RegExp.$1+"]",m="[/size="+RegExp.$1+"]",-1===t.indexOf("size")&&t.push("size")):p[RegExp.$1]?(f="[size="+p[RegExp.$1]+"]",m="[/size="+p[RegExp.$1]+"]",-1===t.indexOf("size")&&t.push("size")):(f="",m=""):v.match(/font-family: ?([^;]+);?/)?(f="[font='"+RegExp.$1.replace(/'/g,"")+"']",m="[/font='"+RegExp.$1.replace(/'/g,"")+"']",-1===t.indexOf("font")&&t.push("font")):(f='<span style="'+v+'">',m="</span>");l[l.length]="",d[l.length]={start:f,end:m}}else g.match(/^<span class="inlineCode">/)?(l[l.length]="",d[l.length]={start:"[tt]",end:"[/tt]"}):(l[l.length]="",d[l.length]={start:"",end:""});else l.length?l[l.length-1]+=g:h+=g}if(e=h,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 E=!0;E;)E=!1,e=e.replace(new RegExp("\\[\\/((?:"+t.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){return E=!0,"\n"});e=e.replace(new RegExp("\\[\\/("+t.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}e=e.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 "),e=e.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 "),e=e.replace(/<img([^>]*?)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<o.length;c++){var s=$.trim(o[c]);s.match(/^float: (left|right)$/)?n=RegExp.$1:s.match(/^width: (\d+)px$/)&&(l=RegExp.$1)}if(null!==l)return"[attach="+a+","+n+","+l+"][/attach]";if("none"!==n)return"[attach="+a+","+n+"][/attach]"}return"[attach="+a+"][/attach]"}),e=e.replace(/<img([^>]*)?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<s.length;d++){var h=s[d];h.match(/float: (left|right|none)/)?o=RegExp.$1:h.match(/width: (\d+)px/)&&(c=parseInt(RegExp.$1))}return c?"[img='"+a+"',"+o+","+c+"][/img]":"none"!==o?"[img='"+a+"',"+o+"][/img]":"[img]"+a+"[/img]"}),e=e.replace(/<li>/gi,"[*]"),e=e.replace(/<\/li>/gi,"\n"),e=e.replace(/<ul>/gi,"[list]"),e=e.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]"),e=e.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]"),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(/<table[^>]*>/gi,"[table]\n"),e=e.replace(/<\/table>\n?/gi,"[/table]\n"),e=e.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(e,t){return $.trim(t)}),e=e.replace(/<tr><\/tr>/gi,""),e=e.replace(/<tr>/gi,"[tr]\n"),e=e.replace(/<\/tr>/gi,"[/tr]\n"),e=e.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]"),e=e.replace(/(\t)*<td>(\t)*/gi,"[td]"),e=e.replace(/(\t)*<\/td>/gi,"[/td]\n");var y={};if(e.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(e){var t=e.hashCode();return y[t]=e.replace(/\$/g,"$$$$"),"@@"+t+"@@"}),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:e}),e=e.replace(/<[^(<|>)]+>/g,""),$.getLength(y))for(var S in y){var _=new RegExp("@@"+S+"@@","g");e=e.replace(_,y[S])}return $.getLength(i)&&$.each(i,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(/&lt;/g,"<"),e=e.replace(/&gt;/g,">"),e=e.replace(/&amp;/g,"&"),e=e.replace(/%28/g,"("),e=e.replace(/%29/g,")"),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:e}),e=$.trim(e),e.length&&(e+="\n"),e},convertToHtml:function(e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:e}),e=this.wutil.removeZeroWidthSpace(e),e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;");var t=[],i=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");e=e.replace(i,function(e){var i=e.hashCode();return t.push({key:i,value:e.replace(/\$/g,"$$$$")}),"@@"+i+"@@"}),e=e.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace),e=e.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace),e=e.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace),e=e.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace),e=e.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+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,"<strong>","</strong>")}.bind(this)),e=e.replace(/\[i\]([\s\S]*?)\[\/i]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<em>","</em>")}.bind(this)),e=e.replace(/\[u\]([\s\S]*?)\[\/u]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<u>","</u>")}.bind(this)),e=e.replace(/\[s\]([\s\S]*?)\[\/s]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<del>","</del>")}.bind(this)),e=e.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<sub>","</sub>")}.bind(this)),e=e.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<sup>","</sup>")}.bind(this)),e=e.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />'),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",'<img src="'+t+'" style="'+a+'" />'}),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",'<img src="'+t+'" style="'+r+'" />'}),e=e.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />'),e=e.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="font-size: '+t+'pt">',"</span>")}.bind(this)),e=e.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="color: '+t+'">',"</span>")}.bind(this)),e=e.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="font-family: '+t+'">',"</span>")}.bind(this)),e=e.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<p style="text-align: '+t+'">',"</p>")}.bind(this));var a=e.indexOf("[list");if(a>0){var r=e.substr(0,a);r=r.replace(/\[\*\]/g,""),e=r+e.substr(a)}var n=e.lastIndexOf("[/list]");if(-1===n)e=e.replace(/\[\*\]/g,""),e=e.replace(/\[list[^\]]*\]/g,"");else{var r=e.substr(n+7);r=r.replace(/\[\*\]/g,""),e=e.substr(0,n+7)+r}e=e.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(e,t){return"<li>"+$.trim(t)+"</li>"}),e=e.replace(/\n*(\[list\]<\/li>)/g,"$1"),e=e.replace(/\[list\]/gi,"<ul>"),e=e.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">'),e=e.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">'),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,'<ul style="list-style-type: $1">'),e=e.replace(/\[\/list\]/gi,"</ul>"),e=e.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(e,t){return"[table]"+$.trim(t)+"[/table]"}),e=e.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">'),e=e.replace(/\[\/table\](\n*)?/gi,function(e,t){return t?(t.match(/\n/g).length>2&&(t=t.replace(/^\n/,"")),"</table>"+t):"</table>"}),e=e.replace(/\[tr\]\n*/gi,"<tr>"),e=e.replace(/\[\/tr\]\n*/gi,"</tr>"),e=e.replace(/\[td\]\n*/gi,"<td>"),e=e.replace(/\[\/td\]\n*/gi,"</td>"),e=e.replace(/<td>([\S\s]*?)<\/td>/gi,function(e,t){var i=$.trim(t);return i.length||(i="&#8203;"),"<td>"+i+"</td>"});var l=this.wutil.getOption("woltlab.attachmentUrl"),o=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(l){var c=this.wbbcode._getImageAttachments();e=e.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(e,t){return t=parseInt(t),void 0!==c[t]?'<img src="'+o.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+t+'" />':e}),e=e.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(e,t,i){if(t=parseInt(t),void 0!==c[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+'"','<img src="'+o.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+t+'"'+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!==c[t]){var r="width: "+a+"px; max-height: "+c[t].height+"px; max-width: "+c[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+'"','<img src="'+l.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+t+'"'+r+" />"}return e})}for(var s in __REDACTOR_SMILIES){var d=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"),h=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(d)+"(?=\\s|<|$)","gi");e=e.replace(h,'$1<img src="'+__REDACTOR_SMILIES[s]+'" class="smiley" alt="'+d+'" />')}e=e.replace(/(javascript):/gi,"$1<span></span>:"),e=e.replace(/(\r|\r\n)/g,"\n");for(var p=[],g=[],u=e.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i),f=WCF.getUUID();;){for(var m=!1,v=0;v<u.length;v++){var b=u[v];if("[/quote]"===b.toLowerCase()){m=!0;for(var w="",C=u.slice(0,v),x=!1;C.length;){var E=C.pop();if(w=E+w,E.match(/^\[quote/i)){b=w+b;var y=WCF.getUUID();p.push({hashCode:y,content:b.replace(/\$/g,"$$$$")}),g.push(y),b="@@"+y+"@@",x=!0;break}}x||(C=u.slice(0,v),b=f),u=C.concat(b,u.slice(v+1));break}}if(!m)break}e=u.join(""),e=e.replace(new RegExp(f,"g"),"[/quote]"),e=e.replace(/\n*$/,"");var S=[];e=e.replace(/(<li>[\s\S]*?<\/li>)/g,function(e){e=$.trim(e).replace(/\n/g,"<br>");var t=WCF.getUUID();return S.push({key:t,content:e}),t});var r=e.split("\n");e="";for(var v=0,_=r.length;_>v;v++){var k=$.trim(r[v]);if(k.match(/^<([a-z]+)/)||k.match(/<\/([a-z]+)>$/))e+=this.reIsBlock.test(RegExp.$1.toUpperCase())||"TABLE"===RegExp.$1.toUpperCase()?k.match(/^<([a-z]+).*<\/\1>/)?k:k+"<br />":"<p>"+k+"</p>";else{if(k){if(k.match(/^@@([0-9\-]+)@@$/)&&WCF.inArray(RegExp.$1,g)){e+=k;continue}}else k="<br>";e+="<p>"+k+"</p>"}}if(e=e.replace(/<td>([\s\S]+?)<\/td>/g,function(e,t){return t=t.replace(/<br(?: \/)?>(<[uo]l)/g,"$1"),"<td>"+t.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"}),S.length)for(var v=S.length-1;v>=0;v--)e=e.replace(S[v].key,S[v].content);if(p.length)for(var R=function(e){return e.replace(/^['"]/,"").replace(/['"]$/,"")},T=this,L=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(R($.trim(r))),n=WCF.String.escapeHTML(R($.trim(n)))}var l='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+n+'" data-author="'+r+'"><header contenteditable="false"><h3>'+T.wbbcode._buildQuoteHeader(r,n)+'</h3><a class="redactorQuoteEdit"></a></header>';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<s.length;d++){var h=s[d];if(0===h.length)h=T.opts.invisibleSpace;else if(h.match(/^@@([0-9\-]+)@@$/)&&WCF.inArray(RegExp.$1,g)){o+=h;continue}o+="<div>"+h+"</div>"}if(c.length)for(var d=0,p=c.length;p>d;d++){var u=c[d].content;u=u.replace(/(<li>[\s\S]*?<\/li>)/g,function(e){return $.trim(e).replace(/\n/g,"<br>")}),o=o.replace(new RegExp("@@"+c[d].hash+"@@"),u)}}else o="<div>"+T.opts.invisibleSpace+"</div>";return l+=o,l+="</blockquote>"})},v=p.length-1;v>=0;v--){var F=p[v],A=new RegExp("@@"+F.hashCode+"@@","g");e=e.replace(A,L(F.content))}if(e=e.replace(/<(?:div|p)><(blockquote|div)/g,"<$1"),e=e.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>"),t.length)for(var v=t.length-1;v>=0;v--){var O=t[v],A=new RegExp("@@"+O.key+"@@","g"),B=O.value;B=B.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+="</p><p>"),t+="[tt]"+n+"[/tt]";else{if(0===a||a+1===r)continue;t+=t.match(/\[\/tt\]$/)?"</p><p>"+this.opts.invisibleSpace:"</p><p><br>"}}return t}.bind(this)),B=B.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<i.length;h++){var p=i[h];p.length||(p=this.opts.invisibleSpace),d+="<li>"+p+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+a+'"'+(n?' data-filename="'+WCF.String.escapeHTML(n)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[a]+(n?": "+WCF.String.escapeHTML(n):"")+'</h3></div><ol start="'+(r>1?r:1)+'">'+d+"</ol></div></div>"}.bind(this)),e=e.replace(A,B)}return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:e}),e=e.replace(/&amp;nbsp;/g,"&amp;amp;nbsp;")},_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(/<h([1-6])([^>]*)>/g,function(e,i,a){if(a&&a.match(/style="([^"]+?)"/)&&/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var r=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').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)<Math.abs(n-t[l])&&(l=e),n==i&&(o=!0)}),o||(l=6>l?parseInt(l)+1:l),i=l}return"[size="+t[i]+"]"}),e=e.replace(/<\/h[1-6]>/g,"[/size]"),(/<p class="MsoNormal/.test(e)||/margin-bottom: 0cm/.test(e))&&(e=e.replace(/([^>\s])\n([^<\s])/g,"$1 $2"),e=e.replace(/<a name="[^"]+">/g,"")),e=e.replace(/<o:p>&nbsp;<\/o:p>/g,"<br>"),e=e.replace(/<(article|header)[^>]+>/g,"<div>"),e=e.replace(/<\/(article|header)>/g,"</div>"),e=e.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>"),e=e.replace(/<\/(div|p)><\/(div|p)>/g,"</p>"),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,'<p><span style="font-size: $1pt">'),e=e.replace(/\[\/size\]/g,"</span></p>"),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('<img src="'+i.replace(/987654321/,e)+'" class="redactorEmbeddedAttachment'+(t?"":" redactorDisableResize")+'" data-attachment-id="'+e+'"'+r+" />","[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;l<a[0].children.length;l++){var o=a[0].children[l];if("DIV"===o.tagName&&o.textContent.replace(/\u200b/,"").length){n=!1;break}}if(n)r=!0;else{var c=null===this.selection.implicitRange?this.range:this.selection.implicitRange;if(0===c.startOffset)for(var s,d=c.startContainer;null!==(d=d.parentNode);)if(s=d.previousSibling,null!==s){s.nodeType===Node.ELEMENT_NODE&&"HEADER"===s.nodeName&&(r=!0);break}}}if(r){var h=window.getSelection();h.rangeCount&&h.removeAllRanges();var p=document.createRange();p.selectNode(a[0]||a),h.addRange(p),e.cancel=!0}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(t)){var g=t.nextElementSibling;if(g&&"BLOCKQUOTE"===g.tagName){var h=window.getSelection();h.rangeCount&&h.removeAllRanges();var p=document.createRange();p.selectNode(g),h.addRange(p),e.cancel=!0}}break;case $.ui.keyCode.DOWN:var u=$(t);if(u.next("blockquote").length)this.caret.setStart(u.next().children("div:first")),e.cancel=!0;else if(i)if(i.next("blockquote").length)this.caret.setStart(i.next().children("div:first")),e.cancel=!0;else if(a.length){var f=u.closest("div",a[0]);f.next().length||(a.next().length?this.caret.setStart(a.next()):this.wutil.setCaretAfter(a),e.cancel=!0)}break;case $.ui.keyCode.ENTER:a.length&&(this.keydown.blockquote=!1,this.keydown.enterWithinBlockquote=!0);break;case $.ui.keyCode.UP:if(!i||!a.length)return;var f=$(t).closest("div",a[0]),m=f.prev();if("DIV"===m[0].tagName)return;if("BLOCKQUOTE"===m[0].tagName)return;var v=a.prev();0===v.length?this.wutil.setCaretBefore(a):"BLOCKQUOTE"===v[0].tagName?this.caret.sendEnd(v.children("div:last")):(""==$.trim(v.html())&&v.html(this.opts.invisibleSpace),this.caret.setEnd(v)),e.cancel=!0;break;case 83:if($.browser.mobile||$.browser.touch)return;var b=!1;if(navigator.platform.match(/^Mac/)?e.event.ctrlKey&&e.event.altKey&&(b=!0):e.event.altKey&&!e.event.ctrlKey&&(b=!0),b){var w={cancel:!1};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),w),w.cancel&&(e.cancel=!0)}}},_keyupCallback:function(e){switch(e.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(e,t){var i=$(t);i.children("header").length||i.remove()});break;case $.ui.keyCode.ENTER:for(var t=0,i=this.$editor[0].children.length;i>t;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=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(t){t.preventDefault(),this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),!1),$(".redactor-link-tooltip").remove()},this)).appendTo(i),$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.delete")+"</a>").click(function(e){e.preventDefault();var i=t.parent(),a=i.parent();i.remove(),$(".redactor-link-tooltip").remove(),"BLOCKQUOTE"===a[0].nodeName&&0===a.children("div").length&&$("<div>​</div>").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=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").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("<div>"+this.opts.invisibleSpace+"</div>"),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=WCF.getUUID(),c="";a?c=this.wbbcode.convertToHtml(r+a+n):(c=this.wbbcode.convertToHtml(r+o+n),c=c.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))),c=c.replace(/^<p>/,"").replace(/<\/p>$/,""),c=c.replace(/<blockquote/,'<blockquote id="'+o+'"'),window.getSelection().rangeCount||(this.wutil.restoreSelection(),window.getSelection().rangeCount||(this.$editor.focus(),window.getSelection().rangeCount||this.wutil.selectionEndOfEditor(),this.wutil.saveSelection())),window.getSelection().getRangeAt(0).deleteContents(),this.wutil.restoreSelection();for(var s=window.getSelection().getRangeAt(0),d=s.startContainer;d;){var h=d.parentNode;if(h===this.$editor[0])break;d=h}if(d&&d.parentNode===this.$editor[0]&&d.innerHTML.length&&("​"===d.innerHTML?this.caret.setEnd(d):this.wutil.setCaretAfter(d)),this.insert.html(c,!1),l=this.$editor.find("#"+o),l.length){var p=l.find("> div");if(1==p.length)""===p[0].innerHTML&&(p[0].innerHTML=this.opts.invisibleSpace);else if($.browser.mozilla){var g=l.find("> div > br[type=_moz]");g.length&&($("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(g),g.remove())}l.removeAttr("id"),this.wutil.setCaretAfter(l[0]);var u=l[0].previousElementSibling;null!==u&&"P"===u.nodeName&&"​"===u.innerHTML&&(u=u.previousElementSibling,null===u||"P"!==u.nodeName||"​"!==u.innerHTML&&"<br>"!==u.innerHTML||u.parentNode.removeChild(u.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+='<a href="'+t+'" tabindex="-1">'),i+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(e)}),t&&(i+="</a>")):i="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>",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||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").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||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").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=0;p<t.length;p++)h+="<li>"+WCF.String.escapeHTML(t[p])+"</li>";s.append($(h)),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;i<t.children.length;i++)e(t.children[i])},t=0;t<this.alignment.blocks.length;t++){var i=this.alignment.blocks[t];switch(i.tagName){case"BLOCKQUOTE":i.style.removeProperty("text-align"),e(i.children[0]);break;case"DIV":/\bcodeBox\b/.test(i.className)&&e(i)}}}}};
+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><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>"),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(),$('<li class="dropdownDivider" />').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=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:e}),e=e.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1"),e=e.replace(/(<[^>]+?) rel="[^"]+"/g,"$1"),e=e.replace(/&#(8203|x200b);/g,""),e=e.replace(/&trade;/gi,"™"),e=e.replace(/&copy;/gi,"©"),e=e.replace(/&hellip;/gi,"…"),e=e.replace(/&mdash;/gi,"—"),e=e.replace(/&dash;/gi,"‐");var i={};e=e.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(e,t,a,r,n){var l=t+" "+a,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 i[s]={codeContent:n.replace(/<li>/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[^>]*?><\/a>/g,""),e=e.replace(/<p><\/p><table/g,"<table"),e=e.replace(/<\/table><p><\/p>/g,"</table>");for(var a in i)e=e.replace(new RegExp("<p></p>@@@"+a+"@@@<p></p>"),"@@@"+a+"@@@");e=e.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>"),e=e.replace(/<br( \/)?><\/p>/g,"</p>");for(var r=e.split(/(<\/?(?:div|p)>)/),n="",l="",o=0;o<r.length;o++){var c=r[o];"<p>"!=c&&"<div>"!=c&&("</p>"==c||"</div>"==c?(l=$.trim(l),"@@@wcf_empty_line@@@"!=l&&(l+="\n"),n+=l,l=""):0==o||o+1==r.length?n+=c:l+=c)}l&&(n+=l,l=""),e=n,e=e.replace(/@@@wcf_empty_line@@@/g,"\n"),e=e.replace(/\n\n$/,"\n"),e=e.replace(/<br>$/,""),e=e.replace(/<br>/g,"\n"),e=e.replace(/<br>/g,""),e=e.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\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(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]"),e=e.replace(/<a[^>]+><\/a>/,""),e=e.replace(/<a [^>]*?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(/<u>/gi,function(){return-1===t.indexOf("u")&&t.push("u"),"[u]"}),e=e.replace(/<\/u>/gi,"[/u]"),e=e.replace(/<sub>/gi,function(){return-1===t.indexOf("sub")&&t.push("sub"),"[sub]"}),e=e.replace(/<\/sub>/gi,"[/sub]"),e=e.replace(/<sup>/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 s=e.split(/(<\/?span[^>]*>)/),l=[],d=[],h="",p={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36},o=0;o<s.length;o++){var g=s[o];if("</span>"==g){var u=d.pop(),n=u.start+l.pop()+u.end;l.length?l[l.length-1]+=n:h+=n}else if(g.match(/^<span/))if(g.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var f,m,b=RegExp.$1;if(b.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var v=RegExp.$1,w=RegExp.$2,C=RegExp.$3,x="0123456789ABCDEF".charAt((v-v%16)/16)+""+"0123456789ABCDEF".charAt(v%16)+("0123456789ABCDEF".charAt((w-w%16)/16)+""+"0123456789ABCDEF".charAt(w%16))+("0123456789ABCDEF".charAt((C-C%16)/16)+""+"0123456789ABCDEF".charAt(C%16));f="[color=#"+x+"]",m="[/color=#"+x+"]",-1===t.indexOf("color")&&t.push("color")}else b.match(/(?:^|;\s*)color: ?([^;]+);?/i)?(f="[color="+RegExp.$1+"]",m="[/color="+RegExp.$1+"]",-1===t.indexOf("color")&&t.push("color")):b.match(/font-size: ?(\d+)(pt|px);?/i)?"pt"==RegExp.$2?(f="[size="+RegExp.$1+"]",m="[/size="+RegExp.$1+"]",-1===t.indexOf("size")&&t.push("size")):p[RegExp.$1]?(f="[size="+p[RegExp.$1]+"]",m="[/size="+p[RegExp.$1]+"]",-1===t.indexOf("size")&&t.push("size")):(f="",m=""):b.match(/font-family: ?([^;]+);?/)?(f="[font='"+RegExp.$1.replace(/'/g,"")+"']",m="[/font='"+RegExp.$1.replace(/'/g,"")+"']",-1===t.indexOf("font")&&t.push("font")):(f='<span style="'+b+'">',m="</span>");l[l.length]="",d[l.length]={start:f,end:m}}else g.match(/^<span class="inlineCode">/)?(l[l.length]="",d[l.length]={start:"[tt]",end:"[/tt]"}):(l[l.length]="",d[l.length]={start:"",end:""});else l.length?l[l.length-1]+=g:h+=g}if(e=h,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 E=!0;E;)E=!1,e=e.replace(new RegExp("\\[\\/((?:"+t.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){return E=!0,"\n"});e=e.replace(new RegExp("\\[\\/("+t.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}e=e.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 "),e=e.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 "),e=e.replace(/<img([^>]*?)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<o.length;c++){var s=$.trim(o[c]);s.match(/^float: (left|right)$/)?n=RegExp.$1:s.match(/^width: (\d+)px$/)&&(l=RegExp.$1)}if(null!==l)return"[attach="+a+","+n+","+l+"][/attach]";if("none"!==n)return"[attach="+a+","+n+"][/attach]"}return"[attach="+a+"][/attach]"}),e=e.replace(/<img([^>]*)?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<s.length;d++){var h=s[d];h.match(/float: (left|right|none)/)?o=RegExp.$1:h.match(/width: (\d+)px/)&&(c=parseInt(RegExp.$1))}return c?"[img='"+a+"',"+o+","+c+"][/img]":"none"!==o?"[img='"+a+"',"+o+"][/img]":"[img]"+a+"[/img]"}),e=e.replace(/<li>/gi,"[*]"),e=e.replace(/<\/li>/gi,"\n"),e=e.replace(/<ul>/gi,"[list]"),e=e.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]"),e=e.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]"),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(/<table[^>]*>/gi,"[table]\n"),e=e.replace(/<\/table>\n?/gi,"[/table]\n"),e=e.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(e,t){return $.trim(t)}),e=e.replace(/<tr><\/tr>/gi,""),e=e.replace(/<tr>/gi,"[tr]\n"),e=e.replace(/<\/tr>/gi,"[/tr]\n"),e=e.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]"),e=e.replace(/(\t)*<td>(\t)*/gi,"[td]"),e=e.replace(/(\t)*<\/td>/gi,"[/td]\n");var y={};if(e.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(e){var t=e.hashCode();return y[t]=e.replace(/\$/g,"$$$$"),"@@"+t+"@@"}),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:e}),e=e.replace(/<[^(<|>)]+>/g,""),$.getLength(y))for(var S in y){var _=new RegExp("@@"+S+"@@","g");e=e.replace(_,y[S])}return $.getLength(i)&&$.each(i,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(/&lt;/g,"<"),e=e.replace(/&gt;/g,">"),e=e.replace(/&amp;/g,"&"),e=e.replace(/%28/g,"("),e=e.replace(/%29/g,")"),WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:e}),e=$.trim(e),e.length&&(e+="\n"),e},convertToHtml:function(e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:e}),e=this.wutil.removeZeroWidthSpace(e),e=e.replace(/&/g,"&amp;"),e=e.replace(/</g,"&lt;"),e=e.replace(/>/g,"&gt;");var t=[],i=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");e=e.replace(i,function(e){var i=e.hashCode();return t.push({key:i,value:e.replace(/\$/g,"$$$$")}),"@@"+i+"@@"}),e=e.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace),e=e.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace),e=e.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace),e=e.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace),e=e.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+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,"<strong>","</strong>")}.bind(this)),e=e.replace(/\[i\]([\s\S]*?)\[\/i]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<em>","</em>")}.bind(this)),e=e.replace(/\[u\]([\s\S]*?)\[\/u]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<u>","</u>")}.bind(this)),e=e.replace(/\[s\]([\s\S]*?)\[\/s]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<del>","</del>")}.bind(this)),e=e.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<sub>","</sub>")}.bind(this)),e=e.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,function(e,t){return this.wbbcode._expandFormatting(t,"<sup>","</sup>")}.bind(this)),e=e.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />'),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",'<img src="'+t+'" style="'+a+'" />'}),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",'<img src="'+t+'" style="'+r+'" />'}),e=e.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />'),e=e.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="font-size: '+t+'pt">',"</span>")}.bind(this)),e=e.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="color: '+t+'">',"</span>")}.bind(this)),e=e.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<span style="font-family: '+t+'">',"</span>")}.bind(this)),e=e.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,function(e,t,i){return this.wbbcode._expandFormatting(i,'<p style="text-align: '+t+'">',"</p>")}.bind(this));var a=e.indexOf("[list");if(a>0){var r=e.substr(0,a);r=r.replace(/\[\*\]/g,""),e=r+e.substr(a)}var n=e.lastIndexOf("[/list]");if(-1===n)e=e.replace(/\[\*\]/g,""),e=e.replace(/\[list[^\]]*\]/g,"");else{var r=e.substr(n+7);r=r.replace(/\[\*\]/g,""),e=e.substr(0,n+7)+r}e=e.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(e,t){return"<li>"+$.trim(t)+"</li>"}),e=e.replace(/\n*(\[list\]<\/li>)/g,"$1"),e=e.replace(/\[list\]/gi,"<ul>"),e=e.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">'),e=e.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">'),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,'<ul style="list-style-type: $1">'),e=e.replace(/\[\/list\]/gi,"</ul>"),e=e.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(e,t){return"[table]"+$.trim(t)+"[/table]"}),e=e.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">'),e=e.replace(/\[\/table\](\n*)?/gi,function(e,t){return t?(t.match(/\n/g).length>2&&(t=t.replace(/^\n/,"")),"</table>"+t):"</table>"}),e=e.replace(/\[tr\]\n*/gi,"<tr>"),e=e.replace(/\[\/tr\]\n*/gi,"</tr>"),e=e.replace(/\[td\]\n*/gi,"<td>"),e=e.replace(/\[\/td\]\n*/gi,"</td>"),e=e.replace(/<td>([\S\s]*?)<\/td>/gi,function(e,t){var i=$.trim(t);return i.length||(i="&#8203;"),"<td>"+i+"</td>"});var l=this.wutil.getOption("woltlab.attachmentUrl"),o=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(l){var c=this.wbbcode._getImageAttachments();e=e.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(e,t){return t=parseInt(t),void 0!==c[t]?'<img src="'+o.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+t+'" />':e}),e=e.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(e,t,i){if(t=parseInt(t),void 0!==c[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+'"','<img src="'+o.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+t+'"'+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!==c[t]){var r="width: "+a+"px; max-height: "+c[t].height+"px; max-width: "+c[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+'"','<img src="'+l.replace(/987654321/,t)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+t+'"'+r+" />"}return e})}for(var s in __REDACTOR_SMILIES){var d=s.replace(/</g,"&lt;").replace(/>/g,"&gt;"),h=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(d)+"(?=\\s|<|$)","gi");e=e.replace(h,'$1<img src="'+__REDACTOR_SMILIES[s]+'" class="smiley" alt="'+d+'" />')}e=e.replace(/(javascript):/gi,"$1<span></span>:"),e=e.replace(/(\r|\r\n)/g,"\n");for(var p=[],g=[],u=e.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i),f=WCF.getUUID();;){for(var m=!1,b=0;b<u.length;b++){var v=u[b];if("[/quote]"===v.toLowerCase()){m=!0;for(var w="",C=u.slice(0,b),x=!1;C.length;){var E=C.pop();if(w=E+w,E.match(/^\[quote/i)){v=w+v;var y=WCF.getUUID();p.push({hashCode:y,content:v.replace(/\$/g,"$$$$")}),g.push(y),v="@@"+y+"@@",x=!0;break}}x||(C=u.slice(0,b),v=f),u=C.concat(v,u.slice(b+1));break}}if(!m)break}e=u.join(""),e=e.replace(new RegExp(f,"g"),"[/quote]"),e=e.replace(/\n*$/,"");var S=[];e=e.replace(/(<li>[\s\S]*?<\/li>)/g,function(e){e=$.trim(e).replace(/\n/g,"<br>");var t=WCF.getUUID();return S.push({key:t,content:e}),t});var r=e.split("\n");e="";for(var b=0,_=r.length;_>b;b++){var k=$.trim(r[b]);if(k.match(/^<([a-z]+)/)||k.match(/<\/([a-z]+)>$/))e+=this.reIsBlock.test(RegExp.$1.toUpperCase())||"TABLE"===RegExp.$1.toUpperCase()?k.match(/^<([a-z]+).*<\/\1>/)?k:k+"<br />":"<p>"+k+"</p>";else{if(k){if(k.match(/^@@([0-9\-]+)@@$/)&&WCF.inArray(RegExp.$1,g)){e+=k;continue}}else k="<br>";e+="<p>"+k+"</p>"}}if(e=e.replace(/<td>([\s\S]+?)<\/td>/g,function(e,t){return t=t.replace(/<br(?: \/)?>(<[uo]l)/g,"$1"),"<td>"+t.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"}),S.length)for(var b=S.length-1;b>=0;b--)e=e.replace(S[b].key,S[b].content);if(p.length)for(var R=function(e){return e.replace(/^['"]/,"").replace(/['"]$/,"")},T=this,L=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(R($.trim(r))),n=WCF.String.escapeHTML(R($.trim(n)))}var l='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+n+'" data-author="'+r+'"><header contenteditable="false"><h3>'+T.wbbcode._buildQuoteHeader(r,n)+'</h3><a class="redactorQuoteEdit"></a></header>';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<s.length;d++){var h=s[d];if(0===h.length)h=T.opts.invisibleSpace;else if(h.match(/^@@([0-9\-]+)@@$/)&&WCF.inArray(RegExp.$1,g)){o+=h;continue}o+="<div>"+h+"</div>"}if(c.length)for(var d=0,p=c.length;p>d;d++){var u=c[d].content;u=u.replace(/(<li>[\s\S]*?<\/li>)/g,function(e){return $.trim(e).replace(/\n/g,"<br>")}),o=o.replace(new RegExp("@@"+c[d].hash+"@@"),u)}}else o="<div>"+T.opts.invisibleSpace+"</div>";return l+=o,l+="</blockquote>"})},b=p.length-1;b>=0;b--){var F=p[b],A=new RegExp("@@"+F.hashCode+"@@","g");e=e.replace(A,L(F.content))}if(e=e.replace(/<(?:div|p)><(blockquote|div)/g,"<$1"),e=e.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>"),t.length)for(var b=t.length-1;b>=0;b--){var O=t[b],A=new RegExp("@@"+O.key+"@@","g"),B=O.value;B=B.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+="</p><p>"),t+="[tt]"+n+"[/tt]";else{if(0===a||a+1===r)continue;t+=t.match(/\[\/tt\]$/)?"</p><p>"+this.opts.invisibleSpace:"</p><p><br>"}}return t}.bind(this)),B=B.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<i.length;h++){var p=i[h];p.length||(p=this.opts.invisibleSpace),d+="<li>"+p+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+a+'"'+(n?' data-filename="'+WCF.String.escapeHTML(n)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[a]+(n?": "+WCF.String.escapeHTML(n):"")+'</h3></div><ol start="'+(r>1?r:1)+'">'+d+"</ol></div></div>"}.bind(this)),e=e.replace(A,B)}return WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:e}),e=e.replace(/&amp;nbsp;/g,"&amp;amp;nbsp;")},_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(/<h([1-6])([^>]*)>/g,function(e,i,a){if(a&&a.match(/style="([^"]+?)"/)&&/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var r=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').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)<Math.abs(n-t[l])&&(l=e),n==i&&(o=!0)}),o||(l=6>l?parseInt(l)+1:l),i=l}return"[size="+t[i]+"]"}),e=e.replace(/<\/h[1-6]>/g,"[/size]"),(/<p class="MsoNormal/.test(e)||/margin-bottom: 0cm/.test(e))&&(e=e.replace(/([^>\s])\n([^<\s])/g,"$1 $2"),e=e.replace(/<a name="[^"]+">/g,"")),e=e.replace(/<o:p>&nbsp;<\/o:p>/g,"<br>"),e=e.replace(/<(article|header)[^>]+>/g,"<div>"),e=e.replace(/<\/(article|header)>/g,"</div>"),e=e.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>"),e=e.replace(/<\/(div|p)><\/(div|p)>/g,"</p>"),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,'<p><span style="font-size: $1pt">'),e=e.replace(/\[\/size\]/g,"</span></p>"),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('<img src="'+i.replace(/987654321/,e)+'" class="redactorEmbeddedAttachment'+(t?"":" redactorDisableResize")+'" data-attachment-id="'+e+'"'+r+" />","[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;l<a[0].children.length;l++){var o=a[0].children[l];if("DIV"===o.tagName&&o.textContent.replace(/\u200b/,"").length){n=!1;break}}if(n)r=!0;else{var c=null===this.selection.implicitRange?this.range:this.selection.implicitRange;if(0===c.startOffset)for(var s,d=c.startContainer;null!==(d=d.parentNode);)if(s=d.previousSibling,null!==s){s.nodeType===Node.ELEMENT_NODE&&"HEADER"===s.nodeName&&(r=!0);break}}}if(r){var h=window.getSelection();h.rangeCount&&h.removeAllRanges();var p=document.createRange();p.selectNode(a[0]||a),h.addRange(p),e.cancel=!0}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(t)){var g=t.nextElementSibling;if(g&&"BLOCKQUOTE"===g.tagName){var h=window.getSelection();h.rangeCount&&h.removeAllRanges();var p=document.createRange();p.selectNode(g),h.addRange(p),e.cancel=!0}}break;case $.ui.keyCode.DOWN:var u=$(t);if(u.next("blockquote").length)this.caret.setStart(u.next().children("div:first")),e.cancel=!0;else if(i)if(i.next("blockquote").length)this.caret.setStart(i.next().children("div:first")),e.cancel=!0;else if(a.length){var f=u.closest("div",a[0]);f.next().length||(a.next().length?this.caret.setStart(a.next()):this.wutil.setCaretAfter(a),e.cancel=!0)}break;case $.ui.keyCode.ENTER:a.length&&(this.keydown.blockquote=!1,this.keydown.enterWithinBlockquote=!0);break;case $.ui.keyCode.UP:if(!i||!a.length)return;var f=$(t).closest("div",a[0]),m=f.prev();if("DIV"===m[0].tagName)return;if("BLOCKQUOTE"===m[0].tagName)return;var b=a.prev();0===b.length?this.wutil.setCaretBefore(a):"BLOCKQUOTE"===b[0].tagName?this.caret.sendEnd(b.children("div:last")):(""==$.trim(b.html())&&b.html(this.opts.invisibleSpace),this.caret.setEnd(b)),e.cancel=!0;break;case 83:if($.browser.mobile||$.browser.touch)return;var v=!1;if(navigator.platform.match(/^Mac/)?e.event.ctrlKey&&e.event.altKey&&(v=!0):e.event.altKey&&!e.event.ctrlKey&&(v=!0),v){var w={cancel:!1};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),w),w.cancel&&(e.cancel=!0)}}},_keyupCallback:function(e){switch(e.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(e,t){var i=$(t);i.children("header").length||i.remove()});break;case $.ui.keyCode.ENTER:for(var t=0,i=this.$editor[0].children.length;i>t;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=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").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),$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.delete")+"</a>").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&&$("<div>​</div>").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=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").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("<div>"+this.opts.invisibleSpace+"</div>"),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=WCF.getUUID(),c="";a?c=this.wbbcode.convertToHtml(r+a+n):(c=this.wbbcode.convertToHtml(r+o+n),c=c.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))),c=c.replace(/^<p>/,"").replace(/<\/p>$/,""),c=c.replace(/<blockquote/,'<blockquote id="'+o+'"'),window.getSelection().rangeCount||(this.wutil.restoreSelection(),window.getSelection().rangeCount||(this.$editor.focus(),window.getSelection().rangeCount||this.wutil.selectionEndOfEditor(),this.wutil.saveSelection())),window.getSelection().getRangeAt(0).deleteContents(),this.wutil.restoreSelection();for(var s=window.getSelection().getRangeAt(0),d=s.startContainer;d;){var h=d.parentNode;if(h===this.$editor[0])break;d=h}if(d&&d.parentNode===this.$editor[0]&&d.innerHTML.length&&("​"===d.innerHTML?this.caret.setEnd(d):this.wutil.setCaretAfter(d)),this.insert.html(c,!1),l=this.$editor.find("#"+o),l.length){var p=l.find("> div");if(1==p.length)""===p[0].innerHTML&&(p[0].innerHTML=this.opts.invisibleSpace);else if($.browser.mozilla){var g=l.find("> div > br[type=_moz]");g.length&&($("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(g),g.remove())}l.removeAttr("id"),this.wutil.setCaretAfter(l[0]);var u=l[0].previousElementSibling;null!==u&&"P"===u.nodeName&&"​"===u.innerHTML&&(u=u.previousElementSibling,null===u||"P"!==u.nodeName||"​"!==u.innerHTML&&"<br>"!==u.innerHTML||u.parentNode.removeChild(u.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+='<a href="'+t+'" tabindex="-1">'),i+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(e)}),t&&(i+="</a>")):i="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>",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||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").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||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").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=0;p<t.length;p++)h+="<li>"+WCF.String.escapeHTML(t[p])+"</li>";s.append($(h)),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;i<t.children.length;i++)e(t.children[i])},t=0;t<this.alignment.blocks.length;t++){var i=this.alignment.blocks[t];switch(i.tagName){case"BLOCKQUOTE":i.style.removeProperty("text-align"),e(i.children[0]);break;case"DIV":/\bcodeBox\b/.test(i.className)&&e(i)}}}}};
 // wbutton.js
 if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wbutton=function(){"use strict";return{_bbcodes:{},init:function(){this._bbcodes={};for(var t=0,e=__REDACTOR_BUTTONS.length;e>t;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);$("<li />").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(/<p>@@@wcf_empty_line@@@<\/p>/g,"<p><br></p>");if(this.buffer.set(),this.utils.browser("mozilla")&&!i.length){var a=getSelection().getRangeAt(0).startContainer;a.nodeType===Node.ELEMENT_NODE&&"P"===a.tagName&&"<br>"===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('<img src="'+e+'"'+i+">",!1),this.modal.close(),this.observe.images()}else t.next("small.innerError")||$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(t)}}};
 // wfontcolor.js
@@ -16,4 +17,4 @@ if(!RedactorPlugins)var RedactorPlugins={};RedactorPlugins.wmonkeypatch=function
 // 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<t.dataTransfer.types.length;i++)if("Files"===t.dataTransfer.types[i]){this.wupload._isFile=!0;break}if(this.wupload._isFile){if(this.wupload._isFile=!0,t.preventDefault(),!this.wupload._isDragging){var r=this.$textarea.wcfIdentify();void 0===this.wupload._dropArea[r]&&(this.wupload._dropArea[r]=$('<div class="redactorDropArea">'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"</div>").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<t.dataTransfer.files.length;a++)WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+e,{file:t.dataTransfer.files[a]})}},pasteClipboardUploadMozilla:function(){this.$editor.find("img[data-mozilla-paste-image]").each($.proxy(function(t,e){var a=$(e),i=a.prop("src").split(","),r=i[0].split(";")[0].split(":")[1],o=i[1],s={blob:WCF.base64toBlob(o,r),uploadID:null};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+this.$textarea.wcfIdentify(),s),a.replaceWith('<span class="redactor-pastedImageFromClipboard-'+s.uploadID+'" />')},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,a=!1,i=!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 a=this.$textarea.val();return a=a.substr(0,e)+t+a.substr(e),this.$textarea.val(a),!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("<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(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,a=!0,null===n&&(n=new WCF.PeriodicalExecuter(function(t){if(i!==!0){if(a===!1)return t.stop(),void(n=null);this.wutil.autosaveShowNotice("saved"),a=!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,a){if(null===e){e=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>'),e.appendTo(this.$box);var i=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(),$('<span class="redactorAutosaveMessage" />').appendTo(e)))}.bind(this);e.on("transitionend webkitTransitionEnd",i)}var n="";switch(t){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(a.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').appendTo(e);s.click(function(){this.wutil.replaceText(a.content),i(null),this.wutil.autosaveShowNotice("restored",a)}.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":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(a.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').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,a=e+"_wcf_master";try{t=localStorage.getItem(a)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}if(0!==t){var i=Date.now()-6048e5;if(null===t||i>t){var n=new RegExp("^"+e+"_");for(var s in localStorage)if(s.match(n)&&s!==a){var o=localStorage.getItem(s);try{o=JSON.parse(o)}catch(t){o={timestamp:0}}if(null===o||!o.timestamp||o.timestamp<i)try{localStorage.removeItem(s)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}try{localStorage.setItem(a,Date.now())}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}}},autosavePause:function(){i=!0},autosaveResume:function(){i=!1},buttonReplace:function(t,e,a,i,n){var s=this.buttonGet(t),o=this.buttonAddAfter(t,e,a,i,n);return s.parent().hasClass("separator")&&o.parent().addClass("separator"),s.parent().remove(),o},removeZeroWidthSpace:function(t){for(var e="",a=0,i=t.length;i>a;a++){var n=t.charCodeAt(a).toString(16);"200b"!=n&&(e+=t[a])}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(){if(document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection(),getSelection().getRangeAt(0).collapsed){var t=getSelection().getRangeAt(0).startContainer;if(t.nodeType===Node.TEXT_NODE&&"​"===t.textContent&&t.parentElement&&"P"===t.parentElement.tagName&&t.parentElement.parentElement===this.$editor[0])return;var 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.nodeType===Element.TEXT_NODE&&e.endOffset<e.endContainer.length)return!1;if(!this.wutil.isNodeWithin(e.endContainer,t))return!1;for(var a=e.endContainer;a!==t;){if(a.nextSibling)return!1;a=a.parentNode}return!0},isNodeWithin:function(t,e){for(;t&&t!==this.$editor[0];){if(t===e)return!0;t=t.parentNode}return!1},containsTag:function(t,e){switch(t.nodeType){case Element.ELEMENT_NODE:if(t.tagName===e)return!0;case Element.DOCUMENT_FRAGMENT_NODE:for(var a=0;a<t.childNodes.length;a++)if(this.wutil.containsTag(t.childNodes[a],e))return!0;return!1;default:return!1}},replaceText:function(t){var e=$(document),a=e.scrollTop(),i=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),i=!0),t=this.wutil.addNewlines(t),this.$textarea.val(t),i&&(this.code.toggle(),e.scrollTop(a)),e.trigger("resize")},setCaretBefore:function(t){this.wutil._setCaret(t,!0)},setCaretAfter:function(t){this.wutil._setCaret(t,!1)},_setCaret:function(t,e){var a;a=$((t[0]||t).parentElement&&"BLOCKQUOTE"===(t[0]||t).parentElement.tagName?"<div>"+this.opts.invisibleSpace+"</div>":"<p>"+this.opts.invisibleSpace+"</p>"),a[e?"insertBefore":"insertAfter"](t),this.caret.setEnd(a[0])},fixDOM:function(){for(var t=this.$editor[0].childNodes[0],e=t,a=null;e;)if(t=e,e=t.nextSibling,t.nodeType===Element.ELEMENT_NODE)this.reIsBlock.test(t.tagName)?a=null:(null===a&&(a=$("<p />").insertBefore(t)),a.append(t));else if(t.nodeType===Element.TEXT_NODE){if(null===a){if(e&&e.nodeType===Element.ELEMENT_NODE&&"P"===e.tagName&&"​"===e.innerHTML){var i=e.nextSibling;this.$editor[0].removeChild(e),e=i}a=$("<p />").insertBefore(t)}a.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])}}};
+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("<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(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=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>'),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(),$('<span class="redactorAutosaveMessage" />').appendTo(e)))}.bind(this);e.on("transitionend webkitTransitionEnd",a)}var n="";switch(t){case"prompt":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.prompt.discard")+'"></span>').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":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(i.timestamp).toLocaleString()})+'"></span>').prependTo(e);var s=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(e),o=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').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<a)try{localStorage.removeItem(s)}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}try{localStorage.setItem(i,Date.now())}catch(t){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+t.message)}}}},autosavePause:function(){a=!0},autosaveResume:function(){a=!1},buttonReplace:function(t,e,i,a,n){var s=this.buttonGet(t),o=this.buttonAddAfter(t,e,i,a,n);return s.parent().hasClass("separator")&&o.parent().addClass("separator"),s.parent().remove(),o},removeZeroWidthSpace:function(t){for(var e="",i=0,a=t.length;a>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(){if(document.activeElement!==this.$editor[0]&&this.wutil.restoreSelection(),getSelection().getRangeAt(0).collapsed){var t=getSelection().getRangeAt(0).startContainer;if(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]&&(t=$(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.nodeType===Element.TEXT_NODE&&e.endOffset<e.endContainer.length)return!1;if(!this.wutil.isNodeWithin(e.endContainer,t))return!1;for(var i=e.endContainer;i!==t;){if(i.nextSibling)return!1;i=i.parentNode}return!0},isNodeWithin:function(t,e){for(;t&&t!==this.$editor[0];){if(t===e)return!0;t=t.parentNode}return!1},containsTag:function(t,e){switch(t.nodeType){case Element.ELEMENT_NODE:if(t.tagName===e)return!0;case Element.DOCUMENT_FRAGMENT_NODE:for(var i=0;i<t.childNodes.length;i++)if(this.wutil.containsTag(t.childNodes[i],e))return!0;return!1;default:return!1}},replaceText:function(t){var e=$(document),i=e.scrollTop(),a=!1;this.wutil.inWysiwygMode()&&(this.code.toggle(),a=!0),t=this.wutil.addNewlines(t),this.$textarea.val(t),a&&(this.code.toggle(),e.scrollTop(i)),e.trigger("resize")},setCaretBefore:function(t){this.wutil._setCaret(t,!0)},setCaretAfter:function(t){this.wutil._setCaret(t,!1)},_setCaret:function(t,e){var i;i=$((t[0]||t).parentElement&&"BLOCKQUOTE"===(t[0]||t).parentElement.tagName?"<div>"+this.opts.invisibleSpace+"</div>":"<p>"+this.opts.invisibleSpace+"</p>"),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=$("<p />").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=$("<p />").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])}}};