// 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 h=$.trim(this.wutil.getOption("woltlab.originalValue"));if(h.length){this.wutil.replaceText(h);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var c=this.clean.onSync;this.clean.onSync=function(h){h=h.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return c.call(self,h)};if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var b=this.button.get("table");if(b.length){var g=b.data("dropdown");g.find(".redactor-dropdown-add_head").parent().remove();g.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(g.find(".redactor-dropdown-delete_table").parent());b.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+d,$.proxy(function(h){h.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+d,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+d,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var e=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var f=function(h){h.find("br").each(function(i,j){if(j.children.length){$(j).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");e.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode._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"));f(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(h){this.wutil.saveSelection();if(h.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var a=this.opts.verifiedTags.indexOf("ul");if(a>-1){this.opts.verifiedTags.splice(a,1)}},_tableButtonClick:function(b){var c=$(b.currentTarget);if(!c.hasClass("dropact")){return}var a=this.selection.getBlock()||this.selection.getCurrent();var d=c.data("dropdown");d.children("li").show();var e=d.find("> li > .redactor-dropdown-insert_table").parent();if(a.tagName=="TD"){e.hide()}else{e.nextAll().hide()}},insertSmiley:function(a,b,c){if(c){this.wbbcode.registerSmiley(a,b)}if(this.opts.visual){this.insert.html(' <img src="'+b+'" class="smiley" alt="'+a+'" /> ',false)}else{this.wutil.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},convertFromHtml:function(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(/™/gi,"\u2122");m=m.replace(/©/gi,"\u00a9");m=m.replace(/…/gi,"\u2026");m=m.replace(/—/gi,"\u2014");m=m.replace(/‐/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(/ /gi," ");m=m.replace(/<blockquote([^>]+)>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(z,y,B){var C;var A="";var x="";if(y.match(/data-author="([^"]+)"/)){A=WCF.String.unescapeHTML(RegExp.$1)}if(y.match(/cite="([^"]+)"/)){x=WCF.String.unescapeHTML(RegExp.$1)}if(x){C="[quote='"+A+"','"+x+"']"}else{if(A){C="[quote='"+A+"']"}else{C="[quote]"}}return C});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(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/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,"&");E=E.replace(/</g,"<");E=E.replace(/>/g,">");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(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/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="​"}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,"<").replace(/>/g,">");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]+)/)||r.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())){if(r.match(/^<([a-z]+).*<\/\1>/)){E+=r}else{E+=r+"<br />"}}else{E+="<p>"+r+"</p>"}}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(/^\[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(){var a=this.$editor.find(".redactorQuoteEdit:not(.jsRedactorQuoteEdit)");if(a.length){a.each((function(e,d){var b=$(d);b.addClass("jsRedactorQuoteEdit").click($.proxy(this.wbbcode._observeQuotesClick,this));if($.browser.msie){var c=b.parent().parent();c.attr("contenteditable",false);c.children("div").attr("contenteditable",true);c.on("mscontrolselect",function(f){f.preventDefault()})}}).bind(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.wutil.saveSelection();return l},_buildQuoteHeader:function(b,c){var a="";if(!b&&c){b=c;c=""}if(b){if(c){a+='<a href="'+c+'">'}a+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(b)});if(c){a+="</a>"}}else{a="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return a},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_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 h=$.trim(this.wutil.getOption("woltlab.originalValue"));if(h.length){this.wutil.replaceText(h);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection()}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var c=this.clean.onSync;this.clean.onSync=function(h){h=h.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return c.call(self,h)};if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var b=this.button.get("table");if(b.length){var g=b.data("dropdown");g.find(".redactor-dropdown-add_head").parent().remove();g.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(g.find(".redactor-dropdown-delete_table").parent());b.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+d,$.proxy(function(h){h.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+d,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+d,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var e=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var f=function(h){h.find("br").each(function(i,j){if(j.children.length){$(j).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");e.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wbbcode._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"));f(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(h){this.wutil.saveSelection();if(h.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}}).bind(this));var a=this.opts.verifiedTags.indexOf("ul");if(a>-1){this.opts.verifiedTags.splice(a,1)}},_tableButtonClick:function(b){var c=$(b.currentTarget);if(!c.hasClass("dropact")){return}var a=this.selection.getBlock()||this.selection.getCurrent();var d=c.data("dropdown");d.children("li").show();var e=d.find("> li > .redactor-dropdown-insert_table").parent();if(a.tagName=="TD"){e.hide()}else{e.nextAll().hide()}},insertSmiley:function(a,b,c){if(c){this.wbbcode.registerSmiley(a,b)}if(this.opts.visual){this.insert.html(' <img src="'+b+'" class="smiley" alt="'+a+'" /> ',false)}else{this.wutil.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},convertFromHtml:function(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(/™/gi,"\u2122");m=m.replace(/©/gi,"\u00a9");m=m.replace(/…/gi,"\u2026");m=m.replace(/—/gi,"\u2014");m=m.replace(/‐/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(/ /gi," ");m=m.replace(/<blockquote([^>]+)>\n?<div[^>]+>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(z,y,B){var C;var A="";var x="";if(y.match(/data-author="([^"]+)"/)){A=WCF.String.unescapeHTML(RegExp.$1)}if(y.match(/cite="([^"]+)"/)){x=WCF.String.unescapeHTML(RegExp.$1)}if(x){C="[quote='"+A+"','"+x+"']"}else{if(A){C="[quote='"+A+"']"}else{C="[quote]"}}return C});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(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/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,"&");E=E.replace(/</g,"<");E=E.replace(/>/g,">");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(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/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="​"}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,"<").replace(/>/g,">");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]+)/)||r.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())){if(r.match(/^<([a-z]+).*<\/\1>/)){E+=r}else{E+=r+"<br />"}}else{E+="<p>"+r+"</p>"}}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(/^\[code[^\]]*\][\S\s]*\[\/code\]$/,"<pre>$&</pre>");E=E.replace(v,h)}}E=E.replace(/<p><blockquote/g,"<blockquote");E=E.replace(/<\/blockquote><\/p>/g,"</blockquote>");console.debug(E);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(){var a=this.$editor.find(".redactorQuoteEdit:not(.jsRedactorQuoteEdit)");if(a.length){a.each((function(e,d){var b=$(d);b.addClass("jsRedactorQuoteEdit").click($.proxy(this.wbbcode._observeQuotesClick,this));if($.browser.msie){var c=b.parent().parent();c.attr("contenteditable",false);c.children("div").attr("contenteditable",true);c.on("mscontrolselect",function(f){f.preventDefault()})}}).bind(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.wutil.saveSelection();return l},_buildQuoteHeader:function(b,c){var a="";if(!b&&c){b=c;c=""}if(b){if(c){a+='<a href="'+c+'">'}a+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(b)});if(c){a+="</a>"}}else{a="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return a},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_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"}console.debug(d);console.debug(c);console.debug(d[c]);console.debug("");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
(function (window, undefined) {"use strict";WCF.Tagging={};WCF.Tagging.TagList=WCF.EditableItemList.extend({_className:"wcf\\data\\tag\\TagAction",_maxLength:0,init:function(c,a,b){this._allowCustomInput=true;this._maxLength=b;this._super(c,a);this._data=[];this._search=new WCF.Tagging.TagSearch(this._searchInput,$.proxy(this.addItem,this));this._itemList.addClass("tagList");$(c).data("__api",this)},_keyDown:function(b){if(this._super(b)){if(b===null){return true}var a=b.which;if(a===8||a===27||a===13||a===46){return true}else{if(a>36&&a<41){return true}}if(this._searchInput.val().length>=this._maxLength){return false}return true}return false},_submit:function(){this._super();for(var b=0,a=this._data.length;b<a;b++){if(this._data[b]){$('<input type="hidden" name="tags[]" />').val(this._data[b]).appendTo(this._form)}}},addItem:function(b){if(!b.objectID&&b.label.length>this._maxLength){b.label=b.label.substr(0,this._maxLength)}if(WCF.inArray(b.label,this._data)){return true}var a=$('<li class="badge tag">'+WCF.String.escapeHTML(b.label)+"</li>").data("objectID",b.objectID).data("label",b.label).appendTo(this._itemList);a.click($.proxy(this._click,this));if(this._search){this._search.addExcludedSearchValue(b.label)}this._addItem(b.objectID,b.label);return true},_addItem:function(b,a){this._data.push(a)},clearList:function(){this._super();this._data=[]},getTags:function(){return this._data},_removeItem:function(d,a){for(var c=0,b=this._data.length;c<b;c++){if(this._data[c]===a){this._data.splice(c,1);return}}},load:function(a){if(a&&a.length){for(var c=0,b=a.length;c<b;c++){this.addItem({objectID:0,label:WCF.String.unescapeHTML(a[c])})}}}});WCF.Tagging.TagSearch=WCF.Search.Base.extend({_className:"wcf\\data\\tag\\TagAction",init:function(b,d,a,c){this._super(b,d,a,c,false)}}); })(this);
// WCF.User.js
-(function (window, undefined) {"use strict";WCF.User.Login=Class.extend({_loginSubmitButton:null,_password:null,_passwordContainer:null,_useCookies:null,_useCookiesContainer:null,init:function(b){this._loginSubmitButton=$("#loginSubmitButton");this._password=$("#password"),this._passwordContainer=this._password.parents("dl");this._useCookies=$("#useCookies");this._useCookiesContainer=this._useCookies.parents("dl");var a=$("#loginForm");a.find("input[name=action]").change($.proxy(this._change,this));if(b){WCF.User.QuickLogin.init()}},_change:function(a){if($(a.currentTarget).val()==="register"){this._setState(false,WCF.Language.get("wcf.user.button.register"))}else{this._setState(true,WCF.Language.get("wcf.user.button.login"))}},_setState:function(b,a){if(b){this._password.enable();this._passwordContainer.removeClass("disabled");this._useCookies.enable();this._useCookiesContainer.removeClass("disabled")}else{this._password.disable();this._passwordContainer.addClass("disabled");this._useCookies.disable();this._useCookiesContainer.addClass("disabled")}this._loginSubmitButton.val(a)}});WCF.User.Panel={};WCF.User.Panel.Abstract=Class.extend({_badge:null,_dropdown:null,_identifier:"",_loadData:true,_markAllAsReadLink:null,_options:{},_proxy:null,_triggerElement:null,init:function(d,b,a){this._dropdown=null;this._identifier=b;this._triggerElement=d;this._options=a;this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this)});this._triggerElement.click($.proxy(this.toggle,this));if(this._options.showAllLink){this._triggerElement.dblclick($.proxy(this._dblClick,this))}var c=this._triggerElement.find("span.badge");if(c.length){this._badge=c}},toggle:function(b){b.preventDefault();if(this._dropdown===null){this._dropdown=this._initDropdown()}if(this._dropdown.toggle()){if(!this._loadData){if(this._badge!==null){var a=parseInt(this._badge.text())||0;if(a&&!this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding").length){this._loadData=true}}}if(this._loadData){this._loadData=false;this._load()}}return false},_dblClick:function(a){a.preventDefault();window.location=this._options.showAllLink;return false},_initDropdown:function(){var a=WCF.Dropdown.Interactive.Handler.create(this._triggerElement,this._identifier,this._options);$('<li class="loading"><span class="icon icon24 fa-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(a.getItemList());return a},_load:function(){},_success:function(d){if(d.returnValues.template!==undefined){var e=this._dropdown.getItemList().empty();$(d.returnValues.template).appendTo(e);if(!e.children().length){$('<li class="noItems">'+this._options.noItems+"</li>").appendTo(e)}if(this._options.enableMarkAsRead){var b=this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding");if(this._markAllAsReadLink===null&&b.length&&this._options.markAllAsReadConfirmMessage){var c=this._markAllAsReadLink=$('<li class="interactiveDropdownItemMarkAllAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAllAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></li>').appendTo(this._dropdown.getLinkList());c.click((function(f){this._dropdown.close();WCF.System.Confirmation.show(this._options.markAllAsReadConfirmMessage,(function(g){if(g==="confirm"){this._markAllAsRead()}}).bind(this));return false}).bind(this))}b.each((function(g,i){var f=$(i).addClass("interactiveDropdownItemOutstandingIcon");var h=f.data("objectID");var j=$('<div class="interactiveDropdownItemMarkAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></div>').appendTo(f);j.click((function(k){this._markAsRead(k,h);return false}).bind(this))}).bind(this))}this._dropdown.getItemList().children().each(function(h,i){var g=$(i);var f=g.data("link");if(f){if($.browser.msie){g.click(function(j){if(j.target.tagName!=="A"){window.location=f;return false}})}else{g.addClass("interactiveDropdownItemShadow");$('<a href="'+f+'" class="interactiveDropdownItemShadowLink" />').appendTo(g)}if(g.data("linkReplaceAll")){g.find("> .box32 a:not(.userLink)").prop("href",f)}}});this._dropdown.rebuildScrollbar()}if(d.returnValues.totalCount!==undefined){this.updateBadge(d.returnValues.totalCount)}if(this._options.enableMarkAsRead){if(d.returnValues.markAsRead){var a=this._dropdown.getItemList().children("li[data-object-id="+d.returnValues.markAsRead+"]");if(a.length){a.removeClass("interactiveDropdownItemOutstanding").data("isRead",true);a.children(".interactiveDropdownItemMarkAsRead").remove()}}else{if(d.returnValues.markAllAsRead){this.resetItems();this.updateBadge(0)}}}},_markAsRead:function(a,b){},_markAllAsRead:function(){},updateBadge:function(a){a=parseInt(a)||0;if(a){if(this._badge===null){this._badge=$('<span class="badge badgeInverse" />').appendTo(this._triggerElement.children("a"))}this._badge.text(a)}else{if(this._badge!==null){this._badge.remove()}}if(this._options.enableMarkAsRead){if(!a&&this._markAllAsReadLink!==null){this._markAllAsReadLink.remove();this._markAllAsReadLink=null}}},resetItems:function(){this._dropdown.resetItems()}});WCF.User.Panel.Notification=WCF.User.Panel.Abstract.extend({_favico:null,init:function(b){b.enableMarkAsRead=true;this._super($("#userNotifications"),"userNotifications",b);try{this._favico=new Favico({animation:"none",type:"circle"});if(this._badge!==null){var a=parseInt(this._badge.text())||0;this._favico.badge(a)}}catch(c){console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: "+c.message)}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this))},_initDropdown:function(){var a=this._super();$('<li><a href="'+this._options.settingsLink+'" title="'+WCF.Language.get("wcf.user.panel.settings")+'" class="jsTooltip"><span class="icon icon16 fa-cog" /></a></li>').appendTo(a.getLinkList());return a},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"});this._proxy.sendRequest()},_markAsRead:function(a,b){this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[b]});this._proxy.sendRequest()},_markAllAsRead:function(a){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"});this._proxy.sendRequest()},resetItems:function(){this._super();if(this._markAllAsReadLink){this._markAllAsReadLink.remove();this._markAllAsReadLink=null}},updateBadge:function(a){a=parseInt(a)||0;if(this._favico!==null){this._favico.badge(a)}this._super(a)},updateUserNotificationCount:function(a){if(this._dropdown!==null){this._dropdown.resetItems()}this.updateBadge(a)}});WCF.User.QuickLogin={_dialog:null,_loginMessage:null,init:function(){$(".loginLink").click($.proxy(this._render,this));$("#loginForm input[name=url]").val(function(a,b){return window.location.protocol+"//"+window.location.host+b})},show:function(a){if(a){if(this._loginMessage===null){this._loginMessage=$('<p class="info" />').hide().prependTo($("#loginForm > form"))}this._loginMessage.show().text(a)}else{if(this._loginMessage!==null){this._loginMessage.hide()}}this._render()},_render:function(a){if(a!==undefined){a.preventDefault()}if(this._dialog===null){this._dialog=$("#loginForm").wcfDialog({title:WCF.Language.get("wcf.user.login")});this._dialog.find("#username").focus()}else{this._dialog.wcfDialog("open")}}};WCF.User.Profile={};WCF.User.Profile.ActivityPointList={_cache:{},_dialog:null,_didInit:false,_proxy:null,init:function(){if(this._didInit){return}this._cache={};this._dialog=null;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._init();WCF.DOMNodeInsertedHandler.addCallback("WCF.User.Profile.ActivityPointList",$.proxy(this._init,this));this._didInit=true},_init:function(){$(".activityPointsDisplay").removeClass("activityPointsDisplay").click($.proxy(this._click,this))},_click:function(b){b.preventDefault();var a=$(b.currentTarget).data("userID");if(this._cache[a]===undefined){this._proxy.setOption("data",{actionName:"getDetailedActivityPointList",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[a]});this._proxy.sendRequest()}else{this._show(a)}},_show:function(a){if(this._dialog===null){this._dialog=$("<div>"+this._cache[a]+"</div>").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})}else{this._dialog.html(this._cache[a]);this._dialog.wcfDialog("open")}},_success:function(b,c,a){this._cache[b.returnValues.userID]=b.returnValues.template;this._show(b.returnValues.userID)}};WCF.User.Profile.Follow=Class.extend({_button:null,_following:false,_proxy:null,_userID:0,init:function(a,b){this._following=b;this._userID=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._createButton();this._showButton()},_createButton:function(){this._button=$('<li id="followUser"><a href="#" class="button jsTooltip" title="'+WCF.Language.get("wcf.user.button."+(this._following?"un":"")+"follow")+'"><span class="icon icon16 icon-plus"></span> <span class="invisible">'+WCF.Language.get("wcf.user.button."+(this._following?"un":"")+"follow")+"</span></a></li>").prependTo($("#profileButtonContainer"));this._button.click($.proxy(this._execute,this))},_execute:function(b){b.preventDefault();var a=(this._following)?"unfollow":"follow";this._proxy.setOption("data",{actionName:a,className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}});this._proxy.sendRequest()},_showButton:function(){if(this._following){this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button.unfollow")).addClass("active").children(".icon").removeClass("icon-plus").addClass("icon-minus")}else{this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button.follow")).removeClass("active").children(".icon").removeClass("icon-minus").addClass("icon-plus")}},_success:function(b,d,a){this._following=b.returnValues.following;this._showButton();var c=new WCF.System.Notification();c.show()}});WCF.User.Profile.IgnoreUser=Class.extend({_button:null,_isIgnoredUser:false,_proxy:null,_userID:0,init:function(b,a){this._userID=b;this._isIgnoredUser=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._updateButton();this._button.click($.proxy(this._click,this))},_click:function(a){a.preventDefault();var b=(this._isIgnoredUser)?"unignore":"ignore";this._proxy.setOption("data",{actionName:b,className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{ignoreUserID:this._userID}}});this._proxy.sendRequest()},_success:function(b,d,a){this._isIgnoredUser=b.returnValues.isIgnoredUser;this._updateButton();var c=new WCF.System.Notification();c.show()},_updateButton:function(){if(this._button===null){this._button=$('<li id="ignoreUser"><a href="#" class="button jsTooltip" title="'+WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore")+'"><span class="icon icon16 icon-ban-circle"></span> <span class="invisible">'+WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore")+"</span></a></li>").prependTo($("#profileButtonContainer"))}this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore"));if(this._isIgnoredUser){this._button.find(".button").addClass("active").children(".icon").removeClass("icon-ban-circle").addClass("icon-circle-blank")}else{this._button.find(".button").removeClass("active").children(".icon").removeClass("icon-circle-blank").addClass("icon-ban-circle")}}});WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(a){this._profileContent=$("#profileContent");this._userID=a;var c=this._profileContent.data("active");var b=false;this._profileContent.find("div.tabMenuContent").each($.proxy(function(e,d){var f=$(d).wcfIdentify();if(c===f){this._hasContent[f]=true}else{this._hasContent[f]=false;b=true}},this));if(b){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this));this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(d,f){var e=$(f);if(e.hasClass("ui-state-active")){if(d){this._loadContent(null,{newPanel:$("#"+e.attr("aria-controls"))})}return false}},this))}},_loadContent:function(b,c){var d=$(c.newPanel);var a=d.attr("id");if(!this._hasContent[a]){this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:a,menuItem:d.data("menuItem"),userID:this._userID}}});this._proxy.sendRequest()}},_success:function(d,e,c){var b=d.returnValues.containerID;this._hasContent[b]=true;var a=this._profileContent.find("#"+b);$("<div>"+d.returnValues.template+"</div>").hide().appendTo(a);a.children("div").wcfBlindIn()}});WCF.User.Profile.Editor=Class.extend({_actionName:"",_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(a,b){this._actionName="";this._cachedTemplate="";this._tab=$("#about");this._userID=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initButtons();if(b){this._beginEdit()}},_initButtons:function(){var a=$("#profileButtonContainer");this._buttons={beginEdit:$('<li><a class="button"><span class="icon icon16 icon-pencil" /> <span>'+WCF.Language.get("wcf.user.editProfile")+"</span></a></li>").click($.proxy(this._beginEdit,this)).appendTo(a)}},_beginEdit:function(){this._actionName="beginEdit";this._buttons.beginEdit.hide();$("#profileContent").wcfTabs("select","about");this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]});this._proxy.sendRequest()},_save:function(){this._actionName="save";var b=/values\[([a-zA-Z0-9._-]+)\]/;var a={};this._tab.find("input, textarea, select").each(function(e,g){var d=$(g);var f=null;switch(d.getTagName()){case"input":var c=d.attr("type");if((c==="radio"||c==="checkbox")&&!d.prop("checked")){return}break;case"textarea":if(d.data("redactor")){f=d.redactor("wutil.getText")}break}var h=d.attr("name");if(b.test(h)){a[RegExp.$1]=(f===null)?d.val():f}});this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:a}});this._proxy.sendRequest()},_restore:function(){this._actionName="restore";this._buttons.beginEdit.show();this._destroyEditor();this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(b,c,a){switch(this._actionName){case"beginEdit":this._prepareEdit(b);break;case"save":if(b.returnValues.success){this._cachedTemplate=b.returnValues.template;this._restore()}else{this._prepareEdit(b,true)}break}},_prepareEdit:function(b,c){this._destroyEditor();var a=this;this._tab.html(function(e,d){if(c!==true){a._cachedTemplate=d}return b.returnValues.template});this._tab.find("input[type=text]").attr("autocomplete","off");this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this));this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this));this._tab.find("input").keyup(function(d){if(d.which===$.ui.keyCode.ENTER){a._save();d.preventDefault();return false}})},_destroyEditor:function(){this._tab.find("textarea").each(function(b,a){var c=$(a);if(c.data("redactor")){c.redactor("core.destroy")}})}});WCF.User.Registration={};WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(b,c,a){this._element=b;this._element.blur($.proxy(this._blur,this));this._confirmElement=c||null;if(this._confirmElement!==null){this._confirmElement.blur($.proxy(this._blurConfirm,this))}a=a||{};this._setOptions(a);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:false});this._setErrorMessages()},_setOptions:function(a){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(b){var a=this._element.val();if(!a){return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"))}if(this._confirmElement!==null){var c=this._confirmElement.val();if(c!=""&&a!=c){return this._showError(this._confirmElement,this._errorMessages.notEqual)}}if(!this._validateOptions()){return}this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()});this._proxy.sendRequest()},_getParameters:function(){return{}},_validateOptions:function(){return true},_blurConfirm:function(b){var a=this._confirmElement.val();if(!a){return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"))}this._blur(b)},_success:function(b,c,a){if(b.returnValues.isValid){this._showSuccess(this._element);if(this._confirmElement!==null&&this._confirmElement.val()){this._showSuccess(this._confirmElement)}}else{this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+b.returnValues.error))}},_showError:function(a,b){a.parent().parent().addClass("formError").removeClass("formSuccess");var c=a.parent().find("small.innerError");if(!c.length){c=$("<small />").addClass("innerError").insertAfter(a)}c.text(b)},_showSuccess:function(a){a.parent().parent().addClass("formSuccess").removeClass("formError");a.next("small.innerError").remove()}});WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(a){this._options=$.extend(true,{minlength:3,maxlength:25},a)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var a=this._element.val();if(a.length<this._options.minlength||a.length>this._options.maxlength){this._showError(this._element,WCF.Language.get("wcf.user.username.error.notValid"));return false}return true},_getParameters:function(){return{username:this._element.val()}}});WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}});WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}});WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput");this._username=$("#usernameInput");this._email.keyup($.proxy(this._checkEmail,this));this._username.keyup($.proxy(this._checkUsername,this));if($.browser.mozilla&&$.browser.touch){this._email.on("input",$.proxy(this._checkEmail,this));this._username.on("input",$.proxy(this._checkUsername,this))}this._checkEmail();this._checkUsername()},_checkEmail:function(){if(this._email.val()==""){this._username.enable();this._username.parents("dl:eq(0)").removeClass("disabled")}else{this._username.disable();this._username.parents("dl:eq(0)").addClass("disabled")}},_checkUsername:function(){if(this._username.val()==""){this._email.enable();this._email.parents("dl:eq(0)").removeClass("disabled")}else{this._email.disable();this._email.parents("dl:eq(0)").addClass("disabled")}}});WCF.Notification={};WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(".contentNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(a){if(a==="confirm"){new WCF.Action.Proxy({autoSend:true,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})}})});this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each((function(c,d){var a=$(d);if(!a.data("isRead")){a.find("a:not(.userLink)").prop("href",a.data("link"));var b=$('<a href="#" class="icon icon24 fa-check notificationItemMarkAsConfirmed jsTooltip" title="'+WCF.Language.get("wcf.user.notification.markAsConfirmed")+'" />').appendTo(a);b.click($.proxy(this._markAsConfirmed,this))}}).bind(this));WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(a){a.preventDefault();var b=$(a.currentTarget).parents(".notificationItem:eq(0)").data("objectID");this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[b]});this._proxy.sendRequest();return false},_success:function(c,d,b){var a=$(".userNotificationItemList > .notificationItem[data-object-id="+c.returnValues.markAsRead+"]");a.data("isRead",true);a.find(".newContentBadge").remove();a.find(".notificationItemMarkAsConfirmed").remove();a.removeClass("notificationUnconfirmed")}});WCF.Notification.UserPanel=WCF.UserPanel.extend({_favico:null,_proxy:null,_showAllLink:"",init:function(b){this._favico=null;try{this._favico=new Favico({animation:"none",type:"circle",})}catch(a){}this._noItems="wcf.user.notification.noMoreNotifications";this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._showAllLink=b;this._super("userNotifications");if(this._container.data("count")&&this._favico!==null){this._favico.badge(this._container.data("count"))}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this))},_addDefaultItems:function(a){this._addDivider(a);$('<li><a href="'+this._showAllLink+'">'+WCF.Language.get("wcf.user.notification.showAll")+"</a></li>").appendTo(a);this._addDivider(a);$('<li id="userNotificationsMarkAllAsConfirmed"><a>'+WCF.Language.get("wcf.user.notification.markAllAsConfirmed")+"</a></li>").click($.proxy(this._markAllAsConfirmed,this)).appendTo(a)},_getParameters:function(){return{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"}},_click:function(c){if(this._didLoad){var d=this._container.find(".badge");if(d.length&&parseInt(d.text())>0){var a=WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify());var b=a.children("li.notificationUnconfirmed").length;if(!b&&b!=d.text()&&!a.is(":visible")){this._resetList();this._super(c)}}}else{this._super(c)}},_after:function(b){var d=WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify()).children("li.jsNotificationItem");var a=null;d.each((function(g,h){var e=$(h);var i=e.data("isConfirmed");if(!$.browser.msie){e.addClass("notificationItemLink");$('<a href="'+(i?e.data("link"):e.data("confirmLink"))+'" />').appendTo(e)}if(!i){e.find("a:not(.userLink)").prop("href",e.data("confirmLink"));if(!$.browser.mobile){var f=$('<a href="#" class="icon icon24 fa-check green notificationItemMarkAsConfirmed jsTooltip" title="'+WCF.Language.get("wcf.user.notification.markAsConfirmed")+'" />').prependTo(e.find("> span.box24 > .framed"));f.click($.proxy(this._markAsConfirmed,this))}}if(!e.data("isConfirmed")){a=e}e.click(function(j){if(j.target.tagName!=="A"){window.location=e.data("link")}})}).bind(this));if(a!==null){if(a.next(".notificationItem").length){$('<li class="dropdownDivider" />').insertAfter(a)}}var c=this._container.find(".badge");if(!c.length){this._removeMarkAllAsConfirmed()}},_markAsConfirmed:function(a){a.preventDefault();var b=$(a.currentTarget).parents(".notificationItem:eq(0)").data("notificationID");this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[b]});this._proxy.sendRequest();return false},_markAllAsConfirmed:function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),$.proxy(function(a){if(a==="confirm"){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"});this._proxy.sendRequest()}},this))},_success:function(b,c,a){switch(b.actionName){case"markAsConfirmed":WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify()).children("li.jsNotificationItem").each(function(e,f){var d=$(f);if(d.data("notificationID")==b.returnValues.notificationID){d.data("isConfirmed",true);d.find(".notificationItemMarkAsConfirmed").remove();d.find(".newContentBadge").remove();d.removeClass("notificationUnconfirmed");return false}});this._updateBadge(b.returnValues.totalCount);break;case"markAllAsConfirmed":this._resetList();this._updateBadge(0);this._removeMarkAllAsConfirmed();break;case"getOutstandingNotifications":if(!b.returnValues||!b.returnValues.template){this._removeMarkAllAsConfirmed()}this._super(b,c,a);break}},_updateBadge:function(a){a=parseInt(a)||0;this._super(a);if(this._favico!==null){this._favico.badge(a)}if(a===0){this._removeMarkAllAsConfirmed()}},_resetList:function(){var a=WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify());a.children("li.jsNotificationItem").remove();$('<li class="jsDropdownPlaceholder"><span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").prependTo(a);a.children(".dropdownDivider + .dropdownDivider").remove();this._didLoad=false},_removeMarkAllAsConfirmed:function(){$("#userNotificationsMarkAllAsConfirmed").hide().prev(".dropdownDivider").hide()},updateUserNotificationCount:function(a){WCF.Dropdown.close("userNotifications");this._resetList();this._updateBadge(a);if(parseInt(a)>0){$("#userNotificationsMarkAllAsConfirmed").show().prev(".dropdownDivider").show()}}});WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(b){var a=$("#previewContainer");if(!a.length){a=$('<fieldset id="previewContainer"><legend>'+WCF.Language.get("wcf.global.preview")+"</legend><div></div></fieldset>").insertBefore($("#signatureContainer")).wcfFadeIn()}a.children("div").first().html(b.returnValues.message)}});WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:false,_loadButton:null,_proxy:null,_userID:0,init:function(b,a){this._container=$("#recentActivities");this._filteredByFollowedUsers=(a===true);this._userID=b;if(this._userID!==null&&!this._userID){console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.");return}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});if(this._container.children("li").length){this._loadButton=$('<li class="recentActivitiesMore"><button class="small">'+WCF.Language.get("wcf.user.recentActivity.more")+"</button></li>").appendTo(this._container);this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))}else{$('<li class="recentActivitiesMore"><small>'+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small></li>").appendTo(this._container)}if(WCF.User.userID){$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))}},_click:function(){this._loadButton.enable();var a={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};if(this._userID){a.userID=this._userID}else{if(this._filteredByFollowedUsers){a.filteredByFollowedUsers=1}}this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:a});this._proxy.sendRequest()},_switchContext:function(a){a.preventDefault();if(!$(a.currentTarget).hasClass("active")){new WCF.Action.Proxy({autoSend:true,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity";window.location.reload()}})}},_success:function(b,c,a){if(b.returnValues.template){$(b.returnValues.template).insertBefore(this._loadButton.parent());this._container.data("lastEventTime",b.returnValues.lastEventTime);this._container.data("lastEventID",b.returnValues.lastEventID);this._loadButton.enable()}else{$("<small>"+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small>").appendTo(this._loadButton.parent());this._loadButton.remove()}}});WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(a){this._container=$("#likeList");this._userID=a;if(!this._userID){console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.");return}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var b=$('<li class="likeListMore recentActivitiesMore"><button class="small">'+WCF.Language.get("wcf.like.likes.more")+"</button><small>"+WCF.Language.get("wcf.like.likes.noMoreEntries")+"</small></li>").appendTo(this._container);this._loadButton=b.children("button").click($.proxy(this._click,this));this._noMoreEntries=b.children("small").hide();if(this._container.find("> li").length==2){this._loadButton.hide();this._noMoreEntries.show()}$("#likeType .button").click($.proxy(this._clickLikeType,this));$("#likeValue .button").click($.proxy(this._clickLikeValue,this))},_clickLikeType:function(a){var b=$(a.currentTarget);if(this._likeType!=b.data("likeType")){this._likeType=b.data("likeType");$("#likeType .button").removeClass("active");b.addClass("active");this._reload()}},_clickLikeValue:function(a){var b=$(a.currentTarget);if(this._likeValue!=b.data("likeValue")){this._likeValue=b.data("likeValue");$("#likeValue .button").removeClass("active");b.addClass("active");$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(this._likeValue==-1?"dis":"")+"likesReceived"));$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(this._likeValue==-1?"dis":"")+"likesGiven"));this._reload()}},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove();this._container.data("lastLikeTime",0);this._click()},_click:function(){this._loadButton.enable();var a={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:a});this._proxy.sendRequest()},_success:function(b,c,a){if(b.returnValues.template){$(b.returnValues.template).insertBefore(this._loadButton.parent());this._container.data("lastLikeTime",b.returnValues.lastLikeTime);this._noMoreEntries.hide();this._loadButton.show().enable()}else{this._noMoreEntries.show();this._loadButton.hide()}}});WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink");this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false});WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a=$("#"+this._activeElementID);var c=a.data("userID");if(this._userProfiles[c]){this._insertContent(this._activeElementID,this._userProfiles[c],true)}else{this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[c]});var d=this._activeElementID;var b=this;this._proxy.setOption("success",function(f,g,e){b._userProfiles[c]=f.returnValues.template;b._insertContent(d,f.returnValues.template,true)});this._proxy.setOption("failure",function(f,e,h,g){b._userProfiles[c]=f.message;b._insertContent(d,f.message,true);return false});this._proxy.sendRequest()}},purge:function(a){delete this._userProfiles[a];this._data={}}});WCF.User.Action={};WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(b,a){if(!b.length){return}this._containerList=b;if(a){this._followButtonSelector=a}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._containerList.each($.proxy(function(d,c){$(c).find(this._followButtonSelector).click($.proxy(this._click,this))},this))},_click:function(b){b.preventDefault();var a=$(b.target);if(!a.is("a")){a=a.closest("a")}this._userID=a.data("objectID");this._proxy.setOption("data",{actionName:a.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}});this._proxy.sendRequest()},_success:function(c,e,b){this._containerList.each($.proxy(function(g,f){var h=$(f).find(this._followButtonSelector).get(0);if(h&&$(h).data("objectID")==this._userID){h=$(h);if(c.returnValues.following){h.data("tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("icon-plus").addClass("icon-minus")}else{h.data("tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("icon-minus").addClass("icon-plus")}h.data("following",c.returnValues.following);return false}},this));var d=new WCF.System.Notification();d.show();var a=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(f){f.purge(a._userID)})}});WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(a,b){if(!a.length){return}this._containerList=a;if(b){this._ignoreButtonSelector=b}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._containerList.each($.proxy(function(d,c){$(c).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this))},_click:function(b){b.preventDefault();var a=$(b.target);if(!a.is("a")){a=a.closest("a")}this._userID=a.data("objectID");this._proxy.setOption("data",{actionName:a.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{ignoreUserID:this._userID}}});this._proxy.sendRequest()},_success:function(c,e,b){this._containerList.each($.proxy(function(g,f){var h=$(f).find(this._ignoreButtonSelector).get(0);if(h&&$(h).data("objectID")==this._userID){h=$(h);if(c.returnValues.isIgnoredUser){h.data("tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("icon-ban-circle").addClass("icon-circle-blank")}else{h.data("tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("icon-circle-blank").addClass("icon-ban-circle")}h.data("ignored",c.returnValues.isIgnoredUser);return false}},this));var d=new WCF.System.Notification();d.show();var a=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(f){f.purge(a._userID)})}});WCF.User.Avatar={};WCF.User.Avatar.Crop=Class.extend({_cropX:0,_cropY:0,_dialog:null,_proxy:null,MAX_THUMBNAIL_SIZE:128,init:function(a){this._avatarID=a;if(this._dialog){this.destroy()}this._dialog=null;if(!this._proxy){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})}$(".userAvatarCrop").click($.proxy(this._showCropDialog,this))},destroy:function(){this._dialog.remove()},_crop:function(a){this._proxy.setOption("data",{actionName:"cropAvatar",className:"wcf\\data\\user\\avatar\\UserAvatarAction",objectIDs:[this._avatarID],parameters:{cropX:this._cropX,cropY:this._cropY}});this._proxy.sendRequest()},_getCropDialog:function(b){if(!this._dialog){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.avatar.type.custom.crop")})}this._dialog.html(b.returnValues.template);this._dialog.find('button[data-type="save"]').click($.proxy(this._crop,this));this._cropX=b.returnValues.cropX;this._cropY=b.returnValues.cropY;var a=$("#userAvatarCropSelection > img");$("#userAvatarCropSelection").css({height:a.height()+"px",width:a.width()+"px"});$("#userAvatarCropOverlaySelection").css({"background-image":"url("+a.attr("src")+")","background-position":-this._cropX+"px "+-this._cropY+"px",left:this._cropX+"px",top:this._cropY+"px"}).draggable({containment:"parent",drag:$.proxy(this._updateSelection,this),stop:$.proxy(this._updateSelection,this)});this._dialog.find('button[data-type="save"]').click($.proxy(this._save,this));this._dialog.wcfDialog("render")},_showCropDialog:function(){if(!this._dialog){this._proxy.setOption("data",{actionName:"getCropDialog",className:"wcf\\data\\user\\avatar\\UserAvatarAction",objectIDs:[this._avatarID]});this._proxy.sendRequest()}else{this._dialog.wcfDialog("open")}},_success:function(b,d,a){switch(b.actionName){case"getCropDialog":this._getCropDialog(b);break;case"cropAvatar":$("#avatarUpload > dt > img").replaceWith($('<img src="'+b.returnValues.url+'" alt="" class="userAvatarCrop jsTooltip" title="'+WCF.Language.get("wcf.user.avatar.type.custom.crop")+'" />').css({width:"96px",height:"96px"}).click($.proxy(this._showCropDialog,this)));WCF.DOMNodeInsertedHandler.execute();this._dialog.wcfDialog("close");var c=new WCF.System.Notification();c.show();break}},_updateSelection:function(a,b){this._cropX=b.position.left;this._cropY=b.position.top;$("#userAvatarCropOverlaySelection").css({"background-position":-b.position.left+"px "+-b.position.top+"px"})}});WCF.User.Avatar.Upload=WCF.Upload.extend({_avatarCrop:null,_userID:0,init:function(b,a){this._super($("#avatarUpload > dd > div"),undefined,"wcf\\data\\user\\avatar\\UserAvatarAction");this._userID=b||0;this._avatarCrop=a;$("#avatarForm input[type=radio]").change(function(){if($(this).val()=="custom"){$("#avatarUpload > dd > div").show()}else{$("#avatarUpload > dd > div").hide()}});if(!$("#avatarForm input[type=radio][value=custom]:checked").length){$("#avatarUpload > dd > div").hide()}},_initFile:function(a){return $("#avatarUpload > dt > img")},_success:function(c,a){if(a.returnValues.url){this._updateImage(a.returnValues.url,a.returnValues.canCrop);if(a.returnValues.canCrop){if(!this._avatarCrop){this._avatarCrop=new WCF.User.Avatar.Crop(a.returnValues.avatarID)}else{this._avatarCrop.init(a.returnValues.avatarID)}}else{if(this._avatarCrop){this._avatarCrop.destroy();this._avatarCrop=null}}$("#avatarUpload > dd > .innerError").remove();var b=new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success"));b.show()}else{if(a.returnValues.errorType){this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+a.returnValues.errorType))}}},_updateImage:function(b,a){$("#avatarUpload > dt > img").remove();var c=$('<img src="'+b+'" alt="" />').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});if(a){c.addClass("userAvatarCrop").addClass("jsTooltip");c.attr("title",WCF.Language.get("wcf.user.avatar.type.custom.crop"))}$("#avatarUpload > dt").prepend(c);WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var a=$("#avatarUpload > dd > .innerError");if(!a.length){a=$('<small class="innerError"></span>');$("#avatarUpload > dd").append(a)}return a},_getParameters:function(){return{userID:this._userID}},});WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(c,a,b){this._additionalParameters=b||{};this._cache={};this._className=c;this._dialog=null;this._dialogTitle=a;this._pageCount=0;this._pageNo=1;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1;this._showPage()},_showPage:function(b,c){if(c&&c.activePage){this._pageNo=c.activePage}if(this._pageCount!=0&&(this._pageNo<1||this._pageNo>this._pageCount)){console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount);return}if(this._cache[this._pageNo]){var a=false;if(this._dialog===null){this._dialog=$('<div id="userList'+this._className.hashCode()+'" />').hide().appendTo(document.body);a=true}this._dialog.empty();this._dialog.html(this._cache[this._pageNo]);if(this._pageCount>1){this._dialog.find(".jsPagination").wcfPages({activePage:this._pageNo,maxPage:this._pageCount}).on("wcfpagesswitched",$.proxy(this._showPage,this))}if(a){this._dialog.wcfDialog({title:this._dialogTitle})}else{this._dialog.wcfDialog("open").wcfDialog("render")}}else{this._additionalParameters.pageNo=this._pageNo;this._proxy.setOption("data",{actionName:"getGroupedUserList",className:this._className,interfaceName:"wcf\\data\\IGroupedUserListAction",parameters:this._additionalParameters});this._proxy.sendRequest()}},_success:function(b,c,a){if(b.returnValues.pageCount){this._pageCount=b.returnValues.pageCount}this._cache[this._pageNo]=b.returnValues.template;this._showPage()}});WCF.User.ObjectWatch={};WCF.User.ObjectWatch.Subscribe=Class.extend({_buttonSelector:".jsSubscribeButton",_buttons:{},_dialog:null,_notification:null,_reloadOnUnsubscribe:false,init:function(a){this._buttons={};this._notification=null;this._reloadOnUnsubscribe=(a===true);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(this._buttonSelector).each($.proxy(function(b,c){var e=$(c);var d=e.data("objectID");this._buttons[d]=e.click($.proxy(this._click,this))},this));WCF.System.Event.addListener("com.woltlab.wcf.objectWatch","update",$.proxy(this._updateSubscriptionStatus,this))},_click:function(a){a.preventDefault();var b=$(a.currentTarget);this._proxy.setOption("data",{actionName:"manageSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{objectID:b.data("objectID"),objectType:b.data("objectType")}});this._proxy.sendRequest()},_success:function(c,e,b){if(c.actionName==="manageSubscription"){if(this._dialog===null){this._dialog=$("<div>"+c.returnValues.template+"</div>").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})}else{this._dialog.html(c.returnValues.template);this._dialog.wcfDialog("open")}this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",c.returnValues.objectID).click($.proxy(this._save,this));var a=this._dialog.find("input[name=enableNotification]").disable();this._dialog.find("input[name=subscribe]").change(function(f){var g=$(f.currentTarget);if(g.val()==1){a.enable()}else{a.disable()}});var d=this._dialog.find("input[name=subscribe]:checked");if(d.length&&d.val()==1){a.enable()}}else{if(c.actionName==="saveSubscription"&&this._dialog.is(":visible")){this._dialog.wcfDialog("close");this._updateSubscriptionStatus({isSubscribed:c.returnValues.subscribe,objectID:c.returnValues.objectID});if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))}this._notification.show()}}},_save:function(b){var d=this._buttons[$(b.currentTarget).data("objectID")];var c=this._dialog.find("input[name=subscribe]:checked").val();var a=(this._dialog.find("input[name=enableNotification]").is(":checked"))?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:a,objectID:d.data("objectID"),objectType:d.data("objectType"),subscribe:c}});this._proxy.sendRequest()},_updateSubscriptionStatus:function(c){var b=$(this._buttonSelector+"[data-object-id="+c.objectID+"]");var a=b.children(".icon");if(c.isSubscribed){a.removeClass("icon-bookmark-empty").addClass("icon-bookmark");b.data("isSubscribed",true)}else{a.removeClass("icon-bookmark").addClass("icon-bookmark-empty");b.data("isSubscribed",false);if(this._reloadOnUnsubscribe){window.location.reload();return}}WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",c)}});WCF.User.InlineEditor=WCF.InlineEditor.extend({_additionalOptions:{},_dialog:null,_permissions:{},init:function(a){this._super(a);WCF.System.ObjectStore.add("WCF.User.InlineEditor",this)},_execute:function(b,d){if(!this._validate(b,d)){return false}var c={};var a=$("#"+b);if(this._additionalOptions[d]!==undefined){this._additionalOptions[d].callback(b)}else{switch(d){case"unban":case"enableAvatar":case"enableSignature":switch(d){case"unban":c.banned=0;break;case"enableAvatar":c.disableAvatar=0;break;case"enableSignature":c.disableSignature=0;break}this._proxy.setOption("data",{actionName:d,className:"wcf\\data\\user\\UserAction",objectIDs:[a.data("objectID")]});this._proxy.sendRequest();break;case"ban":case"disableAvatar":case"disableSignature":if(d=="ban"){c.banned=1}else{c[d]=1}this._showReasonDialog(a.data("objectID"),d);break;case"advanced":window.location=this._getTriggerElement(a).attr("href");break}}if($.getLength(c)){this._updateData.push({data:c,elementID:b,})}},_executeReasonAction:function(c,d,f){var b=this._dialog.data("optionName");this._dialog.find(".innerError").remove();var a="";if(!$("#"+b+"NeverExpires").is(":checked")){a=$("#"+b+"ExpiresDatePicker").val();if(!a){this._dialog.find("#"+b+"ExpiresSettings > dd > small").prepend($('<small class="innerError" />').text(WCF.Language.get("wcf.global.form.error.empty")));return}}var e={};e[b+"Reason"]=$("#"+b+"Reason").val();e[b+"Expires"]=a;this._proxy.setOption("data",{actionName:b,className:"wcf\\data\\user\\UserAction",objectIDs:[this._dialog.data("userID")],parameters:e});this._proxy.sendRequest()},_getPermission:function(a){if(this._permissions[a]){return this._permissions[a]}return 0},_getTriggerElement:function(a){return a.find(".jsUserInlineEditor")},_setOptions:function(){this._options=[{label:WCF.Language.get("wcf.user.ban"),optionName:"ban"},{label:WCF.Language.get("wcf.user.unban"),optionName:"unban"},{label:WCF.Language.get("wcf.user.disableAvatar"),optionName:"disableAvatar"},{label:WCF.Language.get("wcf.user.enableAvatar"),optionName:"enableAvatar"},{label:WCF.Language.get("wcf.user.disableSignature"),optionName:"disableSignature"},{label:WCF.Language.get("wcf.user.enableSignature"),optionName:"enableSignature"}];for(var a in this._additionalOptions){this._options.push({label:this._additionalOptions[a].label,optionName:a})}this._options.push({optionName:"divider"});this._options.push({label:WCF.Language.get("wcf.user.edit"),optionName:"advanced"})},_show:function(c){var a=$(c.currentTarget);var d=a.data("elementID");if(!this._dropdowns[d]){var b=a.next(".dropdownMenu");if(b){this._dropdowns[d]=b;WCF.Dropdown.initDropdown(this._getTriggerElement(this._elements[d]),true)}}return this._super(c)},_showReasonDialog:function(a,b){if(this._dialog){this._dialog.remove()}this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.append($('<fieldset><dl><dt><label for="'+b+'Reason">'+WCF.Language.get("wcf.global.reason")+'</label></dt><dd><textarea id="'+b+'Reason" cols="40" rows="3" />'+(WCF.Language.get("wcf.user."+b+".reason.description")!="wcf.user."+b+".reason.description"?"<small>"+WCF.Language.get("wcf.user."+b+".reason.description")+"</small>":"")+'</dd></dl><dl><dt></dt><dd><label for="'+b+'NeverExpires"><input type="checkbox" name="'+b+'NeverExpires" id="'+b+'NeverExpires" checked="checked" /> '+WCF.Language.get("wcf.user."+b+".neverExpires")+'</label></dd></dl><dl id="'+b+'ExpiresSettings" style="display: none;"><dt><label for="'+b+'Expires">'+WCF.Language.get("wcf.user."+b+".expires")+'</label></dt><dd><input type="date" name="'+b+'Expires" id="'+b+'Expires" class="medium" min="'+new Date(TIME_NOW*1000).toISOString()+'" data-ignore-timezone="true" /><small>'+WCF.Language.get("wcf.user."+b+".expires.description")+"</small></dd></dl></fieldset>"));this._dialog.append($('<div class="formSubmit"><button class="buttonPrimary" accesskey="s">'+WCF.Language.get("wcf.global.button.submit")+"</button></div>"));this._dialog.data("optionName",b).data("userID",a);this._dialog.find("#"+b+"NeverExpires").change(function(){$("#"+b+"ExpiresSettings").toggle()});this._dialog.find("button").click($.proxy(this._executeReasonAction,this));this._dialog.wcfDialog({title:WCF.Language.get("wcf.user."+b+".confirmMessage")})},_updateState:function(d){this._notification.show();for(var f=0,e=this._updateData.length;f<e;f++){var b=this._updateData[f];var a=$("#"+b.elementID);for(var c in b.data){a.data(c,b.data[c])}}if(d.actionName=="ban"||d.actionName=="disableAvatar"||d.actionName=="disableSignature"){this._dialog.wcfDialog("close")}if(d.actionName=="unban"){$(".userHeadline .jsUserBanned").remove()}},_validate:function(a,b){var c=$("#"+a);if(this._additionalOptions[b]!==undefined){return true}switch(b){case"ban":case"unban":if(!this._getPermission("canBanUser")){return false}if(b=="ban"){return !c.data("banned")}else{return c.data("banned")}break;case"disableAvatar":case"enableAvatar":if(!this._getPermission("canDisableAvatar")){return false}if(b=="disableAvatar"){return !c.data("disableAvatar")}else{return c.data("disableAvatar")}break;case"disableSignature":case"enableSignature":if(!this._getPermission("canDisableSignature")){return false}if(b=="disableSignature"){return !c.data("disableSignature")}else{return c.data("disableSignature")}break;case"advanced":return this._getPermission("canEditUser");break}return false},addOption:function(a,b,c){if(!$.isFunction(c)){console.debug("[WCF.User.InlineEditor] Missing callback")}if(this._additionalOptions[b]!==undefined){console.debug('[WCF.User.InlineEditor] Additional option with name "'+b+"' already exists")}this._additionalOptions[b]={callback:c,label:a};this._setOptions()},setPermission:function(a,b){this._permissions[a]=b},setPermissions:function(a){for(var b in a){this.setPermission(b,a[b])}}}); })(this);
+(function (window, undefined) {"use strict";WCF.User.Login=Class.extend({_loginSubmitButton:null,_password:null,_passwordContainer:null,_useCookies:null,_useCookiesContainer:null,init:function(b){this._loginSubmitButton=$("#loginSubmitButton");this._password=$("#password"),this._passwordContainer=this._password.parents("dl");this._useCookies=$("#useCookies");this._useCookiesContainer=this._useCookies.parents("dl");var a=$("#loginForm");a.find("input[name=action]").change($.proxy(this._change,this));if(b){WCF.User.QuickLogin.init()}},_change:function(a){if($(a.currentTarget).val()==="register"){this._setState(false,WCF.Language.get("wcf.user.button.register"))}else{this._setState(true,WCF.Language.get("wcf.user.button.login"))}},_setState:function(b,a){if(b){this._password.enable();this._passwordContainer.removeClass("disabled");this._useCookies.enable();this._useCookiesContainer.removeClass("disabled")}else{this._password.disable();this._passwordContainer.addClass("disabled");this._useCookies.disable();this._useCookiesContainer.addClass("disabled")}this._loginSubmitButton.val(a)}});WCF.User.Panel={};WCF.User.Panel.Abstract=Class.extend({_badge:null,_dropdown:null,_identifier:"",_loadData:true,_markAllAsReadLink:null,_options:{},_proxy:null,_triggerElement:null,init:function(d,b,a){this._dropdown=null;this._identifier=b;this._triggerElement=d;this._options=a;this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this)});this._triggerElement.click($.proxy(this.toggle,this));if(this._options.showAllLink){this._triggerElement.dblclick($.proxy(this._dblClick,this))}var c=this._triggerElement.find("span.badge");if(c.length){this._badge=c}},toggle:function(b){b.preventDefault();if(this._dropdown===null){this._dropdown=this._initDropdown()}if(this._dropdown.toggle()){if(!this._loadData){if(this._badge!==null){var a=parseInt(this._badge.text())||0;if(a&&!this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding").length){this._loadData=true}}}if(this._loadData){this._loadData=false;this._load()}}return false},_dblClick:function(a){a.preventDefault();window.location=this._options.showAllLink;return false},_initDropdown:function(){var a=WCF.Dropdown.Interactive.Handler.create(this._triggerElement,this._identifier,this._options);$('<li class="loading"><span class="icon icon24 fa-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(a.getItemList());return a},_load:function(){},_success:function(d){if(d.returnValues.template!==undefined){var e=this._dropdown.getItemList().empty();$(d.returnValues.template).appendTo(e);if(!e.children().length){$('<li class="noItems">'+this._options.noItems+"</li>").appendTo(e)}if(this._options.enableMarkAsRead){var b=this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding");if(this._markAllAsReadLink===null&&b.length&&this._options.markAllAsReadConfirmMessage){var c=this._markAllAsReadLink=$('<li class="interactiveDropdownItemMarkAllAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAllAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></li>').appendTo(this._dropdown.getLinkList());c.click((function(f){this._dropdown.close();WCF.System.Confirmation.show(this._options.markAllAsReadConfirmMessage,(function(g){if(g==="confirm"){this._markAllAsRead()}}).bind(this));return false}).bind(this))}b.each((function(g,i){var f=$(i).addClass("interactiveDropdownItemOutstandingIcon");var h=f.data("objectID");var j=$('<div class="interactiveDropdownItemMarkAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></div>').appendTo(f);j.click((function(k){this._markAsRead(k,h);return false}).bind(this))}).bind(this))}this._dropdown.getItemList().children().each(function(h,i){var g=$(i);var f=g.data("link");if(f){if($.browser.msie){g.click(function(j){if(j.target.tagName!=="A"){window.location=f;return false}})}else{g.addClass("interactiveDropdownItemShadow");$('<a href="'+f+'" class="interactiveDropdownItemShadowLink" />').appendTo(g)}if(g.data("linkReplaceAll")){g.find("> .box32 a:not(.userLink)").prop("href",f)}}});this._dropdown.rebuildScrollbar()}if(d.returnValues.totalCount!==undefined){this.updateBadge(d.returnValues.totalCount)}if(this._options.enableMarkAsRead){if(d.returnValues.markAsRead){var a=this._dropdown.getItemList().children("li[data-object-id="+d.returnValues.markAsRead+"]");if(a.length){a.removeClass("interactiveDropdownItemOutstanding").data("isRead",true);a.children(".interactiveDropdownItemMarkAsRead").remove()}}else{if(d.returnValues.markAllAsRead){this.resetItems();this.updateBadge(0)}}}},_markAsRead:function(a,b){},_markAllAsRead:function(){},updateBadge:function(a){a=parseInt(a)||0;if(a){if(this._badge===null){this._badge=$('<span class="badge badgeInverse" />').appendTo(this._triggerElement.children("a"))}this._badge.text(a)}else{if(this._badge!==null){this._badge.remove()}}if(this._options.enableMarkAsRead){if(!a&&this._markAllAsReadLink!==null){this._markAllAsReadLink.remove();this._markAllAsReadLink=null}}},resetItems:function(){this._dropdown.resetItems()}});WCF.User.Panel.Notification=WCF.User.Panel.Abstract.extend({_favico:null,init:function(b){b.enableMarkAsRead=true;this._super($("#userNotifications"),"userNotifications",b);try{this._favico=new Favico({animation:"none",type:"circle"});if(this._badge!==null){var a=parseInt(this._badge.text())||0;this._favico.badge(a)}}catch(c){console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: "+c.message)}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this))},_initDropdown:function(){var a=this._super();$('<li><a href="'+this._options.settingsLink+'" title="'+WCF.Language.get("wcf.user.panel.settings")+'" class="jsTooltip"><span class="icon icon16 fa-cog" /></a></li>').appendTo(a.getLinkList());return a},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"});this._proxy.sendRequest()},_markAsRead:function(a,b){this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[b]});this._proxy.sendRequest()},_markAllAsRead:function(a){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"});this._proxy.sendRequest()},resetItems:function(){this._super();if(this._markAllAsReadLink){this._markAllAsReadLink.remove();this._markAllAsReadLink=null}},updateBadge:function(a){a=parseInt(a)||0;if(this._favico!==null){this._favico.badge(a)}this._super(a)},updateUserNotificationCount:function(a){if(this._dropdown!==null){this._dropdown.resetItems()}this.updateBadge(a)}});WCF.User.QuickLogin={_dialog:null,_loginMessage:null,init:function(){$(".loginLink").click($.proxy(this._render,this));$("#loginForm input[name=url]").val(function(a,b){return window.location.protocol+"//"+window.location.host+b})},show:function(a){if(a){if(this._loginMessage===null){this._loginMessage=$('<p class="info" />').hide().prependTo($("#loginForm > form"))}this._loginMessage.show().text(a)}else{if(this._loginMessage!==null){this._loginMessage.hide()}}this._render()},_render:function(a){if(a!==undefined){a.preventDefault()}if(this._dialog===null){this._dialog=$("#loginForm").wcfDialog({title:WCF.Language.get("wcf.user.login")});this._dialog.find("#username").focus()}else{this._dialog.wcfDialog("open")}}};WCF.User.Profile={};WCF.User.Profile.ActivityPointList={_cache:{},_dialog:null,_didInit:false,_proxy:null,init:function(){if(this._didInit){return}this._cache={};this._dialog=null;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._init();WCF.DOMNodeInsertedHandler.addCallback("WCF.User.Profile.ActivityPointList",$.proxy(this._init,this));this._didInit=true},_init:function(){$(".activityPointsDisplay").removeClass("activityPointsDisplay").click($.proxy(this._click,this))},_click:function(b){b.preventDefault();var a=$(b.currentTarget).data("userID");if(this._cache[a]===undefined){this._proxy.setOption("data",{actionName:"getDetailedActivityPointList",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[a]});this._proxy.sendRequest()}else{this._show(a)}},_show:function(a){if(this._dialog===null){this._dialog=$("<div>"+this._cache[a]+"</div>").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})}else{this._dialog.html(this._cache[a]);this._dialog.wcfDialog("open")}},_success:function(b,c,a){this._cache[b.returnValues.userID]=b.returnValues.template;this._show(b.returnValues.userID)}};WCF.User.Profile.Follow=Class.extend({_button:null,_following:false,_proxy:null,_userID:0,init:function(a,b){this._following=b;this._userID=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._createButton();this._showButton()},_createButton:function(){this._button=$('<li id="followUser"><a href="#" class="button jsTooltip" title="'+WCF.Language.get("wcf.user.button."+(this._following?"un":"")+"follow")+'"><span class="icon icon16 icon-plus"></span> <span class="invisible">'+WCF.Language.get("wcf.user.button."+(this._following?"un":"")+"follow")+"</span></a></li>").prependTo($("#profileButtonContainer"));this._button.click($.proxy(this._execute,this))},_execute:function(b){b.preventDefault();var a=(this._following)?"unfollow":"follow";this._proxy.setOption("data",{actionName:a,className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}});this._proxy.sendRequest()},_showButton:function(){if(this._following){this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button.unfollow")).addClass("active").children(".icon").removeClass("icon-plus").addClass("icon-minus")}else{this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button.follow")).removeClass("active").children(".icon").removeClass("icon-minus").addClass("icon-plus")}},_success:function(b,d,a){this._following=b.returnValues.following;this._showButton();var c=new WCF.System.Notification();c.show()}});WCF.User.Profile.IgnoreUser=Class.extend({_button:null,_isIgnoredUser:false,_proxy:null,_userID:0,init:function(b,a){this._userID=b;this._isIgnoredUser=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._updateButton();this._button.click($.proxy(this._click,this))},_click:function(a){a.preventDefault();var b=(this._isIgnoredUser)?"unignore":"ignore";this._proxy.setOption("data",{actionName:b,className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{ignoreUserID:this._userID}}});this._proxy.sendRequest()},_success:function(b,d,a){this._isIgnoredUser=b.returnValues.isIgnoredUser;this._updateButton();var c=new WCF.System.Notification();c.show()},_updateButton:function(){if(this._button===null){this._button=$('<li id="ignoreUser"><a href="#" class="button jsTooltip" title="'+WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore")+'"><span class="icon icon16 icon-ban-circle"></span> <span class="invisible">'+WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore")+"</span></a></li>").prependTo($("#profileButtonContainer"))}this._button.find(".button").data("tooltip",WCF.Language.get("wcf.user.button."+(this._isIgnoredUser?"un":"")+"ignore"));if(this._isIgnoredUser){this._button.find(".button").addClass("active").children(".icon").removeClass("icon-ban-circle").addClass("icon-circle-blank")}else{this._button.find(".button").removeClass("active").children(".icon").removeClass("icon-circle-blank").addClass("icon-ban-circle")}}});WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(a){this._profileContent=$("#profileContent");this._userID=a;var c=this._profileContent.data("active");var b=false;this._profileContent.find("div.tabMenuContent").each($.proxy(function(e,d){var f=$(d).wcfIdentify();if(c===f){this._hasContent[f]=true}else{this._hasContent[f]=false;b=true}},this));if(b){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this));this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(d,f){var e=$(f);if(e.hasClass("ui-state-active")){if(d){this._loadContent(null,{newPanel:$("#"+e.attr("aria-controls"))})}return false}},this))}},_loadContent:function(b,c){var d=$(c.newPanel);var a=d.attr("id");if(!this._hasContent[a]){this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:a,menuItem:d.data("menuItem"),userID:this._userID}}});this._proxy.sendRequest()}},_success:function(d,e,c){var b=d.returnValues.containerID;this._hasContent[b]=true;var a=this._profileContent.find("#"+b);$("<div>"+d.returnValues.template+"</div>").hide().appendTo(a);a.children("div").wcfBlindIn()}});WCF.User.Profile.Editor=Class.extend({_actionName:"",_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(a,b){this._actionName="";this._cachedTemplate="";this._tab=$("#about");this._userID=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initButtons();if(b){this._beginEdit()}},_initButtons:function(){var a=$("#profileButtonContainer");this._buttons={beginEdit:$('<li><a class="button"><span class="icon icon16 icon-pencil" /> <span>'+WCF.Language.get("wcf.user.editProfile")+"</span></a></li>").click($.proxy(this._beginEdit,this)).appendTo(a)}},_beginEdit:function(){this._actionName="beginEdit";this._buttons.beginEdit.hide();$("#profileContent").wcfTabs("select","about");this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]});this._proxy.sendRequest()},_save:function(){this._actionName="save";var b=/values\[([a-zA-Z0-9._-]+)\]/;var a={};this._tab.find("input, textarea, select").each(function(e,g){var d=$(g);var f=null;switch(d.getTagName()){case"input":var c=d.attr("type");if((c==="radio"||c==="checkbox")&&!d.prop("checked")){return}break;case"textarea":if(d.data("redactor")){f=d.redactor("wutil.getText")}break}var h=d.attr("name");if(b.test(h)){a[RegExp.$1]=(f===null)?d.val():f}});this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:a}});this._proxy.sendRequest()},_restore:function(){this._actionName="restore";this._buttons.beginEdit.show();this._destroyEditor();this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(b,c,a){switch(this._actionName){case"beginEdit":this._prepareEdit(b);break;case"save":if(b.returnValues.success){this._cachedTemplate=b.returnValues.template;this._restore()}else{this._prepareEdit(b,true)}break}},_prepareEdit:function(b,c){this._destroyEditor();var a=this;this._tab.html(function(e,d){if(c!==true){a._cachedTemplate=d}return b.returnValues.template});this._tab.find("input[type=text]").attr("autocomplete","off");this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this));this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this));this._tab.find("input").keyup(function(d){if(d.which===$.ui.keyCode.ENTER){a._save();d.preventDefault();return false}})},_destroyEditor:function(){this._tab.find("textarea").each(function(b,a){var c=$(a);if(c.data("redactor")){c.redactor("core.destroy")}})}});WCF.User.Registration={};WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(b,c,a){this._element=b;this._element.blur($.proxy(this._blur,this));this._confirmElement=c||null;if(this._confirmElement!==null){this._confirmElement.blur($.proxy(this._blurConfirm,this))}a=a||{};this._setOptions(a);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:false});this._setErrorMessages()},_setOptions:function(a){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(b){var a=this._element.val();if(!a){return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"))}if(this._confirmElement!==null){var c=this._confirmElement.val();if(c!=""&&a!=c){return this._showError(this._confirmElement,this._errorMessages.notEqual)}}if(!this._validateOptions()){return}this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()});this._proxy.sendRequest()},_getParameters:function(){return{}},_validateOptions:function(){return true},_blurConfirm:function(b){var a=this._confirmElement.val();if(!a){return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"))}this._blur(b)},_success:function(b,c,a){if(b.returnValues.isValid){this._showSuccess(this._element);if(this._confirmElement!==null&&this._confirmElement.val()){this._showSuccess(this._confirmElement)}}else{this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+b.returnValues.error))}},_showError:function(a,b){a.parent().parent().addClass("formError").removeClass("formSuccess");var c=a.parent().find("small.innerError");if(!c.length){c=$("<small />").addClass("innerError").insertAfter(a)}c.text(b)},_showSuccess:function(a){a.parent().parent().addClass("formSuccess").removeClass("formError");a.next("small.innerError").remove()}});WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(a){this._options=$.extend(true,{minlength:3,maxlength:25},a)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var a=this._element.val();if(a.length<this._options.minlength||a.length>this._options.maxlength){this._showError(this._element,WCF.Language.get("wcf.user.username.error.notValid"));return false}return true},_getParameters:function(){return{username:this._element.val()}}});WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}});WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}});WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput");this._username=$("#usernameInput");this._email.keyup($.proxy(this._checkEmail,this));this._username.keyup($.proxy(this._checkUsername,this));if($.browser.mozilla&&$.browser.touch){this._email.on("input",$.proxy(this._checkEmail,this));this._username.on("input",$.proxy(this._checkUsername,this))}this._checkEmail();this._checkUsername()},_checkEmail:function(){if(this._email.val()==""){this._username.enable();this._username.parents("dl:eq(0)").removeClass("disabled")}else{this._username.disable();this._username.parents("dl:eq(0)").addClass("disabled")}},_checkUsername:function(){if(this._username.val()==""){this._email.enable();this._email.parents("dl:eq(0)").removeClass("disabled")}else{this._email.disable();this._email.parents("dl:eq(0)").addClass("disabled")}}});WCF.Notification={};WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(".contentNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(a){if(a==="confirm"){new WCF.Action.Proxy({autoSend:true,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})}})});this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each((function(c,d){var a=$(d);if(!a.data("isRead")){a.find("a:not(.userLink)").prop("href",a.data("link"));var b=$('<a href="#" class="icon icon24 fa-check notificationItemMarkAsConfirmed jsTooltip" title="'+WCF.Language.get("wcf.user.notification.markAsConfirmed")+'" />').appendTo(a);b.click($.proxy(this._markAsConfirmed,this))}}).bind(this));WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(a){a.preventDefault();var b=$(a.currentTarget).parents(".notificationItem:eq(0)").data("objectID");this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[b]});this._proxy.sendRequest();return false},_success:function(c,d,b){var a=$(".userNotificationItemList > .notificationItem[data-object-id="+c.returnValues.markAsRead+"]");a.data("isRead",true);a.find(".newContentBadge").remove();a.find(".notificationItemMarkAsConfirmed").remove();a.removeClass("notificationUnconfirmed")}});WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(b){var a=$("#previewContainer");if(!a.length){a=$('<fieldset id="previewContainer"><legend>'+WCF.Language.get("wcf.global.preview")+"</legend><div></div></fieldset>").insertBefore($("#signatureContainer")).wcfFadeIn()}a.children("div").first().html(b.returnValues.message)}});WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:false,_loadButton:null,_proxy:null,_userID:0,init:function(b,a){this._container=$("#recentActivities");this._filteredByFollowedUsers=(a===true);this._userID=b;if(this._userID!==null&&!this._userID){console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.");return}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});if(this._container.children("li").length){this._loadButton=$('<li class="recentActivitiesMore"><button class="small">'+WCF.Language.get("wcf.user.recentActivity.more")+"</button></li>").appendTo(this._container);this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))}else{$('<li class="recentActivitiesMore"><small>'+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small></li>").appendTo(this._container)}if(WCF.User.userID){$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))}},_click:function(){this._loadButton.enable();var a={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};if(this._userID){a.userID=this._userID}else{if(this._filteredByFollowedUsers){a.filteredByFollowedUsers=1}}this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:a});this._proxy.sendRequest()},_switchContext:function(a){a.preventDefault();if(!$(a.currentTarget).hasClass("active")){new WCF.Action.Proxy({autoSend:true,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity";window.location.reload()}})}},_success:function(b,c,a){if(b.returnValues.template){$(b.returnValues.template).insertBefore(this._loadButton.parent());this._container.data("lastEventTime",b.returnValues.lastEventTime);this._container.data("lastEventID",b.returnValues.lastEventID);this._loadButton.enable()}else{$("<small>"+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small>").appendTo(this._loadButton.parent());this._loadButton.remove()}}});WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(a){this._container=$("#likeList");this._userID=a;if(!this._userID){console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.");return}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var b=$('<li class="likeListMore recentActivitiesMore"><button class="small">'+WCF.Language.get("wcf.like.likes.more")+"</button><small>"+WCF.Language.get("wcf.like.likes.noMoreEntries")+"</small></li>").appendTo(this._container);this._loadButton=b.children("button").click($.proxy(this._click,this));this._noMoreEntries=b.children("small").hide();if(this._container.find("> li").length==2){this._loadButton.hide();this._noMoreEntries.show()}$("#likeType .button").click($.proxy(this._clickLikeType,this));$("#likeValue .button").click($.proxy(this._clickLikeValue,this))},_clickLikeType:function(a){var b=$(a.currentTarget);if(this._likeType!=b.data("likeType")){this._likeType=b.data("likeType");$("#likeType .button").removeClass("active");b.addClass("active");this._reload()}},_clickLikeValue:function(a){var b=$(a.currentTarget);if(this._likeValue!=b.data("likeValue")){this._likeValue=b.data("likeValue");$("#likeValue .button").removeClass("active");b.addClass("active");$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(this._likeValue==-1?"dis":"")+"likesReceived"));$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(this._likeValue==-1?"dis":"")+"likesGiven"));this._reload()}},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove();this._container.data("lastLikeTime",0);this._click()},_click:function(){this._loadButton.enable();var a={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:a});this._proxy.sendRequest()},_success:function(b,c,a){if(b.returnValues.template){$(b.returnValues.template).insertBefore(this._loadButton.parent());this._container.data("lastLikeTime",b.returnValues.lastLikeTime);this._noMoreEntries.hide();this._loadButton.show().enable()}else{this._noMoreEntries.show();this._loadButton.hide()}}});WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink");this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false});WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a=$("#"+this._activeElementID);var c=a.data("userID");if(this._userProfiles[c]){this._insertContent(this._activeElementID,this._userProfiles[c],true)}else{this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[c]});var d=this._activeElementID;var b=this;this._proxy.setOption("success",function(f,g,e){b._userProfiles[c]=f.returnValues.template;b._insertContent(d,f.returnValues.template,true)});this._proxy.setOption("failure",function(f,e,h,g){b._userProfiles[c]=f.message;b._insertContent(d,f.message,true);return false});this._proxy.sendRequest()}},purge:function(a){delete this._userProfiles[a];this._data={}}});WCF.User.Action={};WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(b,a){if(!b.length){return}this._containerList=b;if(a){this._followButtonSelector=a}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._containerList.each($.proxy(function(d,c){$(c).find(this._followButtonSelector).click($.proxy(this._click,this))},this))},_click:function(b){b.preventDefault();var a=$(b.target);if(!a.is("a")){a=a.closest("a")}this._userID=a.data("objectID");this._proxy.setOption("data",{actionName:a.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}});this._proxy.sendRequest()},_success:function(c,e,b){this._containerList.each($.proxy(function(g,f){var h=$(f).find(this._followButtonSelector).get(0);if(h&&$(h).data("objectID")==this._userID){h=$(h);if(c.returnValues.following){h.data("tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("icon-plus").addClass("icon-minus")}else{h.data("tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("icon-minus").addClass("icon-plus")}h.data("following",c.returnValues.following);return false}},this));var d=new WCF.System.Notification();d.show();var a=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(f){f.purge(a._userID)})}});WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(a,b){if(!a.length){return}this._containerList=a;if(b){this._ignoreButtonSelector=b}this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._containerList.each($.proxy(function(d,c){$(c).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this))},_click:function(b){b.preventDefault();var a=$(b.target);if(!a.is("a")){a=a.closest("a")}this._userID=a.data("objectID");this._proxy.setOption("data",{actionName:a.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{ignoreUserID:this._userID}}});this._proxy.sendRequest()},_success:function(c,e,b){this._containerList.each($.proxy(function(g,f){var h=$(f).find(this._ignoreButtonSelector).get(0);if(h&&$(h).data("objectID")==this._userID){h=$(h);if(c.returnValues.isIgnoredUser){h.data("tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("icon-ban-circle").addClass("icon-circle-blank")}else{h.data("tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("icon-circle-blank").addClass("icon-ban-circle")}h.data("ignored",c.returnValues.isIgnoredUser);return false}},this));var d=new WCF.System.Notification();d.show();var a=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(f){f.purge(a._userID)})}});WCF.User.Avatar={};WCF.User.Avatar.Crop=Class.extend({_cropX:0,_cropY:0,_dialog:null,_proxy:null,MAX_THUMBNAIL_SIZE:128,init:function(a){this._avatarID=a;if(this._dialog){this.destroy()}this._dialog=null;if(!this._proxy){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})}$(".userAvatarCrop").click($.proxy(this._showCropDialog,this))},destroy:function(){this._dialog.remove()},_crop:function(a){this._proxy.setOption("data",{actionName:"cropAvatar",className:"wcf\\data\\user\\avatar\\UserAvatarAction",objectIDs:[this._avatarID],parameters:{cropX:this._cropX,cropY:this._cropY}});this._proxy.sendRequest()},_getCropDialog:function(b){if(!this._dialog){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.avatar.type.custom.crop")})}this._dialog.html(b.returnValues.template);this._dialog.find('button[data-type="save"]').click($.proxy(this._crop,this));this._cropX=b.returnValues.cropX;this._cropY=b.returnValues.cropY;var a=$("#userAvatarCropSelection > img");$("#userAvatarCropSelection").css({height:a.height()+"px",width:a.width()+"px"});$("#userAvatarCropOverlaySelection").css({"background-image":"url("+a.attr("src")+")","background-position":-this._cropX+"px "+-this._cropY+"px",left:this._cropX+"px",top:this._cropY+"px"}).draggable({containment:"parent",drag:$.proxy(this._updateSelection,this),stop:$.proxy(this._updateSelection,this)});this._dialog.find('button[data-type="save"]').click($.proxy(this._save,this));this._dialog.wcfDialog("render")},_showCropDialog:function(){if(!this._dialog){this._proxy.setOption("data",{actionName:"getCropDialog",className:"wcf\\data\\user\\avatar\\UserAvatarAction",objectIDs:[this._avatarID]});this._proxy.sendRequest()}else{this._dialog.wcfDialog("open")}},_success:function(b,d,a){switch(b.actionName){case"getCropDialog":this._getCropDialog(b);break;case"cropAvatar":$("#avatarUpload > dt > img").replaceWith($('<img src="'+b.returnValues.url+'" alt="" class="userAvatarCrop jsTooltip" title="'+WCF.Language.get("wcf.user.avatar.type.custom.crop")+'" />').css({width:"96px",height:"96px"}).click($.proxy(this._showCropDialog,this)));WCF.DOMNodeInsertedHandler.execute();this._dialog.wcfDialog("close");var c=new WCF.System.Notification();c.show();break}},_updateSelection:function(a,b){this._cropX=b.position.left;this._cropY=b.position.top;$("#userAvatarCropOverlaySelection").css({"background-position":-b.position.left+"px "+-b.position.top+"px"})}});WCF.User.Avatar.Upload=WCF.Upload.extend({_avatarCrop:null,_userID:0,init:function(b,a){this._super($("#avatarUpload > dd > div"),undefined,"wcf\\data\\user\\avatar\\UserAvatarAction");this._userID=b||0;this._avatarCrop=a;$("#avatarForm input[type=radio]").change(function(){if($(this).val()=="custom"){$("#avatarUpload > dd > div").show()}else{$("#avatarUpload > dd > div").hide()}});if(!$("#avatarForm input[type=radio][value=custom]:checked").length){$("#avatarUpload > dd > div").hide()}},_initFile:function(a){return $("#avatarUpload > dt > img")},_success:function(c,a){if(a.returnValues.url){this._updateImage(a.returnValues.url,a.returnValues.canCrop);if(a.returnValues.canCrop){if(!this._avatarCrop){this._avatarCrop=new WCF.User.Avatar.Crop(a.returnValues.avatarID)}else{this._avatarCrop.init(a.returnValues.avatarID)}}else{if(this._avatarCrop){this._avatarCrop.destroy();this._avatarCrop=null}}$("#avatarUpload > dd > .innerError").remove();var b=new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success"));b.show()}else{if(a.returnValues.errorType){this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+a.returnValues.errorType))}}},_updateImage:function(b,a){$("#avatarUpload > dt > img").remove();var c=$('<img src="'+b+'" alt="" />').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});if(a){c.addClass("userAvatarCrop").addClass("jsTooltip");c.attr("title",WCF.Language.get("wcf.user.avatar.type.custom.crop"))}$("#avatarUpload > dt").prepend(c);WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var a=$("#avatarUpload > dd > .innerError");if(!a.length){a=$('<small class="innerError"></span>');$("#avatarUpload > dd").append(a)}return a},_getParameters:function(){return{userID:this._userID}},});WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(c,a,b){this._additionalParameters=b||{};this._cache={};this._className=c;this._dialog=null;this._dialogTitle=a;this._pageCount=0;this._pageNo=1;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1;this._showPage()},_showPage:function(b,c){if(c&&c.activePage){this._pageNo=c.activePage}if(this._pageCount!=0&&(this._pageNo<1||this._pageNo>this._pageCount)){console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount);return}if(this._cache[this._pageNo]){var a=false;if(this._dialog===null){this._dialog=$('<div id="userList'+this._className.hashCode()+'" />').hide().appendTo(document.body);a=true}this._dialog.empty();this._dialog.html(this._cache[this._pageNo]);if(this._pageCount>1){this._dialog.find(".jsPagination").wcfPages({activePage:this._pageNo,maxPage:this._pageCount}).on("wcfpagesswitched",$.proxy(this._showPage,this))}if(a){this._dialog.wcfDialog({title:this._dialogTitle})}else{this._dialog.wcfDialog("open").wcfDialog("render")}}else{this._additionalParameters.pageNo=this._pageNo;this._proxy.setOption("data",{actionName:"getGroupedUserList",className:this._className,interfaceName:"wcf\\data\\IGroupedUserListAction",parameters:this._additionalParameters});this._proxy.sendRequest()}},_success:function(b,c,a){if(b.returnValues.pageCount){this._pageCount=b.returnValues.pageCount}this._cache[this._pageNo]=b.returnValues.template;this._showPage()}});WCF.User.ObjectWatch={};WCF.User.ObjectWatch.Subscribe=Class.extend({_buttonSelector:".jsSubscribeButton",_buttons:{},_dialog:null,_notification:null,_reloadOnUnsubscribe:false,init:function(a){this._buttons={};this._notification=null;this._reloadOnUnsubscribe=(a===true);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(this._buttonSelector).each($.proxy(function(b,c){var e=$(c);var d=e.data("objectID");this._buttons[d]=e.click($.proxy(this._click,this))},this));WCF.System.Event.addListener("com.woltlab.wcf.objectWatch","update",$.proxy(this._updateSubscriptionStatus,this))},_click:function(a){a.preventDefault();var b=$(a.currentTarget);this._proxy.setOption("data",{actionName:"manageSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{objectID:b.data("objectID"),objectType:b.data("objectType")}});this._proxy.sendRequest()},_success:function(c,e,b){if(c.actionName==="manageSubscription"){if(this._dialog===null){this._dialog=$("<div>"+c.returnValues.template+"</div>").hide().appendTo(document.body);this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})}else{this._dialog.html(c.returnValues.template);this._dialog.wcfDialog("open")}this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",c.returnValues.objectID).click($.proxy(this._save,this));var a=this._dialog.find("input[name=enableNotification]").disable();this._dialog.find("input[name=subscribe]").change(function(f){var g=$(f.currentTarget);if(g.val()==1){a.enable()}else{a.disable()}});var d=this._dialog.find("input[name=subscribe]:checked");if(d.length&&d.val()==1){a.enable()}}else{if(c.actionName==="saveSubscription"&&this._dialog.is(":visible")){this._dialog.wcfDialog("close");this._updateSubscriptionStatus({isSubscribed:c.returnValues.subscribe,objectID:c.returnValues.objectID});if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))}this._notification.show()}}},_save:function(b){var d=this._buttons[$(b.currentTarget).data("objectID")];var c=this._dialog.find("input[name=subscribe]:checked").val();var a=(this._dialog.find("input[name=enableNotification]").is(":checked"))?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:a,objectID:d.data("objectID"),objectType:d.data("objectType"),subscribe:c}});this._proxy.sendRequest()},_updateSubscriptionStatus:function(c){var b=$(this._buttonSelector+"[data-object-id="+c.objectID+"]");var a=b.children(".icon");if(c.isSubscribed){a.removeClass("icon-bookmark-empty").addClass("icon-bookmark");b.data("isSubscribed",true)}else{a.removeClass("icon-bookmark").addClass("icon-bookmark-empty");b.data("isSubscribed",false);if(this._reloadOnUnsubscribe){window.location.reload();return}}WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",c)}});WCF.User.InlineEditor=WCF.InlineEditor.extend({_additionalOptions:{},_dialog:null,_permissions:{},init:function(a){this._super(a);WCF.System.ObjectStore.add("WCF.User.InlineEditor",this)},_execute:function(b,d){if(!this._validate(b,d)){return false}var c={};var a=$("#"+b);if(this._additionalOptions[d]!==undefined){this._additionalOptions[d].callback(b)}else{switch(d){case"unban":case"enableAvatar":case"enableSignature":switch(d){case"unban":c.banned=0;break;case"enableAvatar":c.disableAvatar=0;break;case"enableSignature":c.disableSignature=0;break}this._proxy.setOption("data",{actionName:d,className:"wcf\\data\\user\\UserAction",objectIDs:[a.data("objectID")]});this._proxy.sendRequest();break;case"ban":case"disableAvatar":case"disableSignature":if(d=="ban"){c.banned=1}else{c[d]=1}this._showReasonDialog(a.data("objectID"),d);break;case"advanced":window.location=this._getTriggerElement(a).attr("href");break}}if($.getLength(c)){this._updateData.push({data:c,elementID:b,})}},_executeReasonAction:function(c,d,f){var b=this._dialog.data("optionName");this._dialog.find(".innerError").remove();var a="";if(!$("#"+b+"NeverExpires").is(":checked")){a=$("#"+b+"ExpiresDatePicker").val();if(!a){this._dialog.find("#"+b+"ExpiresSettings > dd > small").prepend($('<small class="innerError" />').text(WCF.Language.get("wcf.global.form.error.empty")));return}}var e={};e[b+"Reason"]=$("#"+b+"Reason").val();e[b+"Expires"]=a;this._proxy.setOption("data",{actionName:b,className:"wcf\\data\\user\\UserAction",objectIDs:[this._dialog.data("userID")],parameters:e});this._proxy.sendRequest()},_getPermission:function(a){if(this._permissions[a]){return this._permissions[a]}return 0},_getTriggerElement:function(a){return a.find(".jsUserInlineEditor")},_setOptions:function(){this._options=[{label:WCF.Language.get("wcf.user.ban"),optionName:"ban"},{label:WCF.Language.get("wcf.user.unban"),optionName:"unban"},{label:WCF.Language.get("wcf.user.disableAvatar"),optionName:"disableAvatar"},{label:WCF.Language.get("wcf.user.enableAvatar"),optionName:"enableAvatar"},{label:WCF.Language.get("wcf.user.disableSignature"),optionName:"disableSignature"},{label:WCF.Language.get("wcf.user.enableSignature"),optionName:"enableSignature"}];for(var a in this._additionalOptions){this._options.push({label:this._additionalOptions[a].label,optionName:a})}this._options.push({optionName:"divider"});this._options.push({label:WCF.Language.get("wcf.user.edit"),optionName:"advanced"})},_show:function(c){var a=$(c.currentTarget);var d=a.data("elementID");if(!this._dropdowns[d]){var b=a.next(".dropdownMenu");if(b){this._dropdowns[d]=b;WCF.Dropdown.initDropdown(this._getTriggerElement(this._elements[d]),true)}}return this._super(c)},_showReasonDialog:function(a,b){if(this._dialog){this._dialog.remove()}this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.append($('<fieldset><dl><dt><label for="'+b+'Reason">'+WCF.Language.get("wcf.global.reason")+'</label></dt><dd><textarea id="'+b+'Reason" cols="40" rows="3" />'+(WCF.Language.get("wcf.user."+b+".reason.description")!="wcf.user."+b+".reason.description"?"<small>"+WCF.Language.get("wcf.user."+b+".reason.description")+"</small>":"")+'</dd></dl><dl><dt></dt><dd><label for="'+b+'NeverExpires"><input type="checkbox" name="'+b+'NeverExpires" id="'+b+'NeverExpires" checked="checked" /> '+WCF.Language.get("wcf.user."+b+".neverExpires")+'</label></dd></dl><dl id="'+b+'ExpiresSettings" style="display: none;"><dt><label for="'+b+'Expires">'+WCF.Language.get("wcf.user."+b+".expires")+'</label></dt><dd><input type="date" name="'+b+'Expires" id="'+b+'Expires" class="medium" min="'+new Date(TIME_NOW*1000).toISOString()+'" data-ignore-timezone="true" /><small>'+WCF.Language.get("wcf.user."+b+".expires.description")+"</small></dd></dl></fieldset>"));this._dialog.append($('<div class="formSubmit"><button class="buttonPrimary" accesskey="s">'+WCF.Language.get("wcf.global.button.submit")+"</button></div>"));this._dialog.data("optionName",b).data("userID",a);this._dialog.find("#"+b+"NeverExpires").change(function(){$("#"+b+"ExpiresSettings").toggle()});this._dialog.find("button").click($.proxy(this._executeReasonAction,this));this._dialog.wcfDialog({title:WCF.Language.get("wcf.user."+b+".confirmMessage")})},_updateState:function(d){this._notification.show();for(var f=0,e=this._updateData.length;f<e;f++){var b=this._updateData[f];var a=$("#"+b.elementID);for(var c in b.data){a.data(c,b.data[c])}}if(d.actionName=="ban"||d.actionName=="disableAvatar"||d.actionName=="disableSignature"){this._dialog.wcfDialog("close")}if(d.actionName=="unban"){$(".userHeadline .jsUserBanned").remove()}},_validate:function(a,b){var c=$("#"+a);if(this._additionalOptions[b]!==undefined){return true}switch(b){case"ban":case"unban":if(!this._getPermission("canBanUser")){return false}if(b=="ban"){return !c.data("banned")}else{return c.data("banned")}break;case"disableAvatar":case"enableAvatar":if(!this._getPermission("canDisableAvatar")){return false}if(b=="disableAvatar"){return !c.data("disableAvatar")}else{return c.data("disableAvatar")}break;case"disableSignature":case"enableSignature":if(!this._getPermission("canDisableSignature")){return false}if(b=="disableSignature"){return !c.data("disableSignature")}else{return c.data("disableSignature")}break;case"advanced":return this._getPermission("canEditUser");break}return false},addOption:function(a,b,c){if(!$.isFunction(c)){console.debug("[WCF.User.InlineEditor] Missing callback")}if(this._additionalOptions[b]!==undefined){console.debug('[WCF.User.InlineEditor] Additional option with name "'+b+"' already exists")}this._additionalOptions[b]={callback:c,label:a};this._setOptions()},setPermission:function(a,b){this._permissions[a]=b},setPermissions:function(a){for(var b in a){this.setPermission(b,a[b])}}}); })(this);
// WCF.Moderation.js
(function (window, undefined) {"use strict";WCF.Moderation={};WCF.Moderation.Management=Class.extend({_buttonSelector:"",_className:"",_confirmationTemplate:{},_dialog:null,_languageItem:"",_proxy:null,_queueID:0,_redirectURL:"",init:function(a,c,b){if(!this._buttonSelector){console.debug("[WCF.Moderation.Management] Missing button selector, aborting.");return}else{if(!this._className){console.debug("[WCF.Moderation.Management] Missing class name, aborting.");return}}this._dialog=null;this._queueID=a;this._redirectURL=c;this._languageItem=b;this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)});$(this._buttonSelector).click($.proxy(this._click,this));$("<a>"+WCF.Language.get("wcf.moderation.assignedUser.change")+"</a>").click($.proxy(this._clickAssignedUser,this)).insertAfter($("#moderationAssignedUserContainer > dd > span"))},_click:function(c){var b=$(c.currentTarget).wcfIdentify();var a="";if(this._confirmationTemplate[b]){a=this._confirmationTemplate[b]}WCF.System.Confirmation.show(WCF.Language.get(this._languageItem.replace(/{actionName}/,b)),$.proxy(function(e){if(e==="confirm"){var d={actionName:b,className:this._className,objectIDs:[this._queueID]};if(this._confirmationTemplate[b]){d.parameters={};a.find("input, textarea").each(function(g,i){var f=$(i);var h=f.val();if(f.getTagName()==="input"&&f.attr("type")==="checkbox"){if(!f.is(":checked")){h=null}}if(h!==null){d.parameters[f.attr("name")]=h}})}this._proxy.setOption("data",d);this._proxy.sendRequest();$(this._buttonSelector).disable()}},this),{},a)},_clickAssignedUser:function(){this._proxy.setOption("data",{actionName:"getAssignUserForm",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID]});this._proxy.sendRequest()},_success:function(d,f,c){switch(d.actionName){case"getAssignUserForm":if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.html(d.returnValues.template).wcfDialog({title:WCF.Language.get("wcf.moderation.assignedUser")})}else{this._dialog.html(d.returnValues.template).wcfDialog("open")}this._dialog.find("button[data-type=submit]").click($.proxy(this._assignUser,this));break;case"assignUser":var a=$("#moderationAssignedUserContainer > dd > span").empty();if(d.returnValues.userID){$('<a href="'+d.returnValues.link+'" data-user-id="'+d.returnValues.userID+'" class="userLink">'+WCF.String.escapeHTML(d.returnValues.username)+"</a>").appendTo(a)}else{a.append(d.returnValues.username)}a.append(" ");if(d.returnValues.newStatus){$("#moderationStatusContainer > dd").text(WCF.Language.get("wcf.moderation.status."+d.returnValues.newStatus))}this._dialog.wcfDialog("close");new WCF.System.Notification().show();break;default:var e=new WCF.System.Notification(WCF.Language.get("wcf.global.success"));var b=this;e.show(function(){window.location=b._redirectURL});break}},_failure:function(c,b,e,d){if(c.returnValues&&c.returnValues.fieldName&&c.returnValues.fieldName=="assignedUsername"){this._dialog.find("small.innerError").remove();var a="";switch(c.returnValues.errorType){case"empty":a=WCF.Language.get("wcf.global.form.error.empty");break;case"notAffected":a=WCF.Language.get("wcf.moderation.assignedUser.error.notAffected");break;default:a=WCF.Language.get("wcf.user.username.error."+c.returnValues.errorType,{username:this._dialog.find("#assignedUsername").val()});break}$('<small class="innerError">'+a+"</small>").insertAfter(this._dialog.find("#assignedUsername"));return false}return true},_assignUser:function(){var b=this._dialog.find("input[name=assignedUserID]:checked").val();var a="";if(b==-1){a=$.trim(this._dialog.find("#assignedUsername").val())}if(b==-1&&a.length==0){this._dialog.find("small.innerError").remove();$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(this._dialog.find("#assignedUsername"));return}this._proxy.setOption("data",{actionName:"assignUser",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID],parameters:{assignedUserID:b,assignedUsername:a}});this._proxy.sendRequest()}});WCF.Moderation.Queue={};WCF.Moderation.Queue.MarkAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(document).on("dblclick",".moderationList .new .columnAvatar",$.proxy(this._dblclick,this))},_dblclick:function(a){this._proxy.setOption("data",{actionName:"markAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[$(a.currentTarget).parents("tr:eq(0)").data("queueID")]});this._proxy.sendRequest()},_success:function(b,c,a){$(".moderationList .new").each(function(e,f){var d=$(f);if(WCF.inArray(d.data("queueID"),b.objectIDs)){d.removeClass("new");d.find(".columnAvatar").off("dblclick")}})}});WCF.Moderation.Queue.MarkAllAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(".markAllAsReadButton").click($.proxy(this._click,this))},_click:function(a){a.preventDefault();this._proxy.setOption("data",{actionName:"markAllAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"});this._proxy.sendRequest()},_success:function(c,d,b){var a=$(".moderationList");a.find(".new").removeClass("new");a.find(".columnAvatar").off("dblclick")}});WCF.Moderation.Activation={};WCF.Moderation.Activation.Management=WCF.Moderation.Management.extend({init:function(a,b){this._buttonSelector="#enableContent, #removeContent";this._className="wcf\\data\\moderation\\queue\\ModerationQueueActivationAction";this._super(a,b,"wcf.moderation.activation.{actionName}.confirmMessage")}});WCF.Moderation.Report={};WCF.Moderation.Report.Content=Class.extend({_buttons:{},_buttonSelector:"",_dialog:null,_notification:null,_objectID:0,_objectType:"",_proxy:null,init:function(a,b){this._objectType=a;this._buttonSelector=b;this._buttons={};this._notification=null;this._objectID=0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initButtons();WCF.DOMNodeInsertedHandler.addCallback("WCF.Moderation.Report"+this._objectType.hashCode(),$.proxy(this._initButtons,this))},_initButtons:function(){var a=this;$(this._buttonSelector).each(function(c,d){var e=$(d);var b=e.wcfIdentify();if(!a._buttons[b]){a._buttons[b]=e;e.click($.proxy(a._click,a))}})},_click:function(a){a.preventDefault();this._objectID=$(a.currentTarget).data("objectID");this._proxy.setOption("data",{actionName:"prepareReport",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{objectID:this._objectID,objectType:this._objectType}});this._proxy.sendRequest()},_success:function(b,c,a){if(b.returnValues.reported){if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.moderation.report.success"))}this._dialog.wcfDialog("close");this._notification.show()}else{if(b.returnValues.template){this._showDialog(b.returnValues.template);if(!b.returnValues.alreadyReported){this._dialog.find(".jsSubmitReport").click($.proxy(this._submit,this))}}}},_showDialog:function(a){if(this._dialog===null){this._dialog=$("#moderationReport");if(!this._dialog.length){this._dialog=$('<div id="moderationReport" />').hide().appendTo(document.body)}}this._dialog.html(a).wcfDialog({title:WCF.Language.get("wcf.moderation.report.reportContent")}).wcfDialog("render")},_submit:function(){var a=this._dialog.find(".jsReportMessage").val();if(a==""){this._dialog.find("fieldset > dl").addClass("formError");if(!this._dialog.find(".innerError").length){this._dialog.find(".jsReportMessage").after($('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>"))}return}this._proxy.setOption("data",{actionName:"report",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{message:a,objectID:this._objectID,objectType:this._objectType}});this._proxy.sendRequest()}});WCF.Moderation.Report.Management=WCF.Moderation.Management.extend({init:function(a,b){this._buttonSelector="#removeContent, #removeReport";this._className="wcf\\data\\moderation\\queue\\ModerationQueueReportAction";this._super(a,b,"wcf.moderation.report.{actionName}.confirmMessage");this._confirmationTemplate.removeContent=$('<fieldset><dl><dt><label for="message">'+WCF.Language.get("wcf.moderation.report.removeContent.reason")+'</label></dt><dd><textarea name="message" id="message" cols="40" rows="3" /></dd></dl></fieldset>')}});WCF.User.Panel.Moderation=WCF.User.Panel.Abstract.extend({init:function(a){a.enableMarkAsRead=true;this._super($("#outstandingModeration"),"outstandingModeration",a)},_initDropdown:function(){var a=this._super();$('<li><a href="'+this._options.deletedContentLink+'" title="'+this._options.deletedContent+'" class="jsTooltip"><span class="icon icon16 fa-trash-o" /></a></li>').appendTo(a.getLinkList());return a},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingQueues",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"});this._proxy.sendRequest()},_markAsRead:function(a,b){this._proxy.setOption("data",{actionName:"markAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[b]});this._proxy.sendRequest()},_markAllAsRead:function(a){this._proxy.setOption("data",{actionName:"markAllAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"});this._proxy.sendRequest()}}); })(this);