Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Thu, 27 Nov 2014 16:01:57 +0000 (17:01 +0100)
committerwoltlab.com <woltlab@woltlab.com>
Thu, 27 Nov 2014 16:01:57 +0000 (17:01 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wcombined.min.js

index 3eecef7766410a53299123b0061689db8dd7c778..796da91d0a440365b1a29db7d87fe5494825908b 100644 (file)
@@ -1,7 +1,7 @@
 // table.js
 if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.table=function(){return{getTemplate:function(){return String()+'<section id="redactor-modal-table-insert"><label>'+this.lang.get("rows")+'</label><input type="text" size="5" value="2" id="redactor-table-rows" /><label>'+this.lang.get("columns")+'</label><input type="text" size="5" value="3" id="redactor-table-columns" /></section>'},init:function(){var b={};b.insert_table={title:this.lang.get("insert_table"),func:this.table.show};b.insert_row_above={title:this.lang.get("insert_row_above"),func:this.table.addRowAbove};b.insert_row_below={title:this.lang.get("insert_row_below"),func:this.table.addRowBelow};b.insert_column_left={title:this.lang.get("insert_column_left"),func:this.table.addColumnLeft};b.insert_column_right={title:this.lang.get("insert_column_right"),func:this.table.addColumnRight};b.add_head={title:this.lang.get("add_head"),func:this.table.addHead};b.delete_head={title:this.lang.get("delete_head"),func:this.table.deleteHead};b.delete_column={title:this.lang.get("delete_column"),func:this.table.deleteColumn};b.delete_row={title:this.lang.get("delete_row"),func:this.table.deleteRow};b.delete_table={title:this.lang.get("delete_table"),func:this.table.deleteTable};this.observe.addButton("td","table");this.observe.addButton("th","table");var a=this.button.addBefore("link","table",this.lang.get("table"));this.button.addDropdown(a,b)},show:function(){this.modal.addTemplate("table",this.table.getTemplate());this.modal.load("table",this.lang.get("insert_table"),300);this.modal.createCancelButton();var a=this.modal.createActionButton(this.lang.get("insert"));a.on("click",this.table.insert);this.selection.save();this.modal.show();$("#redactor-table-rows").focus()},insert:function(){var n=$("#redactor-table-rows").val(),c=$("#redactor-table-columns").val(),a=$("<div>"),b=Math.floor(Math.random()*99999),l=$('<table id="table'+b+'"><tbody></tbody></table>'),e,h,j,k;for(e=0;e<n;e++){h=$("<tr>");for(j=0;j<c;j++){k=$("<td>"+this.opts.invisibleSpace+"</td>");if(e===0&&j===0){k.append(this.selection.getMarker())}$(h).append(k)}l.append(h)}a.append(l);var f=a.html();this.modal.close();this.selection.restore();if(this.table.getTable()){return}this.buffer.set();var g=this.selection.getBlock()||this.selection.getCurrent();if(g&&g.tagName!="BODY"){if(g.tagName=="LI"){g=$(g).closest("ul, ol")}$(g).after(f)}else{this.insert.html(f)}this.selection.restore();var m=this.$editor.find("#table"+b);if(!this.opts.linebreaks&&(this.utils.browser("mozilla")||this.utils.browser("msie"))){var d=m.next();if(d.length===0){m.after(this.opts.emptyHtml)}}this.observe.buttons();m.find("span.redactor-selection-marker").remove();m.removeAttr("id");this.code.sync();this.core.setCallback("insertedTable",m)},getTable:function(){var a=$(this.selection.getParent()).closest("table");if(!this.utils.isRedactorParent(a)){return false}if(a.size()===0){return false}return a},restoreAfterDelete:function(a){this.selection.restore();a.find("span.redactor-selection-marker").remove();this.code.sync()},deleteTable:function(){var b=this.table.getTable();if(!b){return}this.buffer.set();var a=b.next();if(!this.opts.linebreaks&&a.length!==0){this.caret.setStart(a)}else{this.caret.setAfter(b)}b.remove();this.code.sync()},deleteRow:function(){var a=this.table.getTable();if(!a){return}var c=$(this.selection.getCurrent());this.buffer.set();var e=c.closest("tr");var b=e.prev().length?e.prev():e.next();if(b.length){var d=b.children("td, th").first();if(d.length){d.prepend(this.selection.getMarker())}}e.remove();this.table.restoreAfterDelete(a)},deleteColumn:function(){var c=this.table.getTable();if(!c){return}this.buffer.set();var d=$(this.selection.getCurrent());var a=d.closest("td, th");var b=a[0].cellIndex;c.find("tr").each($.proxy(function(f,g){var e=$(g);var h=b-1<0?b+1:b-1;if(f===0){e.find("td, th").eq(h).prepend(this.selection.getMarker())}e.find("td, th").eq(b).remove()},this));this.table.restoreAfterDelete(c)},addHead:function(){var a=this.table.getTable();if(!a){return}this.buffer.set();if(a.find("thead").size()!==0){this.table.deleteHead();return}var b=a.find("tr").first().clone();b.find("td").html(this.opts.invisibleSpace);$thead=$("<thead></thead>").append(b);a.prepend($thead);this.code.sync()},deleteHead:function(){var a=this.table.getTable();if(!a){return}var b=a.find("thead");if(b.size()===0){return}this.buffer.set();b.remove();this.code.sync()},addRowAbove:function(){this.table.addRow("before")},addRowBelow:function(){this.table.addRow("after")},addColumnLeft:function(){this.table.addColumn("before")},addColumnRight:function(){this.table.addColumn("after")},addRow:function(c){var a=this.table.getTable();if(!a){return}this.buffer.set();var b=$(this.selection.getCurrent());var d=b.closest("tr");var e=d.clone();e.find("th").replaceWith(function(){var f=$("<td>");f[0].attributes=this.attributes;return f.append($(this).contents())});e.find("td").html(this.opts.invisibleSpace);if(c=="after"){d.after(e)}else{d.before(e)}this.code.sync()},addColumn:function(d){var c=this.table.getTable();if(!c){return}var b=0;var e=$(this.selection.getCurrent());this.buffer.set();var f=e.closest("tr");var a=e.closest("td, th");f.find("td, th").each($.proxy(function(g,h){if($(h)[0]===a[0]){b=g}},this));c.find("tr").each($.proxy(function(g,j){var h=$(j).find("td, th").eq(b);var k=h.clone();k.html(this.opts.invisibleSpace);if(d=="after"){h.after(k)}else{h.before(k)}},this));this.code.sync()}}};
 // wbbcode.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){return{init:function(){var d=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){var g=$.trim(this.wutil.getOption("woltlab.originalValue"));if(g.length){this.wutil.replaceText(g);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wmonkeypatch.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var c=this.clean.onSync;this.clean.onSync=function(g){g=g.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return c.call(self,g)};if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var b=this.button.get("table");if(b.length){var f=b.data("dropdown");f.find(".redactor-dropdown-add_head").parent().remove();f.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(f.find(".redactor-dropdown-delete_table").parent());b.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+d,$.proxy(function(g){g.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+d,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+d,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var e=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");e.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode._fixQuotes();this.wutil.selectionEndOfEditor();this.wbbcode._observeQuotes();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");e.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wmonkeypatch.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(g){this.wmonkeypatch.saveSelection();if(g.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var a=this.opts.verifiedTags.indexOf("ul");if(a>-1){this.opts.verifiedTags.splice(a,1)}},_tableButtonClick:function(b){var c=$(b.currentTarget);if(!c.hasClass("dropact")){return}var a=this.selection.getBlock()||this.selection.getCurrent();var d=c.data("dropdown");d.children("li").show();var e=d.find("> li > .redactor-dropdown-insert_table").parent();if(a.tagName=="TD"){e.hide()}else{e.nextAll().hide()}},insertSmiley:function(a,b,c){if(c){this.wbbcode.registerSmiley(a,b)}if(this.opts.visual){this.insert.html('&nbsp;<img src="'+b+'" class="smiley" alt="'+a+'" />&nbsp;',false)}else{this.wutil.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},convertFromHtml:function(m){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:m});m=m.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");m=m.replace(/&#(8203|x200b);/g,"");m=m.replace(/&trade;/gi,"\u2122");m=m.replace(/&copy;/gi,"\u00a9");m=m.replace(/&hellip;/gi,"\u2026");m=m.replace(/&mdash;/gi,"\u2014");m=m.replace(/&dash;/gi,"\u2010");var l={};m=m.replace(/<pre>[\s\S]+?<\/pre>/g,function(y){var x=WCF.getUUID();l[x]=y;return"@@@"+x+"@@@"});m=m.replace(/\r?\n/g,"");if($.getLength(l)){$.each(l,function(x,y){m=m.replace("@@@"+x+"@@@",y)})}m=m.replace(/<a[^>]*?><\/a>/g,"");m=m.replace(/<p><\/p>/g,"");m=m.replace(/<br( \/)?><\/p>/g,"</p>");var g=m.split(/(<\/?(?:div|p)>)/);var h="";var v="";for(var a=0;a<g.length;a++){var w=g[a];if(w=="<p>"||w=="<div>"){continue}else{if(w=="</p>"||w=="</div>"){v=$.trim(v);if(v!="@@@wcf_empty_line@@@"){v+="\n"}h+=v;v=""}else{if(a==0||a+1==g.length){h+=w}else{v+=w}}}}if(v){h+=v;v=""}m=h;m=m.replace(/@@@wcf_empty_line@@@/g,"\n");m=m.replace(/\n\n$/,"\n");m=m.replace(/<br>$/,"");m=m.replace(/<br>/g,"\n");m=m.replace(/<br>/g,"");m=m.replace(/&nbsp;/gi," ");m=m.replace(/<blockquote class="quoteBox" cite="([^"]+)?" data-author="([^"]+)?"[^>]*?>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(x,z,y,A){var B;if(y){y=WCF.String.unescapeHTML(y)}if(z){z=WCF.String.unescapeHTML(z)}if(z){B="[quote='"+y+"','"+z+"']"}else{if(y){B="[quote='"+y+"']"}else{B="[quote]"}}return B});m=m.replace(/(?:\n*)<\/blockquote>\n?/gi,"[/quote]\n");m=m.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");m=m.replace(/<a[^>]+><\/a>/,"");m=m.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(A,y,z,B){if(z==B){return"[url]"+z+"[/url]"}return"[url='"+z+"']"+B+"[/url]"});m=m.replace(/<(?:b|strong)>/gi,"[b]");m=m.replace(/<\/(?:b|strong)>/gi,"[/b]");m=m.replace(/<(?:i|em)>/gi,"[i]");m=m.replace(/<\/(?:i|em)>/gi,"[/i]");m=m.replace(/<u>/gi,"[u]");m=m.replace(/<\/u>/gi,"[/u]");m=m.replace(/<sub>/gi,"[sub]");m=m.replace(/<\/sub>/gi,"[/sub]");m=m.replace(/<sup>/gi,"[sup]");m=m.replace(/<\/sup>/gi,"[/sup]");m=m.replace(/<(?:s(trike)?|del)>/gi,"[s]");m=m.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");m=m.replace(/<img [^>]*?alt="([^"]+?)" class="smiley".*?> ?/gi,"$1 ");m=m.replace(/<img [^>]*?class="smiley" alt="([^"]+?)".*?> ?/gi,"$1 ");m=m.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)"( style="([^"]+)")?>/gi,function(A,D,x,B){var C="none";var z=null;if(B){B=B.split(";");for(var E=0;E<B.length;E++){var y=$.trim(B[E]);if(y.match(/^float: (left|right)$/)){C=RegExp.$1}else{if(y.match(/^width: (\d+)px$/)){z=RegExp.$1}}}if(z!==null){return"[attach="+D+","+C+","+z+"][/attach]"}else{if(C!=="none"){return"[attach="+D+","+C+"][/attach]"}}}return"[attach="+D+"][/attach]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1 style="([^"]+)".*?>/gi,function(C,F,y,z){var B="none";var A=0;var D=z.split(";");for(var E=0;E<D.length;E++){var x=D[E];if(x.match(/float: (left|right|none)/)){B=RegExp.$1}else{if(x.match(/width: (\d+)px/)){A=parseInt(RegExp.$1)}}}if(A){return"[img='"+y+"',"+B+","+A+"][/img]"}else{if(B!=="none"){return"[img='"+y+"',"+B+"][/img]"}}return"[img]"+y+"[/img]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");var e=m.split(/(<\/?span[^>]*>)/);var v=[];var o=[];var p="";var c={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var a=0;a<e.length;a++){var i=e[a];if(i=="</span>"){var d=o.pop();var h=d.start+v.pop()+d.end;if(v.length){v[v.length-1]+=h}else{p+=h}}else{if(i.match(/^<span/)){if(i.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var k=RegExp.$1;var t;var n;if(k.match(/color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var s=RegExp.$1;var b=RegExp.$2;var f=RegExp.$3;var q=("0123456789ABCDEF".charAt((s-s%16)/16)+""+"0123456789ABCDEF".charAt(s%16))+""+("0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16))+""+("0123456789ABCDEF".charAt((f-f%16)/16)+""+"0123456789ABCDEF".charAt(f%16));t="[color=#"+q+"]";n="[/color]"}else{if(k.match(/color: ?([^;]+);?/i)){t="[color="+RegExp.$1+"]";n="[/color]"}else{if(k.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){t="[size="+RegExp.$1+"]";n="[/size]"}else{if(c[RegExp.$1]){t="[size="+c[RegExp.$1]+"]";n="[/size]"}else{t="";n=""}}}else{if(k.match(/font-family: ?([^;]+);?/)){t="[font='"+RegExp.$1.replace(/'/g,"")+"']";n="[/font]"}else{t='<span style="'+k+'">';n="</span>"}}}}v[v.length]="";o[v.length]={start:t,end:n}}else{if(i.match(/^<span class="inlineCode">/)){v[v.length]="";o[v.length]={start:"[tt]",end:"[/tt]"}}else{v[v.length]="";o[v.length]={start:"",end:""}}}}else{if(v.length){v[v.length-1]+=i}else{p+=i}}}}m=p;m=m.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(y,x,A,z){return"[align="+A+"]"+$.trim(z)+"[/align]"});m=m.replace(/<li>/gi,"[*]");m=m.replace(/<\/li>/gi,"");m=m.replace(/<ul>/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/<table[^>]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(x,y){return $.trim(y)});m=m.replace(/<tr><\/tr>/gi,"");m=m.replace(/<tr>/gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)*<td>(\t)*/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var u={};m.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(x){var y=x.hashCode();u[y]=x.replace(/\$/g,"$$$$");return"@@"+y+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:m});m=m.replace(/<[^(<|>)]+>/g,"");if($.getLength(u)){for(var j in u){var r=new RegExp("@@"+j+"@@","g");data=data.replace(r,u[j])}}m=m.replace(/&lt;/g,"<");m=m.replace(/&gt;/g,">");m=m.replace(/&amp;/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");m=m.replace(/\[\/code\]\n\n?/g,"[/code]\n\n");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:m});m=$.trim(m);if(m.length){m+="\n"}return m},convertToHtml:function(E){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:E});E=this.wutil.removeZeroWidthSpace(E);E=E.replace(/&/g,"&amp;");E=E.replace(/</g,"&lt;");E=E.replace(/>/g,"&gt;");var s=[];var n=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");E=E.replace(n,function(F){var G=F.hashCode();s.push({key:G,value:F.replace(/\$/g,"$$$$")});return"@@"+G+"@@"});E=E.replace(/\[url\]([^"]+?)\[\/url]/gi,'<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\]([\s\S]*?)\[\/b]/gi,"<b>$1</b>");E=E.replace(/\[i\]([\s\S]*?)\[\/i]/gi,"<i>$1</i>");E=E.replace(/\[u\]([\s\S]*?)\[\/u]/gi,"<u>$1</u>");E=E.replace(/\[s\]([\s\S]*?)\[\/s]/gi,"<strike>$1</strike>");E=E.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,"<sub>$1</sub>");E=E.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,"<sup>$1</sup>");E=E.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2" />');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2; width: $3px" />');E=E.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');E=E.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,'<span style="font-size: $1pt">$2</span>');E=E.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,'<span style="color: $1">$2</span>');E=E.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,'<span style="font-family: $1">$2</span>');E=E.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');E=E.replace(/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");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]\n?/gi,"</ul>\n");E=E.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(F,G){return"[table]"+$.trim(G)+"[/table]"});E=E.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');E=E.replace(/\[\/table\](\n*)?/gi,function(F,G){if(G){if(G.match(/\n/g).length>2){G=G.replace(/^\n/,"")}return"</table>"+G}return"</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(F,H){var G=$.trim(H);if(!G.length){G="&#8203;"}return"<td>"+G+"</td>"});var c=this.wutil.getOption("woltlab.attachmentUrl");var D=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(c){var B=this.wbbcode._getImageAttachments();E=E.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(F,G,H){G=parseInt(G);if(B[G]!==undefined){return'<img src="'+D.replace(/987654321/,G)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+G+'" />'}return F});E=E.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(G,H,I){H=parseInt(H);if(B[H]!==undefined){var F="";if(I==="left"||I==="right"){F="float: "+I+";"}F=' style="'+F+'"';return'<img src="'+D.replace(/987654321/,H)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+H+'"'+F+" />"}return G});E=E.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(G,I,J,H){I=parseInt(I);if(B[I]!==undefined){var F="width: "+H+"px; max-height: "+B[I].height+"px; max-width: "+B[I].width+"px;";if(J==="left"||J==="right"){F+="float: "+J+";"}F=' style="'+F+'"';return'<img src="'+c.replace(/987654321/,I)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+I+'"'+F+" />"}return G})}for(var u in __REDACTOR_SMILIES){var j=u.replace(/</g,"&lt;").replace(/>/g,"&gt;");var i=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(j)+"(?=\\s|<|$)","gi");E=E.replace(i,'$1<img src="'+__REDACTOR_SMILIES[u]+'" class="smiley" alt="'+j+'" />')}E=E.replace(/(javascript):/gi,"$1<span></span>:");E=E.replace(/(\r|\r\n)/g,"\n");var x=[];var A=[];var g=E.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/);var d=WCF.getUUID();while(true){var o=false;for(var a=0;a<g.length;a++){var z=g[a];if(z==="[/quote]"){o=true;var e="";var m=g.slice(0,a);var b=false;while(m.length){var y=m.pop();e=y+e;if(y.match(/^\[quote/)){z=e+z;var l=WCF.getUUID();x.push({hashCode:l,content:z.replace(/\$/g,"$$$$")});A.push(l);z="@@"+l+"@@";b=true;break}}if(!b){m=g.slice(0,a);z=d}g=m.concat(z,g.slice(a+1));break}}if(!o){break}}E=g.join("");E=E.replace(new RegExp(d,"g"),"[/quote]");E=E.replace(/\n*$/,"");var f=E.split("\n");E="";for(var a=0,k=f.length;a<k;a++){var r=$.trim(f[a]);if(r.match(/^<([a-z]+)/)){if(!this.reIsBlock.test(RegExp.$1.toUpperCase())){r="<p>"+r+"</p>"}E+=r}else{if(!r){r="<br>"}else{if(r.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,A)){E+=r;continue}}}E+="<p>"+r+"</p>"}}if(x.length){var C=function(F){return F.replace(/^['"]/,"").replace(/['"]$/,"")};var q=this;var p=function(F){return F.replace(/\[quote(=['"].+['"])?\]([\S\s]*)\[\/quote\]/gi,function(I,H,K){var O="";var J="";if(H){H=H.substr(1);H=H.split(",");switch(H.length){case 1:O=H[0];break;case 2:O=H[0];J=H[1];break}O=WCF.String.escapeHTML(C($.trim(O)));J=WCF.String.escapeHTML(C($.trim(J)))}var P='<blockquote class="quoteBox" cite="'+J+'" data-author="'+O+'"><div class="container containerPadding"><header contenteditable="false"><h3>'+q.wbbcode._buildQuoteHeader(O,J)+'</h3><a class="redactorQuoteEdit"></a></header>';K=$.trim(K);var G="";if(K.length){var N=K.split("\n");for(var M=0;M<N.length;M++){var L=N[M];if(L.length===0){L=q.opts.invisibleSpace}else{if(L.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,A)){G+=L;continue}}}G+="<div>"+L+"</div>"}}else{G="<div>"+q.opts.invisibleSpace+"</div>"}P+=G;P+="</div></blockquote>";return P})};for(var a=x.length-1;a>=0;a--){var t=x[a];var v=new RegExp("@@"+t.hashCode+"@@","g");E=E.replace(v,p(t.content))}}if(s.length){for(var a=s.length-1;a>=0;a--){var w=s[a];var v=new RegExp("@@"+w.key+"@@","g");var h=w.value;h=h.replace(/^\[tt\](.*)\[\/tt\]/,'<span class="inlineCode">$1</span>');h=h.replace(/^\[code[^\]]*\][\S\s]*\[\/code\]$/,"<pre>$&</pre>");E=E.replace(v,h)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:E});return E},_pasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/<h([1-6])[^>]+>/g,function(c,d){return"[size="+b[d]+"]"});a=a.replace(/<\/h[1-6]>/g,"[/size]");a=a.replace(/<(article|header)[^>]+>/g,"<div>");a=a.replace(/<\/(article|header)>/g,"</div>");a=a.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");a=a.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");a=a.replace(/<(div|p)><br><\/(div|p)>/g,"<p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:a});return a},_pasteCallback:function(a){a=a.replace(/<br[^>]*>(<br[^>]*>)+/g,"$1");a=a.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');a=a.replace(/\[\/size\]/g,"</span></p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:a});return a;a=a.replace(/<img([^>]+)>/g,function(b,c){b=b.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return b});return a},insertAttachment:function(e,c){e=parseInt(e);var a=this.wutil.getOption("woltlab.attachment"+(!c?"Thumbnail":"")+"Url");var d=this.wbbcode._getImageAttachments();if(a&&d[e]!==undefined){var b="";if(c){b=' style="width: '+d[e].width+"px; max-height: "+d[e].height+"px; max-width: "+d[e].width+'px;"'}this.wutil.insertDynamic('<img src="'+a.replace(/987654321/,e)+'" class="redactorEmbeddedAttachment'+(!c?" redactorDisableResize":"")+'" data-attachment-id="'+e+'"'+b+" />","[attach="+e+(c?",none,"+d[e].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+e+"][/attach]")}},removeAttachment:function(a){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(b,d){var c=$(d);if(c.data("attachmentID")==a){c.remove()}})},_getImageAttachments:function(){var b=this.wutil.getOption("woltlab.attachmentImages")||[];if(b.length){delete this.opts.attachmentImages;return b}var a={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),a);return a.imageAttachments},_keydownCallback:function(g){switch(g.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var a=$(this.selection.getCurrent());var f=this.selection.getParent();f=(f)?$(f):f;var l=(f)?f.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(g.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){if(l.length){var c=true;l.find("div > div").each(function(){if($(this).text().replace(/\u200B/,"").length){c=false;return false}});if(c){var h=window.getSelection();if(h.rangeCount){h.removeAllRanges()}var i=document.createRange();i.selectNode(l[0]);h.addRange(i);g.cancel=true}}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()){if(this.wutil.isEndOfElement(a[0])&&a.next("blockquote").length){var h=window.getSelection();if(h.rangeCount){h.removeAllRanges()}var i=document.createRange();i.selectNode(a.next()[0]);h.addRange(i);g.cancel=true}}break;case $.ui.keyCode.DOWN:if(a.next("blockquote").length){this.caret.setStart(a.next().find("> div > div:first"));g.cancel=true}else{if(f){if(f.next("blockquote").length){this.caret.setStart(f.next().find("> div > div:first"));g.cancel=true}else{if(l.length){var k=a.closest("div",l[0]);if(!k.next().length){if(l.next().length){this.caret.setStart(l.next())}else{this.wutil.setCaretAfter(l)}g.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(l.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!f||!l.length){return}var k=a.closest("div",l[0]);var b=k.prev();if(b[0].tagName==="DIV"){return}else{if(b[0].tagName==="BLOCKQUOTE"){return}}var j=l.prev();if(j.length===0){this.wutil.setCaretBefore(l)}else{if(j[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(j.find("> div > div:last"))}else{if($.trim(j.html())==""){j.html(this.opts.invisibleSpace)}this.caret.setEnd(j)}}g.cancel=true;break;case 83:var e=false;if(navigator.platform.match(/^Mac/)){if(g.event.ctrlKey&&g.event.altKey){e=true}}else{if(g.event.altKey){e=true}}if(e){var d={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),d);if(d.cancel){g.cancel=true}}break}},_keyupCallback:function(a){if(a.event.which!==$.ui.keyCode.BACKSPACE&&a.event.which!==$.ui.keyCode.DELETE){return}this.$editor.find("blockquote").each(function(b,d){var c=$(d);if(!c.find("> div > header").length){c.remove()}})},_observeQuotes:function(){this.$editor.find(".redactorQuoteEdit:not(.jsRedactorQuoteEdit)").addClass("jsRedactorQuoteEdit").click($.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(d){var b=$(d.currentTarget).closest("header");var c=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(d.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(c);var a=b.offset();c.css({left:a.left+"px",top:(a.top+20)+"px"});$(".redactor-link-tooltip").remove();c.appendTo(document.body);$('<div contenteditable="true" />').appendTo(document.body).focus().remove()},_openQuoteEditOverlay:function(a,c){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(c?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save"));if(c){this.selection.save();b.click($.proxy(function(){var f=$("#redactorQuoteAuthor").val();var e=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();var d=this.selection.getHtml();if(this.utils.isEmpty(d)){d=""}var g=this.wbbcode.insertQuoteBBCode(f,e,d);if(g!==null){if(!d.length){this.caret.setStart(g.find("> div > div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(a.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(a.attr("cite")));b.click($.proxy(function(){var d=$("#redactorQuoteAuthor").val();a.data("author",d);a.attr("data-author",d);a.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(a);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(b){var c=b.data("author");var a=b.attr("cite");if(a){a=WCF.String.escapeHTML(a)}b.find("> div > header > h3").empty().append(this.wbbcode._buildQuoteHeader(c,a))},insertQuoteBBCode:function(c,h,d,e){var g="[quote]";var a="[/quote]";if(c){if(h){g="[quote='"+c+"','"+h+"']"}else{g="[quote='"+c+"']"}}var l=null;if(this.wutil.inWysiwygMode()){var f=(e)?this.wbbcode.convertToHtml(e):d;var k=WCF.getUUID();var b=this.wbbcode.convertToHtml(g+k+a);b=b.replace(k,f.replace(/^<p>/,"").replace(/<\/p>$/,""));b=b.replace(/^<p>/,"").replace(/<\/p>$/,"");b=b.replace(/<blockquote/,'<blockquote id="'+k+'"');this.insert.html(b,false);l=this.$editor.find("#"+k);if(l.length){var j=l.find("> div > div");if(j.length==1){if(j[0].innerHTML===""){j[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var i=l.find("> div > br[type=_moz]");if(i.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(i);i.remove()}}}l.removeAttr("id");this.wutil.setCaretAfter(l[0])}this.wbbcode._observeQuotes();this.wbbcode._fixQuotes();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(g+e+a)}return l},_buildQuoteHeader:function(b,c){var a="";if(!b&&c){b=c;c=""}if(b){if(c){a+='<a href="'+c+'">'}a+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(b)});if(c){a+="</a>"}}else{a="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return a},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_fixQuotes:function(){var a=(function(d,c){var b="P";if(d.parentElement.tagName==="DIV"&&d.parentElement!==this.$editor[0]){d=d.parentElement;b="DIV"}if(d[c]===null||d[c].tagName!==b){$("<"+b+">"+this.opts.invisibleSpace+"</"+b+">")[(c==="previousElementSibling"?"insertBefore":"insertAfter")](d)}else{if(d.previousElementSibling.tagName===b){if(!d[c].innerHTML.length||d[c].innerHTML.toLowerCase()==="<p></p>"){$(d[c]).html(this.opts.invisibleSpace)}}}}).bind(this);this.$editor.find("blockquote").each((function(b,c){a(c,"previousElementSibling");a(c,"nextElementSibling")}).bind(this))}}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){return{init:function(){var d=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){var g=$.trim(this.wutil.getOption("woltlab.originalValue"));if(g.length){this.wutil.replaceText(g);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wmonkeypatch.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var c=this.clean.onSync;this.clean.onSync=function(g){g=g.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return c.call(self,g)};if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var b=this.button.get("table");if(b.length){var f=b.data("dropdown");f.find(".redactor-dropdown-add_head").parent().remove();f.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(f.find(".redactor-dropdown-delete_table").parent());b.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+d,$.proxy(function(g){g.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+d,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+d,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var e=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");e.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode._fixQuotes();this.wutil.selectionEndOfEditor();this.wbbcode._observeQuotes();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");e.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wmonkeypatch.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(g){this.wmonkeypatch.saveSelection();if(g.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var a=this.opts.verifiedTags.indexOf("ul");if(a>-1){this.opts.verifiedTags.splice(a,1)}},_tableButtonClick:function(b){var c=$(b.currentTarget);if(!c.hasClass("dropact")){return}var a=this.selection.getBlock()||this.selection.getCurrent();var d=c.data("dropdown");d.children("li").show();var e=d.find("> li > .redactor-dropdown-insert_table").parent();if(a.tagName=="TD"){e.hide()}else{e.nextAll().hide()}},insertSmiley:function(a,b,c){if(c){this.wbbcode.registerSmiley(a,b)}if(this.opts.visual){this.insert.html('&nbsp;<img src="'+b+'" class="smiley" alt="'+a+'" />&nbsp;',false)}else{this.wutil.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},convertFromHtml:function(m){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:m});m=m.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");m=m.replace(/&#(8203|x200b);/g,"");m=m.replace(/&trade;/gi,"\u2122");m=m.replace(/&copy;/gi,"\u00a9");m=m.replace(/&hellip;/gi,"\u2026");m=m.replace(/&mdash;/gi,"\u2014");m=m.replace(/&dash;/gi,"\u2010");var l={};m=m.replace(/<pre>[\s\S]+?<\/pre>/g,function(y){var x=WCF.getUUID();l[x]=y;return"@@@"+x+"@@@"});m=m.replace(/\r?\n/g,"");if($.getLength(l)){$.each(l,function(x,y){m=m.replace("@@@"+x+"@@@",y)})}m=m.replace(/<a[^>]*?><\/a>/g,"");m=m.replace(/<p><\/p>/g,"");m=m.replace(/<br( \/)?><\/p>/g,"</p>");var g=m.split(/(<\/?(?:div|p)>)/);var h="";var v="";for(var a=0;a<g.length;a++){var w=g[a];if(w=="<p>"||w=="<div>"){continue}else{if(w=="</p>"||w=="</div>"){v=$.trim(v);if(v!="@@@wcf_empty_line@@@"){v+="\n"}h+=v;v=""}else{if(a==0||a+1==g.length){h+=w}else{v+=w}}}}if(v){h+=v;v=""}m=h;m=m.replace(/@@@wcf_empty_line@@@/g,"\n");m=m.replace(/\n\n$/,"\n");m=m.replace(/<br>$/,"");m=m.replace(/<br>/g,"\n");m=m.replace(/<br>/g,"");m=m.replace(/&nbsp;/gi," ");m=m.replace(/<blockquote class="quoteBox" cite="([^"]+)?" data-author="([^"]+)?"[^>]*?>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(x,z,y,A){var B;if(y){y=WCF.String.unescapeHTML(y)}if(z){z=WCF.String.unescapeHTML(z)}if(z){B="[quote='"+y+"','"+z+"']"}else{if(y){B="[quote='"+y+"']"}else{B="[quote]"}}return B});m=m.replace(/(?:\n*)<\/blockquote>\n?/gi,"[/quote]\n");m=m.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");m=m.replace(/<a[^>]+><\/a>/,"");m=m.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(A,y,z,B){if(z==B){return"[url]"+z+"[/url]"}return"[url='"+z+"']"+B+"[/url]"});m=m.replace(/<(?:b|strong)>/gi,"[b]");m=m.replace(/<\/(?:b|strong)>/gi,"[/b]");m=m.replace(/<(?:i|em)>/gi,"[i]");m=m.replace(/<\/(?:i|em)>/gi,"[/i]");m=m.replace(/<u>/gi,"[u]");m=m.replace(/<\/u>/gi,"[/u]");m=m.replace(/<sub>/gi,"[sub]");m=m.replace(/<\/sub>/gi,"[/sub]");m=m.replace(/<sup>/gi,"[sup]");m=m.replace(/<\/sup>/gi,"[/sup]");m=m.replace(/<(?:s(trike)?|del)>/gi,"[s]");m=m.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");m=m.replace(/<img [^>]*?alt="([^"]+?)" class="smiley".*?> ?/gi,"$1 ");m=m.replace(/<img [^>]*?class="smiley" alt="([^"]+?)".*?> ?/gi,"$1 ");m=m.replace(/<img [^>]*?class="redactorEmbeddedAttachment[^"]*" data-attachment-id="(\d+)"( style="([^"]+)")?>/gi,function(A,D,x,B){var C="none";var z=null;if(B){B=B.split(";");for(var E=0;E<B.length;E++){var y=$.trim(B[E]);if(y.match(/^float: (left|right)$/)){C=RegExp.$1}else{if(y.match(/^width: (\d+)px$/)){z=RegExp.$1}}}if(z!==null){return"[attach="+D+","+C+","+z+"][/attach]"}else{if(C!=="none"){return"[attach="+D+","+C+"][/attach]"}}}return"[attach="+D+"][/attach]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1 style="([^"]+)".*?>/gi,function(C,F,y,z){var B="none";var A=0;var D=z.split(";");for(var E=0;E<D.length;E++){var x=D[E];if(x.match(/float: (left|right|none)/)){B=RegExp.$1}else{if(x.match(/width: (\d+)px/)){A=parseInt(RegExp.$1)}}}if(A){return"[img='"+y+"',"+B+","+A+"][/img]"}else{if(B!=="none"){return"[img='"+y+"',"+B+"][/img]"}}return"[img]"+y+"[/img]"});m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");var e=m.split(/(<\/?span[^>]*>)/);var v=[];var o=[];var p="";var c={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var a=0;a<e.length;a++){var i=e[a];if(i=="</span>"){var d=o.pop();var h=d.start+v.pop()+d.end;if(v.length){v[v.length-1]+=h}else{p+=h}}else{if(i.match(/^<span/)){if(i.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var k=RegExp.$1;var t;var n;if(k.match(/color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var s=RegExp.$1;var b=RegExp.$2;var f=RegExp.$3;var q=("0123456789ABCDEF".charAt((s-s%16)/16)+""+"0123456789ABCDEF".charAt(s%16))+""+("0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16))+""+("0123456789ABCDEF".charAt((f-f%16)/16)+""+"0123456789ABCDEF".charAt(f%16));t="[color=#"+q+"]";n="[/color]"}else{if(k.match(/color: ?([^;]+);?/i)){t="[color="+RegExp.$1+"]";n="[/color]"}else{if(k.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){t="[size="+RegExp.$1+"]";n="[/size]"}else{if(c[RegExp.$1]){t="[size="+c[RegExp.$1]+"]";n="[/size]"}else{t="";n=""}}}else{if(k.match(/font-family: ?([^;]+);?/)){t="[font='"+RegExp.$1.replace(/'/g,"")+"']";n="[/font]"}else{t='<span style="'+k+'">';n="</span>"}}}}v[v.length]="";o[v.length]={start:t,end:n}}else{if(i.match(/^<span class="inlineCode">/)){v[v.length]="";o[v.length]={start:"[tt]",end:"[/tt]"}}else{v[v.length]="";o[v.length]={start:"",end:""}}}}else{if(v.length){v[v.length-1]+=i}else{p+=i}}}}m=p;m=m.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(y,x,A,z){return"[align="+A+"]"+$.trim(z)+"[/align]"});m=m.replace(/<li>/gi,"[*]");m=m.replace(/<\/li>/gi,"");m=m.replace(/<ul>/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/<table[^>]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(x,y){return $.trim(y)});m=m.replace(/<tr><\/tr>/gi,"");m=m.replace(/<tr>/gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)*<td>(\t)*/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var u={};m.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(x){var y=x.hashCode();u[y]=x.replace(/\$/g,"$$$$");return"@@"+y+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:m});m=m.replace(/<[^(<|>)]+>/g,"");if($.getLength(u)){for(var j in u){var r=new RegExp("@@"+j+"@@","g");data=data.replace(r,u[j])}}m=m.replace(/&lt;/g,"<");m=m.replace(/&gt;/g,">");m=m.replace(/&amp;/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");m=m.replace(/\[\/code\]\n\n?/g,"[/code]\n\n");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:m});m=$.trim(m);if(m.length){m+="\n"}return m},convertToHtml:function(E){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:E});E=this.wutil.removeZeroWidthSpace(E);E=E.replace(/&/g,"&amp;");E=E.replace(/</g,"&lt;");E=E.replace(/>/g,"&gt;");var s=[];var n=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");E=E.replace(n,function(F){var G=F.hashCode();s.push({key:G,value:F.replace(/\$/g,"$$$$")});return"@@"+G+"@@"});E=E.replace(/\[url\]([^"]+?)\[\/url]/gi,'<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\]([\s\S]*?)\[\/b]/gi,"<b>$1</b>");E=E.replace(/\[i\]([\s\S]*?)\[\/i]/gi,"<i>$1</i>");E=E.replace(/\[u\]([\s\S]*?)\[\/u]/gi,"<u>$1</u>");E=E.replace(/\[s\]([\s\S]*?)\[\/s]/gi,"<strike>$1</strike>");E=E.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,"<sub>$1</sub>");E=E.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,"<sup>$1</sup>");E=E.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2" />');E=E.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2; width: $3px" />');E=E.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');E=E.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,'<span style="font-size: $1pt">$2</span>');E=E.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,'<span style="color: $1">$2</span>');E=E.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,'<span style="font-family: $1">$2</span>');E=E.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');E=E.replace(/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");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]\n?/gi,"</ul>\n");E=E.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(F,G){return"[table]"+$.trim(G)+"[/table]"});E=E.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');E=E.replace(/\[\/table\](\n*)?/gi,function(F,G){if(G){if(G.match(/\n/g).length>2){G=G.replace(/^\n/,"")}return"</table>"+G}return"</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(F,H){var G=$.trim(H);if(!G.length){G="&#8203;"}return"<td>"+G+"</td>"});var c=this.wutil.getOption("woltlab.attachmentUrl");var D=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(c){var B=this.wbbcode._getImageAttachments();E=E.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(F,G,H){G=parseInt(G);if(B[G]!==undefined){return'<img src="'+D.replace(/987654321/,G)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+G+'" />'}return F});E=E.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(G,H,I){H=parseInt(H);if(B[H]!==undefined){var F="";if(I==="left"||I==="right"){F="float: "+I+";"}F=' style="'+F+'"';return'<img src="'+D.replace(/987654321/,H)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+H+'"'+F+" />"}return G});E=E.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(G,I,J,H){I=parseInt(I);if(B[I]!==undefined){var F="width: "+H+"px; max-height: "+B[I].height+"px; max-width: "+B[I].width+"px;";if(J==="left"||J==="right"){F+="float: "+J+";"}F=' style="'+F+'"';return'<img src="'+c.replace(/987654321/,I)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+I+'"'+F+" />"}return G})}for(var u in __REDACTOR_SMILIES){var j=u.replace(/</g,"&lt;").replace(/>/g,"&gt;");var i=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(j)+"(?=\\s|<|$)","gi");E=E.replace(i,'$1<img src="'+__REDACTOR_SMILIES[u]+'" class="smiley" alt="'+j+'" />')}E=E.replace(/(javascript):/gi,"$1<span></span>:");E=E.replace(/(\r|\r\n)/g,"\n");var x=[];var A=[];var g=E.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/);var d=WCF.getUUID();while(true){var o=false;for(var a=0;a<g.length;a++){var z=g[a];if(z==="[/quote]"){o=true;var e="";var m=g.slice(0,a);var b=false;while(m.length){var y=m.pop();e=y+e;if(y.match(/^\[quote/)){z=e+z;var l=WCF.getUUID();x.push({hashCode:l,content:z.replace(/\$/g,"$$$$")});A.push(l);z="@@"+l+"@@";b=true;break}}if(!b){m=g.slice(0,a);z=d}g=m.concat(z,g.slice(a+1));break}}if(!o){break}}E=g.join("");E=E.replace(new RegExp(d,"g"),"[/quote]");E=E.replace(/\n*$/,"");var f=E.split("\n");E="";for(var a=0,k=f.length;a<k;a++){var r=$.trim(f[a]);if(r.match(/^<([a-z]+)/)){if(!this.reIsBlock.test(RegExp.$1.toUpperCase())){r="<p>"+r+"</p>"}E+=r}else{if(!r){r="<br>"}else{if(r.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,A)){E+=r;continue}}}E+="<p>"+r+"</p>"}}if(x.length){var C=function(F){return F.replace(/^['"]/,"").replace(/['"]$/,"")};var q=this;var p=function(F){return F.replace(/\[quote(=['"].+['"])?\]([\S\s]*)\[\/quote\]/gi,function(I,H,K){var O="";var J="";if(H){H=H.substr(1);H=H.split(",");switch(H.length){case 1:O=H[0];break;case 2:O=H[0];J=H[1];break}O=WCF.String.escapeHTML(C($.trim(O)));J=WCF.String.escapeHTML(C($.trim(J)))}var P='<blockquote class="quoteBox" cite="'+J+'" data-author="'+O+'"><div class="container containerPadding"><header contenteditable="false"><h3>'+q.wbbcode._buildQuoteHeader(O,J)+'</h3><a class="redactorQuoteEdit"></a></header>';K=$.trim(K);var G="";if(K.length){var N=K.split("\n");for(var M=0;M<N.length;M++){var L=N[M];if(L.length===0){L=q.opts.invisibleSpace}else{if(L.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,A)){G+=L;continue}}}G+="<div>"+L+"</div>"}}else{G="<div>"+q.opts.invisibleSpace+"</div>"}P+=G;P+="</div></blockquote>";return P})};for(var a=x.length-1;a>=0;a--){var t=x[a];var v=new RegExp("@@"+t.hashCode+"@@","g");E=E.replace(v,p(t.content))}}if(s.length){for(var a=s.length-1;a>=0;a--){var w=s[a];var v=new RegExp("@@"+w.key+"@@","g");var h=w.value;h=h.replace(/^\[tt\](.*)\[\/tt\]/,'<span class="inlineCode">$1</span>');h=h.replace(/^\[code[^\]]*\][\S\s]*\[\/code\]$/,"<pre>$&</pre>");E=E.replace(v,h)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:E});return E},_pasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/<h([1-6])[^>]+>/g,function(c,d){return"[size="+b[d]+"]"});a=a.replace(/<\/h[1-6]>/g,"[/size]");a=a.replace(/<(article|header)[^>]+>/g,"<div>");a=a.replace(/<\/(article|header)>/g,"</div>");a=a.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");a=a.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");a=a.replace(/<(div|p)><br><\/(div|p)>/g,"<p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:a});return a},_pasteCallback:function(a){a=a.replace(/<br[^>]*>(<br[^>]*>)+/g,"$1");a=a.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');a=a.replace(/\[\/size\]/g,"</span></p>");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:a});return a;a=a.replace(/<img([^>]+)>/g,function(b,c){b=b.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return b});return a},insertAttachment:function(e,c){e=parseInt(e);var a=this.wutil.getOption("woltlab.attachment"+(!c?"Thumbnail":"")+"Url");var d=this.wbbcode._getImageAttachments();if(a&&d[e]!==undefined){var b="";if(c){b=' style="width: '+d[e].width+"px; max-height: "+d[e].height+"px; max-width: "+d[e].width+'px;"'}this.wutil.insertDynamic('<img src="'+a.replace(/987654321/,e)+'" class="redactorEmbeddedAttachment'+(!c?" redactorDisableResize":"")+'" data-attachment-id="'+e+'"'+b+" />","[attach="+e+(c?",none,"+d[e].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+e+"][/attach]")}},removeAttachment:function(a){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(b,d){var c=$(d);if(c.data("attachmentID")==a){c.remove()}})},_getImageAttachments:function(){var b=this.wutil.getOption("woltlab.attachmentImages")||[];if(b.length){delete this.opts.attachmentImages;return b}var a={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),a);return a.imageAttachments},_keydownCallback:function(g){switch(g.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var a=$(this.selection.getCurrent());var f=this.selection.getParent();f=(f)?$(f):f;var l=(f)?f.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(g.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){if(l.length){var c=true;l.find("div > div").each(function(){if($(this).text().replace(/\u200B/,"").length){c=false;return false}});if(c){var h=window.getSelection();if(h.rangeCount){h.removeAllRanges()}var i=document.createRange();i.selectNode(l[0]);h.addRange(i);g.cancel=true}}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()){if(this.wutil.isEndOfElement(a[0])&&a.next("blockquote").length){var h=window.getSelection();if(h.rangeCount){h.removeAllRanges()}var i=document.createRange();i.selectNode(a.next()[0]);h.addRange(i);g.cancel=true}}break;case $.ui.keyCode.DOWN:if(a.next("blockquote").length){this.caret.setStart(a.next().find("> div > div:first"));g.cancel=true}else{if(f){if(f.next("blockquote").length){this.caret.setStart(f.next().find("> div > div:first"));g.cancel=true}else{if(l.length){var k=a.closest("div",l[0]);if(!k.next().length){if(l.next().length){this.caret.setStart(l.next())}else{this.wutil.setCaretAfter(l)}g.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(l.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!f||!l.length){return}var k=a.closest("div",l[0]);var b=k.prev();if(b[0].tagName==="DIV"){return}else{if(b[0].tagName==="BLOCKQUOTE"){return}}var j=l.prev();if(j.length===0){this.wutil.setCaretBefore(l)}else{if(j[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(j.find("> div > div:last"))}else{if($.trim(j.html())==""){j.html(this.opts.invisibleSpace)}this.caret.setEnd(j)}}g.cancel=true;break;case 83:var e=false;if(navigator.platform.match(/^Mac/)){if(g.event.ctrlKey&&g.event.altKey){e=true}}else{if(g.event.altKey){e=true}}if(e){var d={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),d);if(d.cancel){g.cancel=true}}break}},_keyupCallback:function(a){if(a.event.which!==$.ui.keyCode.BACKSPACE&&a.event.which!==$.ui.keyCode.DELETE){return}this.$editor.find("blockquote").each(function(b,d){var c=$(d);if(!c.find("> div > header").length){c.remove()}})},_observeQuotes:function(){this.$editor.find(".redactorQuoteEdit:not(.jsRedactorQuoteEdit)").addClass("jsRedactorQuoteEdit").click($.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(d){var b=$(d.currentTarget).closest("header");var c=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(d.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(c);var a=b.offset();c.css({left:a.left+"px",top:(a.top+20)+"px"});$(".redactor-link-tooltip").remove();c.appendTo(document.body);$('<div contenteditable="true" />').appendTo(document.body).focus().remove()},_openQuoteEditOverlay:function(a,c){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(c?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save"));if(c){this.selection.save();b.click($.proxy(function(){var f=$("#redactorQuoteAuthor").val();var e=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();var d=this.selection.getHtml();if(this.utils.isEmpty(d)){d=""}var g=this.wbbcode.insertQuoteBBCode(f,e,d);if(g!==null){if(!d.length){this.caret.setStart(g.find("> div > div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(a.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(a.attr("cite")));b.click($.proxy(function(){var d=$("#redactorQuoteAuthor").val();a.data("author",d);a.attr("data-author",d);a.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(a);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(b){var c=b.data("author");var a=b.attr("cite");if(a){a=WCF.String.escapeHTML(a)}b.find("> div > header > h3").empty().append(this.wbbcode._buildQuoteHeader(c,a))},insertQuoteBBCode:function(c,h,d,e){var g="[quote]";var a="[/quote]";if(c){if(h){g="[quote='"+c+"','"+h+"']"}else{g="[quote='"+c+"']"}}var l=null;if(this.wutil.inWysiwygMode()){var f=(e)?this.wbbcode.convertToHtml(e):d;var k=WCF.getUUID();var b=this.wbbcode.convertToHtml(g+k+a);b=b.replace(k,f.replace(/^<p>/,"").replace(/<\/p>$/,""));b=b.replace(/^<p>/,"").replace(/<\/p>$/,"");b=b.replace(/<blockquote/,'<blockquote id="'+k+'"');this.insert.html(b,false);l=this.$editor.find("#"+k);if(l.length){var j=l.find("> div > div");if(j.length==1){if(j[0].innerHTML===""){j[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var i=l.find("> div > br[type=_moz]");if(i.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(i);i.remove()}}}l.removeAttr("id");this.wutil.setCaretAfter(l[0])}this.wbbcode._observeQuotes();this.wbbcode._fixQuotes();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(g+e+a)}this.wmonkeypatch.saveSelection();return l},_buildQuoteHeader:function(b,c){var a="";if(!b&&c){b=c;c=""}if(b){if(c){a+='<a href="'+c+'">'}a+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(b)});if(c){a+="</a>"}}else{a="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return a},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_fixQuotes:function(){var a=(function(d,c){var b="P";if(d.parentElement.tagName==="DIV"&&d.parentElement!==this.$editor[0]){d=d.parentElement;b="DIV"}if(d[c]===null||d[c].tagName!==b){$("<"+b+">"+this.opts.invisibleSpace+"</"+b+">")[(c==="previousElementSibling"?"insertBefore":"insertAfter")](d)}else{if(d.previousElementSibling.tagName===b){if(!d[c].innerHTML.length||d[c].innerHTML.toLowerCase()==="<p></p>"){$(d[c]).html(this.opts.invisibleSpace)}}}}).bind(this);this.$editor.find("blockquote").each((function(b,c){a(c,"previousElementSibling");a(c,"nextElementSibling")}).bind(this))}}};
 // wbutton.js
 if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbutton=function(){return{_bbcodes:{},init:function(){this._bbcodes={};for(var h=0,e=__REDACTOR_BUTTONS.length;h<e;h++){this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[h])}var a={html:"fa-square-o",bold:"fa-bold",italic:"fa-italic",underline:"fa-underline",deleted:"fa-strikethrough",subscript:"fa-subscript",superscript:"fa-superscript",orderedlist:"fa-list-ol",unorderedlist:"fa-list-ul",outdent:"fa-outdent",indent:"fa-indent",link:"fa-link",alignment:"fa-align-left",table:"fa-table"};var d={fontcolor:WCF.Language.get("wcf.bbcode.button.fontColor"),fontfamily:WCF.Language.get("wcf.bbcode.button.fontFamily"),fontsize:WCF.Language.get("wcf.bbcode.button.fontSize"),image:WCF.Language.get("wcf.bbcode.button.image"),subscript:WCF.Language.get("wcf.bbcode.button.subscript"),superscript:WCF.Language.get("wcf.bbcode.button.superscript")};var b=this.wutil.getOption("buttons");var g="";for(var h=0,e=b.length;h<e;h++){var c=b[h];if(c=="separator"){this.button.get(g).parent().addClass("separator");continue}var f=this.button.get(c);if(f.length){if(a[c]){this.button.setAwesome(c,a[c])}if(c==="table"&&g){f.parent().insertAfter(this.button.get(g).parent())}}else{this.wbutton._addCoreButton(c,(d[c]?d[c]:null),(a[c]?a[c]:null),g)}g=c}this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this))},_addCoreButton:function(b,c,a,d){var f={title:(c===null?b:c)};if(b==="subscript"||b==="superscript"){f.command=b}var e=this.button.build(b,f);$("<li />").append(e).insertAfter(this.button.get(d).parent());if(a!==null){this.button.setAwesome(b,a)}},_addBBCodeButton:function(b){var c="__wcf_"+b.name;var a=this.button.add(c,b.label);this.button.addCallback(a,this.wbutton._insertBBCode);this._bbcodes[c]=b.name;if(b.icon.match(/^fa\-[a-z\-]+$/)){this.button.setAwesome(c,b.icon)}else{a.css("background-image","url("+__REDACTOR_ICON_PATH+b.icon+")")}},_insertBBCode:function(a){var d=this._bbcodes[a];var b={buttonName:a,cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+d+"_"+this.$textarea.wcfIdentify(),b);if(b.cancel===false){var c=this.selection.getHtml();if(false&&d==="tt"){var e=(this.selection.getParent())?$(this.selection.getParent()):null;if(e&&e.closest("inline.inlineCode",this.$editor.get()[0]).length){this.inline.toggleClass("inlineCode")}else{this.inline.toggleClass("inlineCode")}}else{this.insert.html("["+d+"]"+c+this.selection.getMarkerAsHtml()+"[/"+d+"]",false);this.selection.restore()}}event.preventDefault();return false},insertImage:function(){this.image.show()},_insertImage:function(){var d=$("#redactor-image-link-source");var b=d.val().trim();if(b.length){this.buffer.set();var c=$("#redactor-image-align").val();var a="";if(c==="left"||c==="right"){a=' style="float: '+c+'"'}this.insert.html('<img src="'+b+'"'+a+">",false);this.modal.close();this.observe.images()}else{if(!d.next("small.innerError")){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(d)}}}}};
 // wfontcolor.js
@@ -15,4 +15,4 @@ if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch=functio
 // wupload.js
 if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wupload=function(){return{_boundGlobalUploadEvents:false,_dropArea:{},_timer:null,_isDragging:false,_isFile:false,init:function(){var a=".redactor_"+this.$textarea.wcfIdentify();$(document).on("dragover"+a,$.proxy(this.wupload._dragOver,this));$(document).on("dragleave"+a,$.proxy(this.wupload._dragLeave,this));$(document).on("drop"+a,(function(b){b.preventDefault();this.wupload._revertDropArea(undefined,this.$textarea.wcfIdentify())}).bind(this));if(!this.wupload._boundGlobalUploadEvents){this.wupload._boundGlobalUploadEvents=true;$(document).on("dragend",function(b){b.preventDefault()})}WCF.System.Event.addListener("com.woltlab.wcf.attachment","autoInsert_"+this.$textarea.wcfIdentify(),$.proxy(this.wupload.insertPastedImageAttachment,this))},_dragOver:function(d){d=d.originalEvent;if(!d.dataTransfer||!d.dataTransfer.types){return}var e=false;for(var c in d.dataTransfer){if(/^moz/.test(c)){e=true;break}}this.wupload._isFile=false;if(e){if(d.dataTransfer.types[0]==="application/x-moz-file"){this.wupload._isFile=true}}else{for(var g=0;g<d.dataTransfer.types.length;g++){if(d.dataTransfer.types[g]==="Files"){this.wupload._isFile=true;break}}}if(!this.wupload._isFile){return}this.wupload._isFile=true;d.preventDefault();if(!this.wupload._isDragging){var b=this.$textarea.wcfIdentify();if(this.wupload._dropArea[b]===undefined){this.wupload._dropArea[b]=$('<div class="redactorDropArea">'+WCF.Language.get("wcf.attachment.dragAndDrop.dropHere")+"</div>").hide().appendTo(document.body);this.wupload._dropArea[b].on("dragover",$.proxy(this.wupload._hoverDropArea,this)).on("dragleave",$.proxy(this.wupload._revertDropArea,this)).on("drop",$.proxy(this.wupload._drop,this))}var a=(this.wutil.inWysiwygMode())?this.$editor.getDimensions("outer"):this.$textarea.getDimensions("outer");var f=(this.wutil.inWysiwygMode())?this.$editor.getOffsets("offset"):this.$textarea.getOffsets("offset");this.wupload._dropArea[b].css({height:a.height+"px",left:f.left+"px",lineHeight:a.height+"px",top:f.top+"px",width:a.width+"px"}).show();this.wupload._isDragging=true}d.preventDefault()},_hoverDropArea:function(a){this.wupload._dropArea[this.$textarea.wcfIdentify()].addClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropNow"))},_revertDropArea:function(c,a){if(!this.wupload._isFile){return}var b=a||this.$textarea.wcfIdentify();this.wupload._dropArea[b].removeClass("active").text(WCF.Language.get("wcf.attachment.dragAndDrop.dropHere"));if(a){this.wupload._dropArea[b].hide()}},_dragLeave:function(){if(!this.wupload._isDragging||!this.wupload._isFile){return}if(this.wupload._timer===null){this.wupload._timer=new WCF.PeriodicalExecuter((function(a){a.stop();if(!this.wupload._isDragging){this.wupload._dropArea[this.$textarea.wcfIdentify()].hide()}}).bind(this),100)}else{this.wupload._timer.resume()}this.wupload._isDragging=false},_drop:function(c){if(!this.wupload._isFile){return}c=c.originalEvent||c;if(c.dataTransfer&&c.dataTransfer.files.length){c.preventDefault();var b=this.$textarea.wcfIdentify();this.wupload._revertDropArea(undefined,b);for(var d=0;d<c.dataTransfer.files.length;d++){var a=c.dataTransfer.files[d];if(a.type){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+b,{file:a})}}}},pasteClipboardUploadMozilla:function(){this.$editor.find("img[data-mozilla-paste-image]").each($.proxy(function(d,g){var f=$(g);var a=f.prop("src").split(",");var e=a[0].split(";")[0].split(":")[1];var c=a[1];var b={blob:WCF.base64toBlob(c,e),uploadID:null};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","upload_"+this.$textarea.wcfIdentify(),b);f.replaceWith('<span class="redactor-pastedImageFromClipboard-'+b.uploadID+'" />')},this))},insertPastedImageAttachment:function(b){var a=this.$editor.find("span.redactor-pastedImageFromClipboard-"+b.uploadID);a.before(b.attachment);a.remove()}}};
 // wutil.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil=function(){var a="";var b=null;return{_autosaveWorker:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var c=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();c.call(this)}).bind(this)},insertAtCaret:function(d){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var e=this.$textarea.getCaret();if(e==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var c=this.$textarea.val();c=c.substr(0,e)+d+c.substr(e);this.$textarea.val(c);return true},insertDynamic:function(c,d){if(this.wutil.inWysiwygMode()){this.insert.html(c,false)}else{if(d===undefined||d===null){d=c}this.wutil.insertAtCaret(d)}},setOption:function(c,d){if(c.indexOf(".")!==-1){c=c.split(".",2);this.opts[c[0]][c[1]]=d}else{this.opts[c]=d}},getOption:function(c){if(c.indexOf(".")!==-1){c=c.split(".",2);if(this.opts[c[0]][c[1]]){return this.opts[c[0]][c[1]]}}else{if(this.opts[c]){return this.opts[c]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(c){getSelection().removeAllRanges();getSelection().addRange(c)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var c=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(c)))}return $.trim(this.$textarea.val())},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(this.$textarea.val())))}this.wutil.autosavePurge()},reset:function(){if(this.opts.visual){this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>");this.wmonkeypatch.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(c){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:c})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter($.proxy(this.wutil.saveTextToStorage,this),60*1000)}return true},saveTextToStorage:function(){var c=this.wutil.getText();if(a==c){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:c,timestamp:Date.now()}));a=c;this.wutil.autosaveShowNotice("saved")}catch(d){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+d.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(c){console.debug("[wutil.autosavePurge] Unable to access local storage: "+c.message)}},autosaveRestore:function(){var c=this.wutil.getOption("woltlab.autosave");var d=null;try{d=localStorage.getItem(c.key)}catch(f){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+f.message)}try{d=(d===null)?null:JSON.parse(d)}catch(f){d=null}if(d===null||!d.content){return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",d.content)}else{this.$textarea.val(d.content)}this.wutil.autosaveShowNotice("restored",{timestamp:d.timestamp});WCF.DOMNodeInsertedHandler.execute();return true},autosaveShowNotice:function(e,g){if(b===null){b=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>');b.appendTo(this.$box);b.on("transitionend webkitTransitionEnd",(function(h){if(h.originalEvent.propertyName!=="opacity"){return}if(b.hasClass("open")){if(b.data("callbackOpen")){b.data("callbackOpen")()}}else{if(b.data("callbackClose")){b.data("callbackClose")()}b.removeData("callbackClose");b.removeData("callbackOpen");b.removeClass("redactorAutosaveNoticeRestore");b.empty();$('<span class="redactorAutosaveMessage" />').appendTo(b)}}).bind(this))}var d="";switch(e){case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(g.timestamp).toLocaleString()})+'"></span>').prependTo(b);var f=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(b);var c=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(b);f.click(function(){b.removeClass("open")});c.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(h){if(h==="confirm"){this.wutil.reset();this.wutil.autosavePurge();b.removeClass("open")}}).bind(this))}).bind(this));d=WCF.Language.get("wcf.message.autosave.restored");b.addClass("redactorAutosaveNoticeRestore");break;case"saved":if(b.hasClass("open")){return}setTimeout(function(){b.removeClass("open")},2000);d=WCF.Language.get("wcf.message.autosave.saved");break}b.children("span.redactorAutosaveMessage").text(d);b.addClass("open")},autosavePurgeOutdated:function(){var h=0;var k=this.wutil.getOption("woltlab.autosave").prefix;var j=k+"_wcf_master";try{h=localStorage.getItem(j)}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}if(h===0){return}var c=Date.now()-(7*24*3600*1000);if(h===null||h<c){var g=new RegExp("^"+k+"_");for(var f in localStorage){if(f.match(g)&&f!==j){var d=localStorage.getItem(f);try{d=JSON.parse(d)}catch(i){d={timestamp:0}}if(d===null||!d.timestamp||d.timestamp<c){try{localStorage.removeItem(f)}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}}}}try{localStorage.setItem(j,Date.now())}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}}},buttonReplace:function(f,d,g,i,h){var c=this.buttonGet(f);var e=this.buttonAddAfter(f,d,g,i,h);if(c.parent().hasClass("separator")){e.parent().addClass("separator")}c.parent().remove();return e},removeZeroWidthSpace:function(c){var d="";for(var g=0,f=c.length;g<f;g++){var e=c.charCodeAt(g).toString(16);if(e!="200b"){d+=c[g]}}return d},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var c=this.$editor.children(":last")[0];if(c.tagName==="P"){if(c.innerHTML===""){c.remove();c=$(this.opts.emptyHtml).appendTo(this.$editor)[0]}if(c.lastChild.nodeType===Element.TEXT_NODE){this.caret.set(c.lastChild,c.lastChild.length,c.lastChild,c.lastChild.length)}else{this.caret.setEnd(c)}}else{this.wutil.setCaretAfter(c)}},isCaret:function(){this.selection.get();return this.range.collapsed},isEndOfElement:function(c){this.selection.get();if(!this.wutil.isCaret()){return false}if(this.range.endContainer.nodeType===Element.TEXT_NODE){if(this.range.endOffset<this.range.endContainer.length){return false}}if(!this.wutil.isNodeWithin(this.range.endContainer,c)){return false}var d=this.range.endContainer;while(d!==c){if(d.nextSibling){return false}d=d.parentNode}return true},isNodeWithin:function(e,d){var c=$(e);while(c[0]!==this.$editor[0]){if(c[0]===d){return true}c=c.parent()}return false},containsTag:function(d,c){switch(d.nodeType){case Element.ELEMENT_NODE:if(d.tagName===c){return true}case Element.DOCUMENT_FRAGMENT_NODE:for(var e=0;e<d.childNodes.length;e++){if(this.wutil.containsTag(d.childNodes[e],c)){return true}}return false;break;default:return false;break}},replaceText:function(e){var f=$(document);var c=f.scrollTop();var d=false;if(this.wutil.inWysiwygMode()){this.code.toggle();d=true}this.$textarea.val(e);if(d){this.code.toggle();f.scrollTop(c)}f.trigger("resize")},setCaretBefore:function(c){this.wutil._setCaret(c,true)},setCaretAfter:function(c){this.wutil._setCaret(c,false)},_setCaret:function(d,e){var c=$(this.opts.emptyHtml);c[(e?"insertBefore":"insertAfter")](d);this.caret.setStart(c[0])}}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil=function(){var a="";var b=null;return{_autosaveWorker:null,init:function(){this.$textarea.parents("form").submit($.proxy(this.wutil.submit,this));if(this.wutil.getOption("woltlab.autosave").active){this.wutil.autosaveEnable();if(this.wutil.getOption("woltlab.autosave").saveOnInit||this.$textarea.data("saveOnInit")){this.wutil.setOption("woltlab.autosaveOnce",true)}else{this.wutil.autosaveRestore()}}this.wutil.setOption("autosave",false);var c=this.core.destroy;this.core.destroy=(function(){this.wutil.autosaveDisable();c.call(this)}).bind(this)},insertAtCaret:function(d){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$textarea.focus();var e=this.$textarea.getCaret();if(e==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var c=this.$textarea.val();c=c.substr(0,e)+d+c.substr(e);this.$textarea.val(c);return true},insertDynamic:function(c,d){if(this.wutil.inWysiwygMode()){this.insert.html(c,false)}else{if(d===undefined||d===null){d=c}this.wutil.insertAtCaret(d)}},setOption:function(c,d){if(c.indexOf(".")!==-1){c=c.split(".",2);this.opts[c[0]][c[1]]=d}else{this.opts[c]=d}},getOption:function(c){if(c.indexOf(".")!==-1){c=c.split(".",2);if(this.opts[c[0]][c[1]]){return this.opts[c[0]][c[1]]}}else{if(this.opts[c]){return this.opts[c]}}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(c){getSelection().removeAllRanges();getSelection().addRange(c)},getText:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();var c=this.$textarea.val();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(c)))}return $.trim(this.$textarea.val())},isEmptyEditor:function(){if(this.opts.visual){return this.utils.isEmpty(this.$editor.html())}return(!$.trim(this.$textarea.val()))},submit:function(){if(this.wutil.inWysiwygMode()){this.code.startSync();this.$textarea.val($.trim(this.wbbcode.convertFromHtml(this.$textarea.val())))}this.wutil.autosavePurge()},reset:function(){if(this.opts.visual){this.$editor.html("<p>"+this.opts.invisibleSpace+"</p>");this.wmonkeypatch.saveSelection()}this.$textarea.val("");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset",{wysiwygContainerID:this.$textarea.wcfIdentify()})},autosaveEnable:function(c){if(!this.wutil.getOption("woltlab.autosave").active){this.wutil.setOption("woltlab.autosave",{active:true,key:c})}if(this.wutil._autosaveWorker===null){this.wutil.autosavePurgeOutdated();this.wutil._autosaveWorker=new WCF.PeriodicalExecuter($.proxy(this.wutil.saveTextToStorage,this),60*1000)}return true},saveTextToStorage:function(){var c=this.wutil.getText();if(a==c){return}try{localStorage.setItem(this.wutil.getOption("woltlab.autosave").key,JSON.stringify({content:c,timestamp:Date.now()}));a=c;this.wutil.autosaveShowNotice("saved")}catch(d){console.debug("[wutil.saveTextToStorage] Unable to access local storage: "+d.message)}},autosaveDisable:function(){if(!this.wutil.getOption("woltlab.autosave").active){return false}this.wutil._autosaveWorker.stop();this.wutil._autosaveWorker=null;this.wutil.setOption("woltlab.autosave",{active:false,key:""});return true},autosavePurge:function(){try{localStorage.removeItem(this.wutil.getOption("woltlab.autosave").key)}catch(c){console.debug("[wutil.autosavePurge] Unable to access local storage: "+c.message)}},autosaveRestore:function(){var c=this.wutil.getOption("woltlab.autosave");var d=null;try{d=localStorage.getItem(c.key)}catch(f){console.debug("[wutil.autosaveRestore] Unable to access local storage: "+f.message)}try{d=(d===null)?null:JSON.parse(d)}catch(f){d=null}if(d===null||!d.content){return false}if(this.wutil.inWysiwygMode()){this.wutil.setOption("woltlab.originalValue",d.content)}else{this.$textarea.val(d.content)}this.wutil.autosaveShowNotice("restored",{timestamp:d.timestamp});WCF.DOMNodeInsertedHandler.execute();return true},autosaveShowNotice:function(e,g){if(b===null){b=$('<div class="redactorAutosaveNotice"><span class="redactorAutosaveMessage" /></div>');b.appendTo(this.$box);b.on("transitionend webkitTransitionEnd",(function(h){if(h.originalEvent.propertyName!=="opacity"){return}if(b.hasClass("open")){if(b.data("callbackOpen")){b.data("callbackOpen")()}}else{if(b.data("callbackClose")){b.data("callbackClose")()}b.removeData("callbackClose");b.removeData("callbackOpen");b.removeClass("redactorAutosaveNoticeRestore");b.empty();$('<span class="redactorAutosaveMessage" />').appendTo(b)}}).bind(this))}var d="";switch(e){case"restored":$('<span class="icon icon16 fa-info blue jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.version",{date:new Date(g.timestamp).toLocaleString()})+'"></span>').prependTo(b);var f=$('<span class="icon icon16 fa-check green pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.confirm")+'"></span>').appendTo(b);var c=$('<span class="icon icon16 fa-times red pointer jsTooltip" title="'+WCF.Language.get("wcf.message.autosave.restored.revert")+'"></span>').appendTo(b);f.click(function(){b.removeClass("open")});c.click((function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.message.autosave.restored.revert.confirmMessage"),(function(h){if(h==="confirm"){this.wutil.reset();this.wutil.autosavePurge();b.removeClass("open")}}).bind(this))}).bind(this));d=WCF.Language.get("wcf.message.autosave.restored");b.addClass("redactorAutosaveNoticeRestore");break;case"saved":if(b.hasClass("open")){return}setTimeout(function(){b.removeClass("open")},2000);d=WCF.Language.get("wcf.message.autosave.saved");break}b.children("span.redactorAutosaveMessage").text(d);b.addClass("open")},autosavePurgeOutdated:function(){var h=0;var k=this.wutil.getOption("woltlab.autosave").prefix;var j=k+"_wcf_master";try{h=localStorage.getItem(j)}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}if(h===0){return}var c=Date.now()-(7*24*3600*1000);if(h===null||h<c){var g=new RegExp("^"+k+"_");for(var f in localStorage){if(f.match(g)&&f!==j){var d=localStorage.getItem(f);try{d=JSON.parse(d)}catch(i){d={timestamp:0}}if(d===null||!d.timestamp||d.timestamp<c){try{localStorage.removeItem(f)}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}}}}try{localStorage.setItem(j,Date.now())}catch(i){console.debug("[wutil.autosavePurgeOutdated] Unable to access local storage: "+i.message)}}},buttonReplace:function(f,d,g,i,h){var c=this.buttonGet(f);var e=this.buttonAddAfter(f,d,g,i,h);if(c.parent().hasClass("separator")){e.parent().addClass("separator")}c.parent().remove();return e},removeZeroWidthSpace:function(c){var d="";for(var g=0,f=c.length;g<f;g++){var e=c.charCodeAt(g).toString(16);if(e!="200b"){d+=c[g]}}return d},getSource:function(){return this.$textarea},getName:function(){return this.$textarea.wcfIdentify()},selectionEndOfEditor:function(){this.focus.setEnd();var c=this.$editor.children(":last")[0];if(c.tagName==="P"){if(c.innerHTML===""){c.remove();c=$(this.opts.emptyHtml).appendTo(this.$editor)[0]}if(c.lastChild.nodeType===Element.TEXT_NODE){this.caret.set(c.lastChild,c.lastChild.length,c.lastChild,c.lastChild.length)}else{this.caret.setEnd(c)}}else{this.wutil.setCaretAfter(c)}},isCaret:function(){this.selection.get();return this.range.collapsed},isEndOfElement:function(c){this.selection.get();if(!this.wutil.isCaret()){return false}if(this.range.endContainer.nodeType===Element.TEXT_NODE){if(this.range.endOffset<this.range.endContainer.length){return false}}if(!this.wutil.isNodeWithin(this.range.endContainer,c)){return false}var d=this.range.endContainer;while(d!==c){if(d.nextSibling){return false}d=d.parentNode}return true},isNodeWithin:function(e,d){var c=$(e);while(c[0]!==this.$editor[0]){if(c[0]===d){return true}c=c.parent()}return false},containsTag:function(d,c){switch(d.nodeType){case Element.ELEMENT_NODE:if(d.tagName===c){return true}case Element.DOCUMENT_FRAGMENT_NODE:for(var e=0;e<d.childNodes.length;e++){if(this.wutil.containsTag(d.childNodes[e],c)){return true}}return false;break;default:return false;break}},replaceText:function(e){var f=$(document);var c=f.scrollTop();var d=false;if(this.wutil.inWysiwygMode()){this.code.toggle();d=true}this.$textarea.val(e);if(d){this.code.toggle();f.scrollTop(c)}f.trigger("resize")},setCaretBefore:function(c){this.wutil._setCaret(c,true)},setCaretAfter:function(c){this.wutil._setCaret(c,false)},_setCaret:function(d,e){var c=$(this.opts.emptyHtml);c[(e?"insertBefore":"insertAfter")](d);this.caret.setEnd(c[0])}}};