// 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(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){window.addEventListener("unload",(function(j){this.code.startSync();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()))}).bind(this));if($.browser.msie){this.$editor.addClass("msie")}this.$textarea[0].setAttribute("data-is-dirty",true);var i=$.trim(this.wutil.getOption("woltlab.originalValue"));if(i.length){this.wutil.replaceText(i);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 d=this.clean.onSync;this.clean.onSync=(function(i){i=i.replace(/\u200C/g,"__wcf_zwnj__");i=i.replace(/\u200D/g,"__wcf_zwj__");if(a===true){a=false}else{i=i.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).bind(this);if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var c=this.button.get("table");if(c.length){var h=c.data("dropdown");h.find(".redactor-dropdown-add_head").parent().remove();h.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(h.find(".redactor-dropdown-delete_table").parent());c.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_code_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertCode(null,true)},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+e,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+e,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var f=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var g=function(i){i.find("br").each(function(j,k){if(k.children.length){$(k).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");f.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wutil.fixDOM();this.wbbcode.fixBlockLevelElements();this.wutil.selectionEndOfEditor();this.wbbcode.observeQuotes();this.wbbcode.observeCodeListings();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");f.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wutil.fixDOM();g(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(i){if(i.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}setTimeout(this.wutil.saveSelection.bind(this),10)}).bind(this));var b=this.opts.verifiedTags.indexOf("ul");if(b>-1){this.opts.verifiedTags.splice(b,1)}WCF.System.Event.addListener("com.woltlab.wcf.redactor","observe_load_"+e,(function(i){this.wbbcode.observeCodeListings();this.wbbcode.observeQuotes()}).bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","fixFormatting_"+e,$.proxy(this.wbbcode.fixFormatting,this))},_tableButtonClick:function(c){var d=$(c.currentTarget);if(!d.hasClass("dropact")){return}var b=this.selection.getBlock()||this.selection.getCurrent();var e=d.data("dropdown");e.children("li").show();var f=e.find("> li > .redactor-dropdown-insert_table").parent();if(b.tagName=="TD"){f.hide()}else{f.nextAll().hide()}},insertSmiley:function(j,i,e){if(e){this.wbbcode.registerSmiley(j,i)}if(this.opts.visual){this.wutil.restoreSelection();var f=null;if(window.getSelection().rangeCount&&window.getSelection().getRangeAt(0).collapsed){f=window.getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.TEXT_NODE){f=f.parentElement}if(!this.utils.isRedactorParent(f)){f=null}}this.insert.html('<img src="'+i+'" class="smiley" alt="'+j+'" id="redactorSmiley">',false);var b=document.getElementById("redactorSmiley");b.removeAttribute("id");if(f!==null){var d=window.getSelection().getRangeAt(0).startContainer;if(d.nodeType===Node.TEXT_NODE){d=d.parentElement}if(f!==d){f.appendChild(b)}}var h=function(k){if(k===null){return false}if((k.nodeType===Node.ELEMENT_NODE&&k.nodeName==="SPAN")||k.nodeType===Node.TEXT_NODE){if(k.textContent==="\u00A0"){return true}}return false};var g=b.parentElement;if(!h(b.previousSibling)){var c=document.createTextNode("\u00A0");g.insertBefore(c,b)}if(!h(b.nextSibling)){var c=document.createTextNode("\u00A0");if(g.lastChild===b){g.appendChild(c)}else{g.insertBefore(c,b.nextSibling)}}this.wutil.saveSelection()}else{this.wutil.insertAtCaret(" "+j+" ")}},registerSmiley:function(b,c){if(__REDACTOR_SMILIES[b]){return false}__REDACTOR_SMILIES[b]=c;return true},convertFromHtml:function(n){var w=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:n});n=n.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");n=n.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");n=n.replace(/&#(8203|x200b);/g,"");n=n.replace(/™/gi,"\u2122");n=n.replace(/©/gi,"\u00a9");n=n.replace(/…/gi,"\u2026");n=n.replace(/—/gi,"\u2014");n=n.replace(/‐/gi,"\u2010");var s={};n=n.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(F,D,C,E,B){var J=D+" "+C;var G="";var H="";if(J.match(/data-highlighter="([a-zA-Z]+)"/)){G=RegExp.$1}if(J.match(/data-filename="([^"]+)"/)){H=$.trim(RegExp.$1)}var I=WCF.getUUID();s[I]={codeContent:B.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:H.replace(/['"]/g,""),highlighter:(G==="plain"?"":G),lineNumber:(E>1?E:0)};return"@@@"+I+"@@@"});n=n.replace(/\r?\n/g,"");n=n.replace(/<a[^>]*?><\/a>/g,"");n=n.replace(/<p><\/p><table/g,"<table");n=n.replace(/<\/table><p><\/p>/g,"</table>");for(var A in s){n=n.replace(new RegExp("<p></p>@@@"+A+"@@@<p></p>"),"@@@"+A+"@@@")}n=n.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>");n=n.replace(/<br( \/)?><\/p>/g,"</p>");var h=n.split(/(<\/?(?:div|p)>)/);var i="";var y="";for(var b=0;b<h.length;b++){var z=h[b];if(z=="<p>"||z=="<div>"){continue}else{if(z=="</p>"||z=="</div>"){y=$.trim(y);if(y!="@@@wcf_empty_line@@@"){y+="\n"}i+=y;y=""}else{if(b==0||b+1==h.length){i+=z}else{y+=z}}}}if(y){i+=y;y=""}n=i;n=n.replace(/@@@wcf_empty_line@@@/g,"\n");n=n.replace(/\n\n$/,"\n");n=n.replace(/<br>$/,"");n=n.replace(/<br>/g,"\n");n=n.replace(/<br>/g,"");n=n.replace(/ /gi," ");n=n.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(D,C,F){var G;var E="";var B="";if(C.match(/data-author="([^"]+)"/)){E=WCF.String.unescapeHTML(RegExp.$1)}if(C.match(/cite="([^"]+)"/)){B=WCF.String.unescapeHTML(RegExp.$1)}if(B){G="[quote='"+E+"','"+B+"']"}else{if(E){G="[quote='"+E+"']"}else{G="[quote]"}}return G});n=n.replace(/(?:\n*)<\/blockquote>\n?/gi,"\n[/quote]\n");n=n.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");n=n.replace(/<a[^>]+><\/a>/,"");n=n.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(D,B,C,E){if(C==E){return"[url]"+C+"[/url]"}return"[url='"+C+"']"+E+"[/url]"});n=n.replace(/<(?:b|strong)>/gi,function(){if(w.indexOf("b")===-1){w.push("b")}return"[b]"});n=n.replace(/<\/(?:b|strong)>/gi,"[/b]");n=n.replace(/<(?:i|em)>/gi,function(){if(w.indexOf("i")===-1){w.push("i")}return"[i]"});n=n.replace(/<\/(?:i|em)>/gi,"[/i]");n=n.replace(/<u>/gi,function(){if(w.indexOf("u")===-1){w.push("u")}return"[u]"});n=n.replace(/<\/u>/gi,"[/u]");n=n.replace(/<sub>/gi,function(){if(w.indexOf("sub")===-1){w.push("sub")}return"[sub]"});n=n.replace(/<\/sub>/gi,"[/sub]");n=n.replace(/<sup>/gi,function(){if(w.indexOf("sup")===-1){w.push("sup")}return"[sup]"});n=n.replace(/<\/sup>/gi,"[/sup]");n=n.replace(/<(?:s(trike)?|del)>/gi,function(){if(w.indexOf("s")===-1){w.push("s")}return"[s]"});n=n.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var f=n.split(/(<\/?span[^>]*>)/);var y=[];var p=[];var q="";var d={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var b=0;b<f.length;b++){var j=f[b];if(j=="</span>"){var e=p.pop();var i=e.start+y.pop()+e.end;if(y.length){y[y.length-1]+=i}else{q+=i}}else{if(j.match(/^<span/)){if(j.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var l=RegExp.$1;var v;var o;if(l.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var u=RegExp.$1;var c=RegExp.$2;var g=RegExp.$3;var r=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((g-g%16)/16)+""+"0123456789ABCDEF".charAt(g%16));v="[color=#"+r+"]";o="[/color=#"+r+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/(?:^|;\s*)color: ?([^;]+);?/i)){v="[color="+RegExp.$1+"]";o="[/color="+RegExp.$1+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){v="[size="+RegExp.$1+"]";o="[/size="+RegExp.$1+"]";if(w.indexOf("size")===-1){w.push("size")}}else{if(d[RegExp.$1]){v="[size="+d[RegExp.$1]+"]";o="[/size="+d[RegExp.$1]+"]";if(w.indexOf("size")===-1){w.push("size")}}else{v="";o=""}}}else{if(l.match(/font-family: ?([^;]+);?/)){v="[font='"+RegExp.$1.replace(/'/g,"")+"']";o="[/font='"+RegExp.$1.replace(/'/g,"")+"']";if(w.indexOf("font")===-1){w.push("font")}}else{v='<span style="'+l+'">';o="</span>"}}}}y[y.length]="";p[y.length]={start:v,end:o}}else{if(j.match(/^<span class="inlineCode">/)){y[y.length]="";p[y.length]={start:"[tt]",end:"[/tt]"}}else{y[y.length]="";p[y.length]={start:"",end:""}}}}else{if(y.length){y[y.length-1]+=j}else{q+=j}}}}n=q;n=n.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(C,B,E,D){if(w.indexOf("align")===-1){w.push("align")}return"[align="+E+"]"+$.trim(D)+"[/align="+E+"]\n"});if(w.length){var m=true;while(m){m=false;n=n.replace(new RegExp("\\[\\/((?:"+w.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){m=true;return"\n"})}n=n.replace(new RegExp("\\[\\/("+w.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}n=n.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 ");n=n.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 ");n=n.replace(/<img([^>]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi,function(E,H,J){var K=H+" "+J;var G;if(K.match(/data-attachment-id="(\d+)"/)){G=RegExp.$1}else{return E}var D="none";var C=null;if(K.match(/style="([^"]+)"/)){var F=RegExp.$1.split(";");for(var I=0;I<F.length;I++){var B=$.trim(F[I]);if(B.match(/^float: (left|right)$/)){D=RegExp.$1}else{if(B.match(/^width: (\d+)px$/)){C=RegExp.$1}}}if(C!==null){return"[attach="+G+","+D+","+C+"][/attach]"}else{if(D!=="none"){return"[attach="+G+","+D+"][/attach]"}}}return"[attach="+G+"][/attach]"});n=n.replace(/<img([^>]*)?src=(["'])([^"']+?)\2([^>]*)?>/gi,function(G,I,M,C,L){var J=I+" "+L;var E="";if(J.match(/style="([^"]+)"/)){E=RegExp.$1}var F="none";var D=0;var H=E.split(";");for(var K=0;K<H.length;K++){var B=H[K];if(B.match(/float: (left|right|none)/)){F=RegExp.$1}else{if(B.match(/width: (\d+)px/)){D=parseInt(RegExp.$1)}}}if(D){return"[img='"+C+"',"+F+","+D+"][/img]"}else{if(F!=="none"){return"[img='"+C+"',"+F+"][/img]"}}return"[img]"+C+"[/img]"});n=n.replace(/<li>/gi,"[*]");n=n.replace(/<\/li>/gi,"\n");n=n.replace(/<ul>/gi,"[list]");n=n.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");n=n.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");n=n.replace(/<\/(ul|ol)>/gi,"[/list]");n=n.replace(/\n?\[list\]/g,"\n[list]");n=n.replace(/\[\/list\]\n\[\*\]/g,"[/list][*]");n=n.replace(/\[\/list\]\n\[\/list\]/g,"[/list][/list]");n=n.replace(/<table[^>]*>/gi,"[table]\n");n=n.replace(/<\/table>\n?/gi,"[/table]\n");n=n.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(B,C){return $.trim(C)});n=n.replace(/<tr><\/tr>/gi,"");n=n.replace(/<tr>/gi,"[tr]\n");n=n.replace(/<\/tr>/gi,"[/tr]\n");n=n.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");n=n.replace(/(\t)*<td>(\t)*/gi,"[td]");n=n.replace(/(\t)*<\/td>/gi,"[/td]\n");var x={};n.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(B){var C=B.hashCode();x[C]=B.replace(/\$/g,"$$$$");return"@@"+C+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:n});n=n.replace(/<[^(<|>)]+>/g,"");if($.getLength(x)){for(var k in x){var t=new RegExp("@@"+k+"@@","g");data=data.replace(t,x[k])}}if($.getLength(s)){$.each(s,function(D,F){var C=0;if(F.highlighter){C++}if(F.lineNumber){C++}if(F.filename){C++}var B="";switch(C){case 1:if(F.highlighter){B=F.highlighter}else{if(F.filename){B="'"+F.filename+"'"}else{B=F.lineNumber}}break;case 2:if(F.lineNumber){B=F.lineNumber}if(F.highlighter){if(B.length){B+=","}B+=F.highlighter}if(F.filename){if(B.length){B+=","}B+="'"+F.filename+"'"}break;case 3:B=F.highlighter+","+F.lineNumber+",'"+F.filename+"'";break}var E="[code"+(B.length?"="+B:"")+"]"+F.codeContent+"[/code]\n";n=n.replace(new RegExp("@@@"+D+"@@@\n?","g"),E)})}n=n.replace(/</g,"<");n=n.replace(/>/g,">");n=n.replace(/&/g,"&");n=n.replace(/%28/g,"(");n=n.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:n});n=$.trim(n);if(n.length){n+="\n"}return n},convertToHtml:function(I){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:I});I=this.wutil.removeZeroWidthSpace(I);I=I.replace(/&/g,"&");I=I.replace(/</g,"<");I=I.replace(/>/g,">");var u=[];var o=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");I=I.replace(o,function(J){var K=J.hashCode();u.push({key:K,value:J.replace(/\$/g,"$$$$")});return"@@"+K+"@@"});I=I.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\1\]/gi,"[$1]");I=I.replace(/\[(\/(?:b|i|s|sub|sup|u))\]\[\1\]/gi,"[$1]");I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\/\1\]/gi,"");I=I.replace(/\[b\]([\s\S]*?)\[\/b]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<strong>","</strong>")}).bind(this));I=I.replace(/\[i\]([\s\S]*?)\[\/i]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<em>","</em>")}).bind(this));I=I.replace(/\[u\]([\s\S]*?)\[\/u]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<u>","</u>")}).bind(this));I=I.replace(/\[s\]([\s\S]*?)\[\/s]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<del>","</del>")}).bind(this));I=I.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sub>","</sub>")}).bind(this));I=I.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sup>","</sup>")}).bind(this));I=I.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(K,L,M){var J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+L+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(K,M,N,L){var J="float: "+N+"; width: "+L+"px;";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+M+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(J,K,L){return this.wbbcode._expandFormatting(L,'<span style="font-size: '+K+'pt">',"</span>")}).bind(this));I=I.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="color: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="font-family: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,(function(J,L,K){return this.wbbcode._expandFormatting(K,'<p style="text-align: '+L+'">',"</p>")}).bind(this));var s=I.indexOf("[list");if(s>0){var h=I.substr(0,s);h=h.replace(/\[\*\]/g,"");I=h+I.substr(s)}var x=I.lastIndexOf("[/list]");if(x===-1){I=I.replace(/\[\*\]/g,"");I=I.replace(/\[list[^\]]*\]/g,"")}else{var h=I.substr(x+7);h=h.replace(/\[\*\]/g,"");I=I.substr(0,x+7)+h}I=I.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(J,K){return"<li>"+$.trim(K)+"</li>"});I=I.replace(/\n*(\[list\]<\/li>)/g,"$1");I=I.replace(/\[list\]/gi,"<ul>");I=I.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');I=I.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');I=I.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');I=I.replace(/\[\/list\]/gi,"</ul>");I=I.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(J,K){return"[table]"+$.trim(K)+"[/table]"});I=I.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');I=I.replace(/\[\/table\](\n*)?/gi,function(J,K){if(K){if(K.match(/\n/g).length>2){K=K.replace(/^\n/,"")}return"</table>"+K}return"</table>"});I=I.replace(/\[tr\]\n*/gi,"<tr>");I=I.replace(/\[\/tr\]\n*/gi,"</tr>");I=I.replace(/\[td\]\n*/gi,"<td>");I=I.replace(/\[\/td\]\n*/gi,"</td>");I=I.replace(/<td>([\S\s]*?)<\/td>/gi,function(J,L){var K=$.trim(L);if(!K.length){K="​"}return"<td>"+K+"</td>"});var d=this.wutil.getOption("woltlab.attachmentUrl");var H=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(d){var F=this.wbbcode._getImageAttachments();I=I.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(J,K,L){K=parseInt(K);if(F[K]!==undefined){return'<img src="'+H.replace(/987654321/,K)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+K+'" />'}return J});I=I.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(K,L,M){L=parseInt(L);if(F[L]!==undefined){var J="";if(M==="left"||M==="right"){J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+H.replace(/987654321/,L)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+L+'"'+J+" />"}return K});I=I.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(K,M,N,L){M=parseInt(M);if(F[M]!==undefined){var J="width: "+L+"px; max-height: "+F[M].height+"px; max-width: "+F[M].width+"px;";if(N==="left"||N==="right"){J+="float: "+N+";";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+d.replace(/987654321/,M)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+M+'"'+J+" />"}return K})}for(var w in __REDACTOR_SMILIES){var k=w.replace(/</g,"<").replace(/>/g,">");var j=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(k)+"(?=\\s|<|$)","gi");I=I.replace(j,'$1<img src="'+__REDACTOR_SMILIES[w]+'" class="smiley" alt="'+k+'" />')}I=I.replace(/(javascript):/gi,"$1<span></span>:");I=I.replace(/(\r|\r\n)/g,"\n");var B=[];var E=[];var g=I.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var e=WCF.getUUID();while(true){var p=false;for(var b=0;b<g.length;b++){var D=g[b];if(D.toLowerCase()==="[/quote]"){p=true;var f="";var n=g.slice(0,b);var c=false;while(n.length){var C=n.pop();f=C+f;if(C.match(/^\[quote/i)){D=f+D;var m=WCF.getUUID();B.push({hashCode:m,content:D.replace(/\$/g,"$$$$")});E.push(m);D="@@"+m+"@@";c=true;break}}if(!c){n=g.slice(0,b);D=e}g=n.concat(D,g.slice(b+1));break}}if(!p){break}}I=g.join("");I=I.replace(new RegExp(e,"g"),"[/quote]");I=I.replace(/\n*$/,"");var y=[];I=I.replace(/(<li>[\s\S]*?<\/li>)/g,function(J){J=$.trim(J).replace(/\n/,"<br>");var K=WCF.getUUID();y.push({key:K,content:J});return K});var h=I.split("\n");I="";for(var b=0,l=h.length;b<l;b++){var t=$.trim(h[b]);if(t.match(/^<([a-z]+)/)||t.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())||RegExp.$1.toUpperCase()==="TABLE"){if(t.match(/^<([a-z]+).*<\/\1>/)){I+=t}else{I+=t+"<br />"}}else{I+="<p>"+t+"</p>"}}else{if(!t){t="<br>"}else{if(t.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){I+=t;continue}}}I+="<p>"+t+"</p>"}}I=I.replace(/<td>([\s\S]+?)<\/td>/g,function(J,K){K=K.replace(/<br(?: \/)?>(<[uo]l)/g,"$1");return"<td>"+K.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"});if(y.length){for(var b=y.length-1;b>=0;b--){I=I.replace(y[b].key,y[b].content)}}if(B.length){var G=function(J){return J.replace(/^['"]/,"").replace(/['"]$/,"")};var r=this;var q=function(J){return J.replace(/\[quote(=(['"]).+?\2)?\]([\S\s]*)\[\/quote\]/gi,function(N,L,M,P){var T="";var O="";if(L){L=L.substr(1);L=L.split(",");switch(L.length){case 1:T=L[0];break;case 2:T=L[0];O=L[1];break}T=WCF.String.escapeHTML(G($.trim(T)));O=WCF.String.escapeHTML(G($.trim(O)))}var U='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+O+'" data-author="'+T+'"><header contenteditable="false"><h3>'+r.wbbcode._buildQuoteHeader(T,O)+'</h3><a class="redactorQuoteEdit"></a></header>';P=$.trim(P);var K="";if(P.length){var S=P.split("\n");for(var R=0;R<S.length;R++){var Q=S[R];if(Q.length===0){Q=r.opts.invisibleSpace}else{if(Q.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){K+=Q;continue}}}K+="<div>"+Q+"</div>"}}else{K="<div>"+r.opts.invisibleSpace+"</div>"}U+=K;U+="</blockquote>";return U})};for(var b=B.length-1;b>=0;b--){var v=B[b];var z=new RegExp("@@"+v.hashCode+"@@","g");I=I.replace(z,q(v.content))}}I=I.replace(/<(?:div|p)><(blockquote|div)/g,"<$1");I=I.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>");if(u.length){for(var b=u.length-1;b>=0;b--){var A=u[b];var z=new RegExp("@@"+A.key+"@@","g");var i=A.value;i=i.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,(function(J,L){var K=L.split("\n");L="";for(var O=0,N=K.length;O<N;O++){var M=K[O];if(M.length){if(L.length){L+="</p><p>"}L+="[tt]"+M+"[/tt]"}else{if(O===0||(O+1)===N){continue}if(L.match(/\[\/tt\]$/)){L+="</p><p>"+this.opts.invisibleSpace+""}else{L+="</p><p><br>"}}}return L}).bind(this));i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,(function(M,U,O){var N="plain";var S=0;var Q="";if(U){U=U.substring(1);U=U.split(",");var P=function(W){return W.match(/^\d+$/)};var L=function(W){return(W.indexOf(".")!==-1)||(W.match(/^(["']).*\1$/))};var K=function(W){return(__REDACTOR_CODE_HIGHLIGHTERS[W]!==undefined)};var J=function(W){return W.replace(/^(["'])(.*)\1$/,"$2")};switch(U.length){case 1:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0}else{if(L(U[0])){Q=J(U[0])}else{if(K(U[0])){N=U[0]}}}break;case 2:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0;if(K(U[1])){N=U[1]}else{if(L(U[1])){Q=J(U[1])}}}else{if(K(U[0])){N=U[0]}if(L(U[1])){Q=J(U[1])}}break;case 3:if(K(U[0])){N=U[0]}if(P(U[1])){S=U[1]}if(L(U[2])){Q=J(U[2])}break}}O=O.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var V="";for(var T=0;T<O.length;T++){var R=O[T];if(!R.length){R=this.opts.invisibleSpace}V+="<li>"+R+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+N+'"'+(Q?' data-filename="'+WCF.String.escapeHTML(Q)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'</h3></div><ol start="'+(S>1?S:1)+'">'+V+"</ol></div></div>"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i<h;i++){var g=d[i];if(g.length===0){g=this.opts.invisibleSpace}if(e.length){e+="\n"}e+=c+g+f}return e},_pasteBeforeCallback:function(b){var c={1:24,2:22,3:18,4:14,5:12,6:10};b=b.replace(/<h([1-6])([^>]*)>/g,function(g,j,i){if(i&&i.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var d=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').appendTo(document.body);var f=parseInt(d[0].clientWidth);d.remove();var e=-1;var h=false;$.each(c,function(m,l){if(e===-1){e=m}else{if(Math.abs(f-l)<Math.abs(f-c[e])){e=m}}if(f==l){h=true}});if(!h){e=(e<6)?parseInt(e)+1:e}j=e}}return"[size="+c[j]+"]"});b=b.replace(/<\/h[1-6]>/g,"[/size]");if(/<p class="MsoNormal">/.test(b)){b=b.replace(/([^>\s])\n([^<\s])/g,"$1 $2")}b=b.replace(/<o:p> <\/o:p>/g,"<br>");b=b.replace(/<(article|header)[^>]+>/g,"<div>");b=b.replace(/<\/(article|header)>/g,"</div>");b=b.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");b=b.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:b});return b},_pasteCallback:function(b){b=b.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');b=b.replace(/\[\/size\]/g,"</span></p>");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i<f;i++){var h=d[i];if(!h.match(/^\s*background-color/)){g.push(h)}}return'style="'+g.join(";")+'"'});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:b});return b;b=b.replace(/<img([^>]+)>/g,function(c,d){c=c.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return c});return b},insertAttachment:function(f,d){f=parseInt(f);var b=this.wutil.getOption("woltlab.attachment"+(!d?"Thumbnail":"")+"Url");var e=this.wbbcode._getImageAttachments();if(b&&e[f]!==undefined){var c="";if(d){c=' style="width: '+e[f].width+"px; max-height: "+e[f].height+"px; max-width: "+e[f].width+'px;"'}this.wutil.insertDynamic('<img src="'+b.replace(/987654321/,f)+'" class="redactorEmbeddedAttachment'+(!d?" redactorDisableResize":"")+'" data-attachment-id="'+f+'"'+c+" />","[attach="+f+(d?",none,"+e[f].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+f+"][/attach]")}},removeAttachment:function(b){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(c,e){var d=$(e);if(d.data("attachmentID")==b){d.remove()}})},_getImageAttachments:function(){var c=this.wutil.getOption("woltlab.attachmentImages")||[];if(c.length){delete this.opts.attachmentImages;return c}var b={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),b);return b.imageAttachments},_keydownCallback:function(x){switch(x.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var p=this.selection.getCurrent();var n=this.selection.getParent();n=(n)?$(n):n;var j=(n)?n.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(x.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var h=false;if(j.length){var k=true;for(var b=0;b<j[0].children.length;b++){var w=j[0].children[b];if(w.tagName==="DIV"){if(w.textContent.replace(/\u200b/,"").length){k=false;break}}}if(k){h=true}else{var m=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;if(m.startOffset===0){var d=m.startContainer,o;while((d=d.parentNode)!==null){o=d.previousSibling;if(o!==null){if(o.nodeType===Node.ELEMENT_NODE&&o.nodeName==="HEADER"){h=true}break}}}}}else{var f=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var q=f.startContainer;if(q.nodeType===Node.TEXT_NODE){if(f.startOffset===0||(f.startOffset===1&&q.textContent==="\u200b")){if(!q.previousSibling){q=q.parentElement}}}if(q.nodeType===Node.ELEMENT_NODE){var i=q.previousSibling;if(i&&i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BLOCKQUOTE"){j=i;h=true}}}if(h){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(j[0]||j);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(p)){var v=p.nextElementSibling;if(v&&v.tagName==="BLOCKQUOTE"){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(v);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DOWN:var e=$(p);if(e.next("blockquote").length){this.caret.setStart(e.next().children("div:first"));x.cancel=true}else{if(n){if(n.next("blockquote").length){this.caret.setStart(n.next().children("div:first"));x.cancel=true}else{if(j.length){var s=e.closest("div",j[0]);if(!s.next().length){if(j.next().length){this.caret.setStart(j.next())}else{this.wutil.setCaretAfter(j)}x.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(j.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!n||!j.length){return}var s=$(p).closest("div",j[0]);var u=s.prev();if(u[0].tagName==="DIV"){return}else{if(u[0].tagName==="BLOCKQUOTE"){return}}var l=j.prev();if(l.length===0){this.wutil.setCaretBefore(j)}else{if(l[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(l.children("div:last"))}else{if($.trim(l.html())==""){l.html(this.opts.invisibleSpace)}this.caret.setEnd(l)}}x.cancel=true;break;case 83:if($.browser.mobile){return}var c=false;if(navigator.platform.match(/^Mac/)){if(x.event.ctrlKey&&x.event.altKey){c=true}}else{if(x.event.altKey&&!x.event.ctrlKey){c=true}}if(c){var g={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),g);if(g.cancel){x.cancel=true}}break}},_keyupCallback:function(d){switch(d.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(h,j){var i=$(j);if(!i.children("header").length){i.remove()}});break;case $.ui.keyCode.ENTER:for(var g=0,f=this.$editor[0].children.length;g<f;g++){var c=this.$editor[0].children[g];if(c.nodeType!==Node.ELEMENT_NODE||c.tagName!=="P"){continue}if(c.textContent.length>0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(e){var c=$(e.currentTarget).closest("header");var d=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(d);var b=c.offset();d.css({left:b.left+"px",top:(b.top+20)+"px"});$(".redactor-link-tooltip").remove();d.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(b,e){var c=$(e);var d=c.find(".redactorEditCodeBox");if(!d.length){d=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").insertAfter(c.find("> div > div > h3"))}d.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(c,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(b,d){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(d?"insert":"edit")),400);var c=this.modal.createActionButton(this.lang.get("save"));if(d){this.selection.save();c.click($.proxy(function(){var g=$("#redactorQuoteAuthor").val();var f=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();a=true;var e=this.selection.getHtml();if(this.utils.isEmpty(e)){e=""}var h=this.wbbcode.insertQuoteBBCode(g,f,e);if(h!==null){if(!e.length){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("<div>"+this.opts.invisibleSpace+"</div>")}this.caret.setStart(h.children("div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(b.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(b.attr("cite")));c.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();b.data("author",e);b.attr("data-author",e);b.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(b);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(c){var d=c.data("author");var b=c.attr("cite");if(b){b=WCF.String.escapeHTML(b)}c.find("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))}e=e.replace(/^<p>/,"").replace(/<\/p>$/,"");e=e.replace(/<blockquote/,'<blockquote id="'+o+'"');if(!window.getSelection().rangeCount){this.wutil.restoreSelection();if(!window.getSelection().rangeCount){this.$editor.focus();if(!window.getSelection().rangeCount){this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}}window.getSelection().getRangeAt(0).deleteContents();this.wutil.restoreSelection();var h=window.getSelection().getRangeAt(0);var b=h.startContainer;while(b){var f=b.parentNode;if(f===this.$editor[0]){break}b=f}if(b&&b.parentNode===this.$editor[0]){if(b.innerHTML.length){if(b.innerHTML==="\u200b"){this.caret.setEnd(b)}else{this.wutil.setCaretAfter(b)}}}this.insert.html(e,false);p=this.$editor.find("#"+o);if(p.length){var n=p.find("> div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="<br>")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+='<a href="'+d+'" tabindex="-1">'}b+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(c)});if(d){b+="</a>"}}else{b="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return b},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(d,f){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(f?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(f){this.selection.get();var c=this.selection.getText();this.selection.save();this.modal.show();var j=$("#redactorCodeBox").focus();j.val(c);b.click($.proxy(function(){var q=$("#redactorCodeBox");var n=$("#redactorCodeFilename");var s=$("#redactorCodeHighlighter");var t=$("#redactorCodeLineNumber");var p=q.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(p).length===0){if(!q.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(q)}return}var o=$.trim(n.val().replace(/['"]/g,""));var r="[code="+s.val()+","+t.val()+(o.length?",'"+o+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}r+=p;r+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var m=this.wbbcode.convertToHtml(r);this.buffer.set();this.insert.html(m,false);var q=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();q.attr("contenteditable","false");this.wutil.setCaretAfter(q[0]);this.modal.close()},this))}else{var h=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));h.click((function(){this.buffer.set();d.remove();this.modal.close()}).bind(this));this.modal.show();var j=$("#redactorCodeBox").focus();var i=$("#redactorCodeFilename");var g=$("#redactorCodeHighlighter");var k=$("#redactorCodeLineNumber");g.val(d.data("highlighter"));i.val(d.data("filename")||"");var e=d.find("> div > ol");k.val(parseInt(e.prop("start")));var l="";e.children("li").each(function(m,n){l+=$(n).text().replace(/^\u200b$/,"")+"\n"});j.val(l.replace(/^\n+/,"").replace(/\n+$/,""));b.click($.proxy(function(){var n=j.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(n).length===0){if(!j.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(j)}return}var r=g.val();d.data("highlighter",r);d.attr("data-highlighter",r);var o=__REDACTOR_CODE_HIGHLIGHTERS[r];var m=$.trim(i.val().replace(/['"]/g,""));if(m){o+=": "+WCF.String.escapeHTML(m);d.data("filename",m);d.attr("data-filename",m)}else{d.removeAttr("data-filename");d.removeData("filename")}d.data("highlighter",g.val());d.find("> div > div > h3").html(o);var p=d.find("> div > ol").empty();var s=parseInt(k.val());p.prop("start",(s>1?s:1));n=n.split("\n");var q="";for(var t=0;t<n.length;t++){q+="<li>"+WCF.String.escapeHTML(n[t])+"</li>"}p.append($(q));this.modal.close()},this))}},fixBlockLevelElements:function(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},fixFormatting:function(d){var b=function(f){f.style.removeProperty("text-align");for(var g=0;g<f.children.length;g++){b(f.children[g])}};for(var e=0;e<this.alignment.blocks.length;e++){var c=this.alignment.blocks[e];switch(c.tagName){case"BLOCKQUOTE":c.style.removeProperty("text-align");b(c.children[0]);break;case"DIV":if(/\bcodeBox\b/.test(c.className)){b(c)}break}}}}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode=function(){var a=false;return{init:function(){var e=this.$textarea.wcfIdentify();this.opts.initCallback=(function(){window.addEventListener("unload",(function(l){this.code.startSync();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()))}).bind(this));if($.browser.msie){this.$editor.addClass("msie")}this.$textarea[0].setAttribute("data-is-dirty",true);var j=$.trim(this.wutil.getOption("woltlab.originalValue"));if(j.length){this.wutil.replaceText(j);this.wutil.selectionEndOfEditor()}delete this.opts.woltlab.originalValue;$(document).trigger("resize");this.wutil.saveSelection();var k=this.$editor[0],i=this.$textarea[0];setTimeout(function(){if($.browser.iOS&&k.scrollHeight===0){if(document.activeElement===k||document.activeElement===i){document.activeElement.blur()}}},10)}).bind(this);this.opts.pasteBeforeCallback=$.proxy(this.wbbcode._pasteBeforeCallback,this);this.opts.pasteCallback=$.proxy(this.wbbcode._pasteCallback,this);var d=this.clean.onSync;this.clean.onSync=(function(i){i=i.replace(/\u200C/g,"__wcf_zwnj__");i=i.replace(/\u200D/g,"__wcf_zwj__");if(a===true){a=false}else{i=i.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>")}i=d.call(this,i);i=i.replace(/__wcf_zwnj__/g,"\u200C");return i.replace(/__wcf_zwj__/g,"\u200D")}).bind(this);if(this.wutil.getOption("woltlab.autosaveOnce")){this.wutil.saveTextToStorage();delete this.opts.woltlab.autosaveOnce}var c=this.button.get("table");if(c.length){var h=c.data("dropdown");h.find(".redactor-dropdown-add_head").parent().remove();h.find(".redactor-dropdown-delete_head").parent().remove();$('<li class="dropdownDivider" />').insertBefore(h.find(".redactor-dropdown-delete_table").parent());c.click($.proxy(this.wbbcode._tableButtonClick,this))}WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_quote_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertQuote()},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","insertBBCode_code_"+e,$.proxy(function(i){i.cancel=true;this.wbbcode._handleInsertCode(null,true)},this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+e,$.proxy(this.wbbcode._keydownCallback,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+e,$.proxy(this.wbbcode._keyupCallback,this));this.code.sync=function(){};var f=$(".redactor-toolbar-tooltip-html:not(.jsWbbcode)").addClass("jsWbbcode").text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));var g=function(i){i.find("br").each(function(j,k){if(k.children.length){$(k).empty()}})};this.code.toggle=(function(){if(this.opts.visual){this.code.startSync();this.code.showCode();this.$textarea.val(this.wbbcode.convertFromHtml(this.$textarea.val()));this.button.get("html").children("i").removeClass("fa-square-o").addClass("fa-square");f.text(WCF.Language.get("wcf.bbcode.button.toggleHTML"))}else{this.$textarea.val(this.wbbcode.convertToHtml(this.$textarea.val()));this.code.offset=this.$textarea.val().length;this.code.showVisual();this.wutil.fixDOM();this.wbbcode.fixBlockLevelElements();this.wutil.selectionEndOfEditor();this.wbbcode.observeQuotes();this.wbbcode.observeCodeListings();this.button.get("html").children("i").removeClass("fa-square").addClass("fa-square-o");f.text(WCF.Language.get("wcf.bbcode.button.toggleBBCode"));this.wutil.fixDOM();g(this.$editor);this.wutil.saveSelection()}}).bind(this);this.wutil.setOption("clickCallback",(function(i){if(i.target===this.$editor[0]){if(this.$editor[0].lastElementChild&&this.$editor[0].lastElementChild.tagName==="BLOCKQUOTE"){this.wutil.setCaretAfter($(this.$editor[0].lastElementChild))}}setTimeout(this.wutil.saveSelection.bind(this),10)}).bind(this));var b=this.opts.verifiedTags.indexOf("ul");if(b>-1){this.opts.verifiedTags.splice(b,1)}WCF.System.Event.addListener("com.woltlab.wcf.redactor","observe_load_"+e,(function(i){this.wbbcode.observeCodeListings();this.wbbcode.observeQuotes()}).bind(this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","fixFormatting_"+e,$.proxy(this.wbbcode.fixFormatting,this))},_tableButtonClick:function(c){var d=$(c.currentTarget);if(!d.hasClass("dropact")){return}var b=this.selection.getBlock()||this.selection.getCurrent();var e=d.data("dropdown");e.children("li").show();var f=e.find("> li > .redactor-dropdown-insert_table").parent();if(b.tagName=="TD"){f.hide()}else{f.nextAll().hide()}},insertSmiley:function(j,i,e){if(e){this.wbbcode.registerSmiley(j,i)}if(this.opts.visual){this.wutil.restoreSelection();var f=null;if(window.getSelection().rangeCount&&window.getSelection().getRangeAt(0).collapsed){f=window.getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.TEXT_NODE){f=f.parentElement}if(!this.utils.isRedactorParent(f)){f=null}}this.insert.html('<img src="'+i+'" class="smiley" alt="'+j+'" id="redactorSmiley">',false);var b=document.getElementById("redactorSmiley");b.removeAttribute("id");if(f!==null){var d=window.getSelection().getRangeAt(0).startContainer;if(d.nodeType===Node.TEXT_NODE){d=d.parentElement}if(f!==d){f.appendChild(b)}}var h=function(k){if(k===null){return false}if((k.nodeType===Node.ELEMENT_NODE&&k.nodeName==="SPAN")||k.nodeType===Node.TEXT_NODE){if(k.textContent==="\u00A0"){return true}}return false};var g=b.parentElement;if(!h(b.previousSibling)){var c=document.createTextNode("\u00A0");g.insertBefore(c,b)}if(!h(b.nextSibling)){var c=document.createTextNode("\u00A0");if(g.lastChild===b){g.appendChild(c)}else{g.insertBefore(c,b.nextSibling)}}this.wutil.saveSelection()}else{this.wutil.insertAtCaret(" "+j+" ")}},registerSmiley:function(b,c){if(__REDACTOR_SMILIES[b]){return false}__REDACTOR_SMILIES[b]=c;return true},convertFromHtml:function(n){var w=[];WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertFromHtml",{html:n});n=n.replace(/(<[^>]+?) data-redactor-tag="[^"]+"/g,"$1");n=n.replace(/(<[^>]+?) rel="[^"]+"/g,"$1");n=n.replace(/&#(8203|x200b);/g,"");n=n.replace(/™/gi,"\u2122");n=n.replace(/©/gi,"\u00a9");n=n.replace(/…/gi,"\u2026");n=n.replace(/—/gi,"\u2014");n=n.replace(/‐/gi,"\u2010");var s={};n=n.replace(/<div([^>]+?)class="codeBox[^"]+"([^>]*?)>\n*<div>[\s\S]+?<ol start="(\d+)">([\s\S]+?)<\/ol>\n*<\/div>\n*<\/div>/g,function(F,D,C,E,B){var J=D+" "+C;var G="";var H="";if(J.match(/data-highlighter="([a-zA-Z]+)"/)){G=RegExp.$1}if(J.match(/data-filename="([^"]+)"/)){H=$.trim(RegExp.$1)}var I=WCF.getUUID();s[I]={codeContent:B.replace(/<li>/g,"").replace(/<\/li>/g,"\n").replace(/\n$/,""),filename:H.replace(/['"]/g,""),highlighter:(G==="plain"?"":G),lineNumber:(E>1?E:0)};return"@@@"+I+"@@@"});n=n.replace(/\r?\n/g,"");n=n.replace(/<a[^>]*?><\/a>/g,"");n=n.replace(/<p><\/p><table/g,"<table");n=n.replace(/<\/table><p><\/p>/g,"</table>");for(var A in s){n=n.replace(new RegExp("<p></p>@@@"+A+"@@@<p></p>"),"@@@"+A+"@@@")}n=n.replace(/<p><\/p><p>(?!<br>)/g,"<p>@@@wcf_empty_line@@@</p><p>");n=n.replace(/<br( \/)?><\/p>/g,"</p>");var h=n.split(/(<\/?(?:div|p)>)/);var i="";var y="";for(var b=0;b<h.length;b++){var z=h[b];if(z=="<p>"||z=="<div>"){continue}else{if(z=="</p>"||z=="</div>"){y=$.trim(y);if(y!="@@@wcf_empty_line@@@"){y+="\n"}i+=y;y=""}else{if(b==0||b+1==h.length){i+=z}else{y+=z}}}}if(y){i+=y;y=""}n=i;n=n.replace(/@@@wcf_empty_line@@@/g,"\n");n=n.replace(/\n\n$/,"\n");n=n.replace(/<br>$/,"");n=n.replace(/<br>/g,"\n");n=n.replace(/<br>/g,"");n=n.replace(/ /gi," ");n=n.replace(/<blockquote([^>]+)>\n?<header[^>]*?>[\s\S]*?<\/header>/gi,function(D,C,F){var G;var E="";var B="";if(C.match(/data-author="([^"]+)"/)){E=WCF.String.unescapeHTML(RegExp.$1)}if(C.match(/cite="([^"]+)"/)){B=WCF.String.unescapeHTML(RegExp.$1)}if(B){G="[quote='"+E+"','"+B+"']"}else{if(E){G="[quote='"+E+"']"}else{G="[quote]"}}return G});n=n.replace(/(?:\n*)<\/blockquote>\n?/gi,"\n[/quote]\n");n=n.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");n=n.replace(/<a[^>]+><\/a>/,"");n=n.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(D,B,C,E){if(C==E){return"[url]"+C+"[/url]"}return"[url='"+C+"']"+E+"[/url]"});n=n.replace(/<(?:b|strong)>/gi,function(){if(w.indexOf("b")===-1){w.push("b")}return"[b]"});n=n.replace(/<\/(?:b|strong)>/gi,"[/b]");n=n.replace(/<(?:i|em)>/gi,function(){if(w.indexOf("i")===-1){w.push("i")}return"[i]"});n=n.replace(/<\/(?:i|em)>/gi,"[/i]");n=n.replace(/<u>/gi,function(){if(w.indexOf("u")===-1){w.push("u")}return"[u]"});n=n.replace(/<\/u>/gi,"[/u]");n=n.replace(/<sub>/gi,function(){if(w.indexOf("sub")===-1){w.push("sub")}return"[sub]"});n=n.replace(/<\/sub>/gi,"[/sub]");n=n.replace(/<sup>/gi,function(){if(w.indexOf("sup")===-1){w.push("sup")}return"[sup]"});n=n.replace(/<\/sup>/gi,"[/sup]");n=n.replace(/<(?:s(trike)?|del)>/gi,function(){if(w.indexOf("s")===-1){w.push("s")}return"[s]"});n=n.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");var f=n.split(/(<\/?span[^>]*>)/);var y=[];var p=[];var q="";var d={11:8,13:10,16:12,19:14,24:18,29:22,32:24,48:36};for(var b=0;b<f.length;b++){var j=f[b];if(j=="</span>"){var e=p.pop();var i=e.start+y.pop()+e.end;if(y.length){y[y.length-1]+=i}else{q+=i}}else{if(j.match(/^<span/)){if(j.match(/^<span(?:.*?)style="([^"]+)"(?:[^>]*?)>/)){var l=RegExp.$1;var v;var o;if(l.match(/(?:^|;\s*)color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?/i)){var u=RegExp.$1;var c=RegExp.$2;var g=RegExp.$3;var r=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((g-g%16)/16)+""+"0123456789ABCDEF".charAt(g%16));v="[color=#"+r+"]";o="[/color=#"+r+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/(?:^|;\s*)color: ?([^;]+);?/i)){v="[color="+RegExp.$1+"]";o="[/color="+RegExp.$1+"]";if(w.indexOf("color")===-1){w.push("color")}}else{if(l.match(/font-size: ?(\d+)(pt|px);?/i)){if(RegExp.$2=="pt"){v="[size="+RegExp.$1+"]";o="[/size="+RegExp.$1+"]";if(w.indexOf("size")===-1){w.push("size")}}else{if(d[RegExp.$1]){v="[size="+d[RegExp.$1]+"]";o="[/size="+d[RegExp.$1]+"]";if(w.indexOf("size")===-1){w.push("size")}}else{v="";o=""}}}else{if(l.match(/font-family: ?([^;]+);?/)){v="[font='"+RegExp.$1.replace(/'/g,"")+"']";o="[/font='"+RegExp.$1.replace(/'/g,"")+"']";if(w.indexOf("font")===-1){w.push("font")}}else{v='<span style="'+l+'">';o="</span>"}}}}y[y.length]="";p[y.length]={start:v,end:o}}else{if(j.match(/^<span class="inlineCode">/)){y[y.length]="";p[y.length]={start:"[tt]",end:"[/tt]"}}else{y[y.length]="";p[y.length]={start:"",end:""}}}}else{if(y.length){y[y.length-1]+=j}else{q+=j}}}}n=q;n=n.replace(/<(div|p) style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)\n/gi,function(C,B,E,D){if(w.indexOf("align")===-1){w.push("align")}return"[align="+E+"]"+$.trim(D)+"[/align="+E+"]\n"});if(w.length){var m=true;while(m){m=false;n=n.replace(new RegExp("\\[\\/((?:"+w.join("|")+")=[^\\]]+?)\\]\n\\[\\1\\]","gi"),function(){m=true;return"\n"})}n=n.replace(new RegExp("\\[\\/("+w.join("|")+")=[^\\]]+?\\]","gi"),"[/$1]")}n=n.replace(/ ?<img [^>]*?alt="([^"]+?)"[^>]*?class="smiley"[^>]*?> ?/gi," $1 ");n=n.replace(/ ?<img [^>]*?class="smiley"[^>]*?alt="([^"]+?)"[^>]*?> ?/gi," $1 ");n=n.replace(/<img([^>]*?)class="[^"]*redactorEmbeddedAttachment[^"]*"([^>]*?)>/gi,function(E,H,J){var K=H+" "+J;var G;if(K.match(/data-attachment-id="(\d+)"/)){G=RegExp.$1}else{return E}var D="none";var C=null;if(K.match(/style="([^"]+)"/)){var F=RegExp.$1.split(";");for(var I=0;I<F.length;I++){var B=$.trim(F[I]);if(B.match(/^float: (left|right)$/)){D=RegExp.$1}else{if(B.match(/^width: (\d+)px$/)){C=RegExp.$1}}}if(C!==null){return"[attach="+G+","+D+","+C+"][/attach]"}else{if(D!=="none"){return"[attach="+G+","+D+"][/attach]"}}}return"[attach="+G+"][/attach]"});n=n.replace(/<img([^>]*)?src=(["'])([^"']+?)\2([^>]*)?>/gi,function(G,I,M,C,L){var J=I+" "+L;var E="";if(J.match(/style="([^"]+)"/)){E=RegExp.$1}var F="none";var D=0;var H=E.split(";");for(var K=0;K<H.length;K++){var B=H[K];if(B.match(/float: (left|right|none)/)){F=RegExp.$1}else{if(B.match(/width: (\d+)px/)){D=parseInt(RegExp.$1)}}}if(D){return"[img='"+C+"',"+F+","+D+"][/img]"}else{if(F!=="none"){return"[img='"+C+"',"+F+"][/img]"}}return"[img]"+C+"[/img]"});n=n.replace(/<li>/gi,"[*]");n=n.replace(/<\/li>/gi,"\n");n=n.replace(/<ul>/gi,"[list]");n=n.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");n=n.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");n=n.replace(/<\/(ul|ol)>/gi,"[/list]");n=n.replace(/\n?\[list\]/g,"\n[list]");n=n.replace(/\[\/list\]\n\[\*\]/g,"[/list][*]");n=n.replace(/\[\/list\]\n\[\/list\]/g,"[/list][/list]");n=n.replace(/<table[^>]*>/gi,"[table]\n");n=n.replace(/<\/table>\n?/gi,"[/table]\n");n=n.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(B,C){return $.trim(C)});n=n.replace(/<tr><\/tr>/gi,"");n=n.replace(/<tr>/gi,"[tr]\n");n=n.replace(/<\/tr>/gi,"[/tr]\n");n=n.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");n=n.replace(/(\t)*<td>(\t)*/gi,"[td]");n=n.replace(/(\t)*<\/td>/gi,"[/td]\n");var x={};n.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(B){var C=B.hashCode();x[C]=B.replace(/\$/g,"$$$$");return"@@"+C+"@@"});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","convertFromHtml",{html:n});n=n.replace(/<[^(<|>)]+>/g,"");if($.getLength(x)){for(var k in x){var t=new RegExp("@@"+k+"@@","g");data=data.replace(t,x[k])}}if($.getLength(s)){$.each(s,function(D,F){var C=0;if(F.highlighter){C++}if(F.lineNumber){C++}if(F.filename){C++}var B="";switch(C){case 1:if(F.highlighter){B=F.highlighter}else{if(F.filename){B="'"+F.filename+"'"}else{B=F.lineNumber}}break;case 2:if(F.lineNumber){B=F.lineNumber}if(F.highlighter){if(B.length){B+=","}B+=F.highlighter}if(F.filename){if(B.length){B+=","}B+="'"+F.filename+"'"}break;case 3:B=F.highlighter+","+F.lineNumber+",'"+F.filename+"'";break}var E="[code"+(B.length?"="+B:"")+"]"+F.codeContent+"[/code]\n";n=n.replace(new RegExp("@@@"+D+"@@@\n?","g"),E)})}n=n.replace(/</g,"<");n=n.replace(/>/g,">");n=n.replace(/&/g,"&");n=n.replace(/%28/g,"(");n=n.replace(/%29/g,")");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertFromHtml",{html:n});n=$.trim(n);if(n.length){n+="\n"}return n},convertToHtml:function(I){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforeConvertToHtml",{data:I});I=this.wutil.removeZeroWidthSpace(I);I=I.replace(/&/g,"&");I=I.replace(/</g,"<");I=I.replace(/>/g,">");var u=[];var o=new RegExp("\\[("+__REDACTOR_SOURCE_BBCODES.join("|")+")([\\S\\s]+?)\\[\\/\\1\\]","gi");I=I.replace(o,function(J){var K=J.hashCode();u.push({key:K,value:J.replace(/\$/g,"$$$$")});return"@@"+K+"@@"});I=I.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\='([^'"]+)']([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[url\=([^'"\]]+)]([\s\S]+?)\[\/url]/gi,'<a href="$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>'+this.opts.invisibleSpace);I=I.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>'+this.opts.invisibleSpace);I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\1\]/gi,"[$1]");I=I.replace(/\[(\/(?:b|i|s|sub|sup|u))\]\[\1\]/gi,"[$1]");I=I.replace(/\[(b|i|s|sub|sup|u)\]\[\/\1\]/gi,"");I=I.replace(/\[b\]([\s\S]*?)\[\/b]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<strong>","</strong>")}).bind(this));I=I.replace(/\[i\]([\s\S]*?)\[\/i]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<em>","</em>")}).bind(this));I=I.replace(/\[u\]([\s\S]*?)\[\/u]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<u>","</u>")}).bind(this));I=I.replace(/\[s\]([\s\S]*?)\[\/s]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<del>","</del>")}).bind(this));I=I.replace(/\[sub\]([\s\S]*?)\[\/sub]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sub>","</sub>")}).bind(this));I=I.replace(/\[sup\]([\s\S]*?)\[\/sup]/gi,(function(J,K){return this.wbbcode._expandFormatting(K,"<sup>","</sup>")}).bind(this));I=I.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,function(K,L,M){var J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+L+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?,'?(left|right|none)'?,'?(\d+)'?\]\[\/img\]/gi,function(K,M,N,L){var J="float: "+N+"; width: "+L+"px;";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}return'<img src="'+M+'" style="'+J+'" />'});I=I.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');I=I.replace(/\[size=(\d+)\]([\s\S]*?)\[\/size\]/gi,(function(J,K,L){return this.wbbcode._expandFormatting(L,'<span style="font-size: '+K+'pt">',"</span>")}).bind(this));I=I.replace(/\[color=([#a-z0-9]*?)\]([\s\S]*?)\[\/color\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="color: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[font='?([a-z,\- ]*?)'?\]([\s\S]*?)\[\/font\]/gi,(function(K,J,L){return this.wbbcode._expandFormatting(L,'<span style="font-family: '+J+'">',"</span>")}).bind(this));I=I.replace(/\[align=(left|right|center|justify)\]([\s\S]*?)\[\/align\]/gi,(function(J,L,K){return this.wbbcode._expandFormatting(K,'<p style="text-align: '+L+'">',"</p>")}).bind(this));var s=I.indexOf("[list");if(s>0){var h=I.substr(0,s);h=h.replace(/\[\*\]/g,"");I=h+I.substr(s)}var x=I.lastIndexOf("[/list]");if(x===-1){I=I.replace(/\[\*\]/g,"");I=I.replace(/\[list[^\]]*\]/g,"")}else{var h=I.substr(x+7);h=h.replace(/\[\*\]/g,"");I=I.substr(0,x+7)+h}I=I.replace(/\[\*\]([\s\S]*?)(?=\[\*\]|\[\/list\])/gi,function(J,K){return"<li>"+$.trim(K)+"</li>"});I=I.replace(/\n*(\[list\]<\/li>)/g,"$1");I=I.replace(/\[list\]/gi,"<ul>");I=I.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');I=I.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');I=I.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');I=I.replace(/\[\/list\]/gi,"</ul>");I=I.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(J,K){return"[table]"+$.trim(K)+"[/table]"});I=I.replace(/\[table\]\n*/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');I=I.replace(/\[\/table\](\n*)?/gi,function(J,K){if(K){if(K.match(/\n/g).length>2){K=K.replace(/^\n/,"")}return"</table>"+K}return"</table>"});I=I.replace(/\[tr\]\n*/gi,"<tr>");I=I.replace(/\[\/tr\]\n*/gi,"</tr>");I=I.replace(/\[td\]\n*/gi,"<td>");I=I.replace(/\[\/td\]\n*/gi,"</td>");I=I.replace(/<td>([\S\s]*?)<\/td>/gi,function(J,L){var K=$.trim(L);if(!K.length){K="​"}return"<td>"+K+"</td>"});var d=this.wutil.getOption("woltlab.attachmentUrl");var H=this.wutil.getOption("woltlab.attachmentThumbnailUrl");if(d){var F=this.wbbcode._getImageAttachments();I=I.replace(/\[attach=(\d+)\]\[\/attach\]/g,function(J,K,L){K=parseInt(K);if(F[K]!==undefined){return'<img src="'+H.replace(/987654321/,K)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+K+'" />'}return J});I=I.replace(/\[attach=(\d+),(left|right|none)\]\[\/attach\]/g,function(K,L,M){L=parseInt(L);if(F[L]!==undefined){var J="";if(M==="left"||M==="right"){J="float: "+M+";";if(M==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+H.replace(/987654321/,L)+'" class="redactorEmbeddedAttachment redactorDisableResize" data-attachment-id="'+L+'"'+J+" />"}return K});I=I.replace(/\[attach=(\d+),(left|right|none),(\d+)\]\[\/attach\]/g,function(K,M,N,L){M=parseInt(M);if(F[M]!==undefined){var J="width: "+L+"px; max-height: "+F[M].height+"px; max-width: "+F[M].width+"px;";if(N==="left"||N==="right"){J+="float: "+N+";";if(N==="left"){J+="margin: 0 15px 7px 0"}else{J+="margin: 0 0 7px 15px"}}J=' style="'+J+'"';return'<img src="'+d.replace(/987654321/,M)+'" class="redactorEmbeddedAttachment" data-attachment-id="'+M+'"'+J+" />"}return K})}for(var w in __REDACTOR_SMILIES){var k=w.replace(/</g,"<").replace(/>/g,">");var j=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp(k)+"(?=\\s|<|$)","gi");I=I.replace(j,'$1<img src="'+__REDACTOR_SMILIES[w]+'" class="smiley" alt="'+k+'" />')}I=I.replace(/(javascript):/gi,"$1<span></span>:");I=I.replace(/(\r|\r\n)/g,"\n");var B=[];var E=[];var g=I.split(/(\[(?:\/quote|quote|quote='[^']*?'(?:,'[^']*?')?|quote="[^"]*?"(?:,"[^"]*?")?)\])/i);var e=WCF.getUUID();while(true){var p=false;for(var b=0;b<g.length;b++){var D=g[b];if(D.toLowerCase()==="[/quote]"){p=true;var f="";var n=g.slice(0,b);var c=false;while(n.length){var C=n.pop();f=C+f;if(C.match(/^\[quote/i)){D=f+D;var m=WCF.getUUID();B.push({hashCode:m,content:D.replace(/\$/g,"$$$$")});E.push(m);D="@@"+m+"@@";c=true;break}}if(!c){n=g.slice(0,b);D=e}g=n.concat(D,g.slice(b+1));break}}if(!p){break}}I=g.join("");I=I.replace(new RegExp(e,"g"),"[/quote]");I=I.replace(/\n*$/,"");var y=[];I=I.replace(/(<li>[\s\S]*?<\/li>)/g,function(J){J=$.trim(J).replace(/\n/g,"<br>");var K=WCF.getUUID();y.push({key:K,content:J});return K});var h=I.split("\n");I="";for(var b=0,l=h.length;b<l;b++){var t=$.trim(h[b]);if(t.match(/^<([a-z]+)/)||t.match(/<\/([a-z]+)>$/)){if(this.reIsBlock.test(RegExp.$1.toUpperCase())||RegExp.$1.toUpperCase()==="TABLE"){if(t.match(/^<([a-z]+).*<\/\1>/)){I+=t}else{I+=t+"<br />"}}else{I+="<p>"+t+"</p>"}}else{if(!t){t="<br>"}else{if(t.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){I+=t;continue}}}I+="<p>"+t+"</p>"}}I=I.replace(/<td>([\s\S]+?)<\/td>/g,function(J,K){K=K.replace(/<br(?: \/)?>(<[uo]l)/g,"$1");return"<td>"+K.replace(/<p><br(?: \/)?><\/p>/g,"<br>").replace(/<p>/g,"").replace(/<\/p>/g,"<br>").replace(/<br>$/,"")+"</td>"});if(y.length){for(var b=y.length-1;b>=0;b--){I=I.replace(y[b].key,y[b].content)}}if(B.length){var G=function(J){return J.replace(/^['"]/,"").replace(/['"]$/,"")};var r=this;var q=function(J){return J.replace(/\[quote(=(['"]).+?\2)?\]([\S\s]*)\[\/quote\]/gi,function(N,L,M,P){var T="";var O="";if(L){L=L.substr(1);L=L.split(",");switch(L.length){case 1:T=L[0];break;case 2:T=L[0];O=L[1];break}T=WCF.String.escapeHTML(G($.trim(T)));O=WCF.String.escapeHTML(G($.trim(O)))}var U='<blockquote class="quoteBox container containerPadding quoteBoxSimple" cite="'+O+'" data-author="'+T+'"><header contenteditable="false"><h3>'+r.wbbcode._buildQuoteHeader(T,O)+'</h3><a class="redactorQuoteEdit"></a></header>';P=$.trim(P);var K="";if(P.length){var S=P.split("\n");for(var R=0;R<S.length;R++){var Q=S[R];if(Q.length===0){Q=r.opts.invisibleSpace}else{if(Q.match(/^@@([0-9\-]+)@@$/)){if(WCF.inArray(RegExp.$1,E)){K+=Q;continue}}}K+="<div>"+Q+"</div>"}}else{K="<div>"+r.opts.invisibleSpace+"</div>"}U+=K;U+="</blockquote>";return U})};for(var b=B.length-1;b>=0;b--){var v=B[b];var z=new RegExp("@@"+v.hashCode+"@@","g");I=I.replace(z,q(v.content))}}I=I.replace(/<(?:div|p)><(blockquote|div)/g,"<$1");I=I.replace(/<\/(blockquote|div)><\/(?:div|p)>/g,"</$1>");if(u.length){for(var b=u.length-1;b>=0;b--){var A=u[b];var z=new RegExp("@@"+A.key+"@@","g");var i=A.value;i=i.replace(/^\[tt\]([\s\S]+)\[\/tt\]/,(function(J,L){var K=L.split("\n");L="";for(var O=0,N=K.length;O<N;O++){var M=K[O];if(M.length){if(L.length){L+="</p><p>"}L+="[tt]"+M+"[/tt]"}else{if(O===0||(O+1)===N){continue}if(L.match(/\[\/tt\]$/)){L+="</p><p>"+this.opts.invisibleSpace+""}else{L+="</p><p><br>"}}}return L}).bind(this));i=i.replace(/^\[code([^\]]*)\]([\S\s]*)\[\/code\]$/,(function(M,U,O){var N="plain";var S=0;var Q="";if(U){U=U.substring(1);U=U.split(",");var P=function(W){return W.match(/^\d+$/)};var L=function(W){return(W.indexOf(".")!==-1)||(W.match(/^(["']).*\1$/))};var K=function(W){return(__REDACTOR_CODE_HIGHLIGHTERS[W]!==undefined)};var J=function(W){return W.replace(/^(["'])(.*)\1$/,"$2")};switch(U.length){case 1:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0}else{if(L(U[0])){Q=J(U[0])}else{if(K(U[0])){N=U[0]}}}break;case 2:if(P(U[0])){S=(parseInt(U[0])>1)?U[0]:0;if(K(U[1])){N=U[1]}else{if(L(U[1])){Q=J(U[1])}}}else{if(K(U[0])){N=U[0]}if(L(U[1])){Q=J(U[1])}}break;case 3:if(K(U[0])){N=U[0]}if(P(U[1])){S=U[1]}if(L(U[2])){Q=J(U[2])}break}}O=O.replace(/^\n+/,"").replace(/\n+$/,"").split(/\n/);var V="";for(var T=0;T<O.length;T++){var R=O[T];if(!R.length){R=this.opts.invisibleSpace}V+="<li>"+R+"</li>"}return'<div class="codeBox container" contenteditable="false" data-highlighter="'+N+'"'+(Q?' data-filename="'+WCF.String.escapeHTML(Q)+'"':"")+"><div><div><h3>"+__REDACTOR_CODE_HIGHLIGHTERS[N]+(Q?": "+WCF.String.escapeHTML(Q):"")+'</h3></div><ol start="'+(S>1?S:1)+'">'+V+"</ol></div></div>"}).bind(this));I=I.replace(z,i)}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterConvertToHtml",{data:I});return I},_expandFormatting:function(e,c,f){if(!e.length){return c+this.opts.invisibleSpace+f}var b=e.indexOf("[/td]");if(b!==-1){var d=e.substring(0,b);if(d.indexOf("[td]")===-1){return c+d+f+e.substring(b)}}var d=e.split("\n");e="";for(var i=0,h=d.length;i<h;i++){var g=d[i];if(g.length===0){g=this.opts.invisibleSpace}if(e.length){e+="\n"}e+=c+g+f}return e},_pasteBeforeCallback:function(b){var c={1:24,2:22,3:18,4:14,5:12,6:10};b=b.replace(/<h([1-6])([^>]*)>/g,function(g,j,i){if(i&&i.match(/style="([^"]+?)"/)){if(/font-size: ?(\d+|\d+\.\d+)(px|pt|em|rem|%)/.test(RegExp.$1)){var d=$('<div style="width: '+RegExp.$1+RegExp.$2+'; position: absolute;" />').appendTo(document.body);var f=parseInt(d[0].clientWidth);d.remove();var e=-1;var h=false;$.each(c,function(m,l){if(e===-1){e=m}else{if(Math.abs(f-l)<Math.abs(f-c[e])){e=m}}if(f==l){h=true}});if(!h){e=(e<6)?parseInt(e)+1:e}j=e}}return"[size="+c[j]+"]"});b=b.replace(/<\/h[1-6]>/g,"[/size]");if(/<p class="MsoNormal">/.test(b)){b=b.replace(/([^>\s])\n([^<\s])/g,"$1 $2")}b=b.replace(/<o:p> <\/o:p>/g,"<br>");b=b.replace(/<(article|header)[^>]+>/g,"<div>");b=b.replace(/<\/(article|header)>/g,"</div>");b=b.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");b=b.replace(/<\/(div|p)><\/(div|p)>/g,"</p>");b=b.replace(/<(?:div|p|span)[^>]+>/gi,function(d){return d.replace(/ class="[^"]+"/,"")});b=b.replace(/<\/?wbr[^>]*>/g,"");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","beforePaste",{html:b});return b},_pasteCallback:function(b){b=b.replace(/\[size=(\d+)\]/g,'<p><span style="font-size: $1pt">');b=b.replace(/\[\/size\]/g,"</span></p>");b=b.replace(/style="([^"]+)"/,function(c,e){var d=e.split(";");var g=[];for(var i=0,f=d.length;i<f;i++){var h=d[i];if(!h.match(/^\s*background-color/)){g.push(h)}}return'style="'+g.join(";")+'"'});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","afterPaste",{html:b});return b;b=b.replace(/<img([^>]+)>/g,function(c,d){c=c.replace(/data-mozilla-paste-image="0"/,'data-mozilla-paste-image="0" style="display:none"');return c});return b},insertAttachment:function(f,d){f=parseInt(f);var b=this.wutil.getOption("woltlab.attachment"+(!d?"Thumbnail":"")+"Url");var e=this.wbbcode._getImageAttachments();if(b&&e[f]!==undefined){var c="";if(d){c=' style="width: '+e[f].width+"px; max-height: "+e[f].height+"px; max-width: "+e[f].width+'px;"'}this.wutil.insertDynamic('<img src="'+b.replace(/987654321/,f)+'" class="redactorEmbeddedAttachment'+(!d?" redactorDisableResize":"")+'" data-attachment-id="'+f+'"'+c+" />","[attach="+f+(d?",none,"+e[f].width:"")+"][/attach]")}else{this.wutil.insertDynamic("[attach="+f+"][/attach]")}},removeAttachment:function(b){if(!this.opts.visual){return}this.$editor.find("img.redactorEmbeddedAttachment").each(function(c,e){var d=$(e);if(d.data("attachmentID")==b){d.remove()}})},_getImageAttachments:function(){var c=this.wutil.getOption("woltlab.attachmentImages")||[];if(c.length){delete this.opts.attachmentImages;return c}var b={imageAttachments:{}};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","getImageAttachments_"+this.$textarea.wcfIdentify(),b);return b.imageAttachments},_keydownCallback:function(x){switch(x.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:case $.ui.keyCode.DOWN:case $.ui.keyCode.ENTER:case $.ui.keyCode.UP:case 83:break;default:return;break}this.selection.get();var p=this.selection.getCurrent();var n=this.selection.getParent();n=(n)?$(n):n;var j=(n)?n.closest("blockquote.quoteBox",this.$editor.get()[0]):{length:0};switch(x.event.which){case $.ui.keyCode.BACKSPACE:if(this.wutil.isCaret()){var h=false;if(j.length){var k=true;for(var b=0;b<j[0].children.length;b++){var w=j[0].children[b];if(w.tagName==="DIV"){if(w.textContent.replace(/\u200b/,"").length){k=false;break}}}if(k){h=true}else{var m=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;if(m.startOffset===0){var d=m.startContainer,o;while((d=d.parentNode)!==null){o=d.previousSibling;if(o!==null){if(o.nodeType===Node.ELEMENT_NODE&&o.nodeName==="HEADER"){h=true}break}}}}}else{var f=(this.selection.implicitRange===null)?this.range:this.selection.implicitRange;var q=f.startContainer;if(q.nodeType===Node.TEXT_NODE){if(f.startOffset===0||(f.startOffset===1&&q.textContent==="\u200b")){if(!q.previousSibling){q=q.parentElement}}}if(q.nodeType===Node.ELEMENT_NODE){var i=q.previousSibling;if(i&&i.nodeType===Node.ELEMENT_NODE&&i.tagName==="BLOCKQUOTE"){j=i;h=true}}}if(h){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(j[0]||j);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DELETE:if(this.wutil.isCaret()&&this.wutil.isEndOfElement(p)){var v=p.nextElementSibling;if(v&&v.tagName==="BLOCKQUOTE"){var t=window.getSelection();if(t.rangeCount){t.removeAllRanges()}var r=document.createRange();r.selectNode(v);t.addRange(r);x.cancel=true}}break;case $.ui.keyCode.DOWN:var e=$(p);if(e.next("blockquote").length){this.caret.setStart(e.next().children("div:first"));x.cancel=true}else{if(n){if(n.next("blockquote").length){this.caret.setStart(n.next().children("div:first"));x.cancel=true}else{if(j.length){var s=e.closest("div",j[0]);if(!s.next().length){if(j.next().length){this.caret.setStart(j.next())}else{this.wutil.setCaretAfter(j)}x.cancel=true}}}}}break;case $.ui.keyCode.ENTER:if(j.length){this.keydown.blockquote=false;this.keydown.enterWithinBlockquote=true}break;case $.ui.keyCode.UP:if(!n||!j.length){return}var s=$(p).closest("div",j[0]);var u=s.prev();if(u[0].tagName==="DIV"){return}else{if(u[0].tagName==="BLOCKQUOTE"){return}}var l=j.prev();if(l.length===0){this.wutil.setCaretBefore(j)}else{if(l[0].tagName==="BLOCKQUOTE"){this.caret.sendEnd(l.children("div:last"))}else{if($.trim(l.html())==""){l.html(this.opts.invisibleSpace)}this.caret.setEnd(l)}}x.cancel=true;break;case 83:if($.browser.mobile){return}var c=false;if(navigator.platform.match(/^Mac/)){if(x.event.ctrlKey&&x.event.altKey){c=true}}else{if(x.event.altKey&&!x.event.ctrlKey){c=true}}if(c){var g={cancel:false};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","submitEditor_"+this.$textarea.wcfIdentify(),g);if(g.cancel){x.cancel=true}}break}},_keyupCallback:function(d){switch(d.event.which){case $.ui.keyCode.BACKSPACE:case $.ui.keyCode.DELETE:this.$editor.find("blockquote").each(function(h,j){var i=$(j);if(!i.children("header").length){i.remove()}});break;case $.ui.keyCode.ENTER:for(var g=0,f=this.$editor[0].children.length;g<f;g++){var c=this.$editor[0].children[g];if(c.nodeType!==Node.ELEMENT_NODE||c.tagName!=="P"){continue}if(c.textContent.length>0){continue}if(c.children.length>1||c.children[0].tagName==="BR"){continue}c=c.children[0];while(c.children.length===1){c=c.children[0]}if(c.children.length===0&&c.tagName==="BR"){var e=c.parentNode;var b=document.createTextNode("\u200b");e.appendChild(b);e.removeChild(c)}}break}},observeQuotes:function(){this.$editor.find(".redactorQuoteEdit").off("click.wbbcode").on("click.wbbcode",$.proxy(this.wbbcode._observeQuotesClick,this))},_observeQuotesClick:function(e){var c=$(e.currentTarget).closest("header");var d=$('<span class="redactor-link-tooltip" />');$('<a href="#">'+WCF.Language.get("wcf.bbcode.quote.edit")+"</a>").click($.proxy(function(f){f.preventDefault();this.wbbcode._openQuoteEditOverlay($(e.currentTarget).closest("blockquote.quoteBox"),false);$(".redactor-link-tooltip").remove()},this)).appendTo(d);var b=c.offset();d.css({left:b.left+"px",top:(b.top+20)+"px"});$(".redactor-link-tooltip").remove();d.appendTo(document.body);this.selection.remove()},observeCodeListings:function(){this.$editor.find(".codeBox").each((function(b,e){var c=$(e);var d=c.find(".redactorEditCodeBox");if(!d.length){d=$('<div class="redactorEditCodeBox"><div>'+WCF.Language.get("wcf.bbcode.code.edit")+"</div></div>").insertAfter(c.find("> div > div > h3"))}d.off("click.wbbcode").on("click.wbbcode",(function(){this.wbbcode._handleInsertCode(c,false)}).bind(this))}).bind(this))},_openQuoteEditOverlay:function(b,d){this.modal.load("quote",WCF.Language.get("wcf.bbcode.quote."+(d?"insert":"edit")),400);var c=this.modal.createActionButton(this.lang.get("save"));if(d){this.selection.save();c.click($.proxy(function(){var g=$("#redactorQuoteAuthor").val();var f=WCF.String.escapeHTML($("#redactorQuoteLink").val());this.selection.restore();a=true;var e=this.selection.getHtml();if(this.utils.isEmpty(e)){e=""}var h=this.wbbcode.insertQuoteBBCode(g,f,e);if(h!==null){if(!e.length){if($.browser.mozilla){h.children("br[type=_moz]").replaceWith("<div>"+this.opts.invisibleSpace+"</div>")}this.caret.setStart(h.children("div")[0])}}this.modal.close()},this))}else{$("#redactorQuoteAuthor").val(b.data("author"));$("#redactorQuoteLink").val(WCF.String.unescapeHTML(b.attr("cite")));c.click($.proxy(function(){var e=$("#redactorQuoteAuthor").val();b.data("author",e);b.attr("data-author",e);b.prop("cite",WCF.String.escapeHTML($("#redactorQuoteLink").val()));this.wbbcode._updateQuoteHeader(b);this.modal.close()},this))}this.modal.show()},_updateQuoteHeader:function(c){var d=c.data("author");var b=c.attr("cite");if(b){b=WCF.String.escapeHTML(b)}c.find("> header > h3").empty().append(this.wbbcode._buildQuoteHeader(d,b))},insertQuoteBBCode:function(g,l,i,j){var k="[quote]";var c="[/quote]";if(g){if(l){k="[quote='"+g+"','"+l+"']"}else{k="[quote='"+g+"']"}}var p=null;if(this.wutil.inWysiwygMode()){var o=WCF.getUUID();var e="";if(j){e=this.wbbcode.convertToHtml(k+j+c)}else{e=this.wbbcode.convertToHtml(k+o+c);e=e.replace(o,i.replace(/^<p>/,"").replace(/<\/p>$/,""))}e=e.replace(/^<p>/,"").replace(/<\/p>$/,"");e=e.replace(/<blockquote/,'<blockquote id="'+o+'"');if(!window.getSelection().rangeCount){this.wutil.restoreSelection();if(!window.getSelection().rangeCount){this.$editor.focus();if(!window.getSelection().rangeCount){this.wutil.selectionEndOfEditor()}this.wutil.saveSelection()}}window.getSelection().getRangeAt(0).deleteContents();this.wutil.restoreSelection();var h=window.getSelection().getRangeAt(0);var b=h.startContainer;while(b){var f=b.parentNode;if(f===this.$editor[0]){break}b=f}if(b&&b.parentNode===this.$editor[0]){if(b.innerHTML.length){if(b.innerHTML==="\u200b"){this.caret.setEnd(b)}else{this.wutil.setCaretAfter(b)}}}this.insert.html(e,false);p=this.$editor.find("#"+o);if(p.length){var n=p.find("> div");if(n.length==1){if(n[0].innerHTML===""){n[0].innerHTML=this.opts.invisibleSpace}}else{if($.browser.mozilla){var m=p.find("> div > br[type=_moz]");if(m.length){$("<div>"+this.opts.invisibleSpace+"</div>").insertBefore(m);m.remove()}}}p.removeAttr("id");this.wutil.setCaretAfter(p[0]);var d=p[0].previousElementSibling;if(d!==null&&d.nodeName==="P"&&d.innerHTML==="\u200B"){d=d.previousElementSibling;if(d!==null&&d.nodeName==="P"&&(d.innerHTML==="\u200B"||d.innerHTML==="<br>")){d.parentNode.removeChild(d.nextElementSibling)}}}this.wbbcode.observeQuotes();this.wbbcode.fixBlockLevelElements();this.$toolbar.find("a.re-__wcf_quote").removeClass("redactor-button-disabled")}else{this.wutil.insertAtCaret(k+j+c)}this.wutil.saveSelection();return p},_buildQuoteHeader:function(c,d){var b="";if(!c&&d){c=d;d=""}if(c){if(d){b+='<a href="'+d+'" tabindex="-1">'}b+=WCF.Language.get("wcf.bbcode.quote.title.javascript",{quoteAuthor:WCF.String.unescapeHTML(c)});if(d){b+="</a>"}}else{b="<small>"+WCF.Language.get("wcf.bbcode.quote.title.clickToSet")+"</small>"}return b},_handleInsertQuote:function(){this.wbbcode._openQuoteEditOverlay(null,true)},_handleInsertCode:function(d,f){this.modal.load("code",WCF.Language.get("wcf.bbcode.code."+(f?"insert":"edit")),400);var b=this.modal.createActionButton(this.lang.get("save")).addClass("buttonPrimary");if(f){this.selection.get();var c=this.selection.getText();this.selection.save();this.modal.show();var j=$("#redactorCodeBox").focus();j.val(c);b.click($.proxy(function(){var q=$("#redactorCodeBox");var n=$("#redactorCodeFilename");var s=$("#redactorCodeHighlighter");var t=$("#redactorCodeLineNumber");var p=q.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(p).length===0){if(!q.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(q)}return}var o=$.trim(n.val().replace(/['"]/g,""));var r="[code="+s.val()+","+t.val()+(o.length?",'"+o+"'":"")+"]";if(r.match(/\[code=([^,]+),(\d+)\]/)){r="[code="+RegExp.$2+","+RegExp.$1+"]"}r+=p;r+="[/code]";this.wutil.adjustSelectionForBlockElement();this.wutil.saveSelection();var m=this.wbbcode.convertToHtml(r);this.buffer.set();this.insert.html(m,false);var q=this.$editor.find(".codeBox:not(.jsRedactorCodeBox)");this.wbbcode.observeCodeListings();this.wbbcode.fixBlockLevelElements();q.attr("contenteditable","false");this.wutil.setCaretAfter(q[0]);this.modal.close()},this))}else{var h=this.modal.createActionButton(WCF.Language.get("wcf.global.button.delete"));h.click((function(){this.buffer.set();d.remove();this.modal.close()}).bind(this));this.modal.show();var j=$("#redactorCodeBox").focus();var i=$("#redactorCodeFilename");var g=$("#redactorCodeHighlighter");var k=$("#redactorCodeLineNumber");g.val(d.data("highlighter"));i.val(d.data("filename")||"");var e=d.find("> div > ol");k.val(parseInt(e.prop("start")));var l="";e.children("li").each(function(m,n){l+=$(n).text().replace(/^\u200b$/,"")+"\n"});j.val(l.replace(/^\n+/,"").replace(/\n+$/,""));b.click($.proxy(function(){var n=j.val().replace(/^\n+/,"").replace(/\n+$/,"");if($.trim(n).length===0){if(!j.next("small.innerError").length){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(j)}return}var r=g.val();d.data("highlighter",r);d.attr("data-highlighter",r);var o=__REDACTOR_CODE_HIGHLIGHTERS[r];var m=$.trim(i.val().replace(/['"]/g,""));if(m){o+=": "+WCF.String.escapeHTML(m);d.data("filename",m);d.attr("data-filename",m)}else{d.removeAttr("data-filename");d.removeData("filename")}d.data("highlighter",g.val());d.find("> div > div > h3").html(o);var p=d.find("> div > ol").empty();var s=parseInt(k.val());p.prop("start",(s>1?s:1));n=n.split("\n");var q="";for(var t=0;t<n.length;t++){q+="<li>"+WCF.String.escapeHTML(n[t])+"</li>"}p.append($(q));this.modal.close()},this))}},fixBlockLevelElements:function(){var b=(function(e,c){var d=e[c];if(d&&d.nodeType===Node.ELEMENT_NODE&&d.tagName==="P"){if(!d.innerHTML.length){d.parentElement.removeChild(d)}}}).bind(this);this.$editor.find("blockquote, .codeBox").each(function(){b(this,"previousElementSibling");b(this,"nextElementSibling")})},fixFormatting:function(d){var b=function(f){f.style.removeProperty("text-align");for(var g=0;g<f.children.length;g++){b(f.children[g])}};for(var e=0;e<this.alignment.blocks.length;e++){var c=this.alignment.blocks[e];switch(c.tagName){case"BLOCKQUOTE":c.style.removeProperty("text-align");b(c.children[0]);break;case"DIV":if(/\bcodeBox\b/.test(c.className)){b(c)}break}}}}};
// wbutton.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbutton=function(){return{_bbcodes:{},init:function(){this._bbcodes={};for(var i=0,f=__REDACTOR_BUTTONS.length;i<f;i++){this.wbutton._addBBCodeButton(__REDACTOR_BUTTONS[i])}var d={html:"fa-square-o",bold:"fa-bold",italic:"fa-italic",underline:"fa-underline",deleted:"fa-strikethrough",subscript:"fa-subscript",superscript:"fa-superscript",orderedlist:"fa-list-ol",unorderedlist:"fa-list-ul",outdent:"fa-outdent",indent:"fa-indent",link:"fa-link",alignment:"fa-align-left",table:"fa-table"};var e={fontcolor:WCF.Language.get("wcf.bbcode.button.fontColor"),fontfamily:WCF.Language.get("wcf.bbcode.button.fontFamily"),fontsize:WCF.Language.get("wcf.bbcode.button.fontSize"),image:WCF.Language.get("wcf.bbcode.button.image"),subscript:WCF.Language.get("wcf.bbcode.button.subscript"),superscript:WCF.Language.get("wcf.bbcode.button.superscript")};var c=this.wutil.getOption("buttons");var g="";for(var i=0,f=c.length;i<f;i++){var a=c[i];if(a=="separator"){this.button.get(g).parent().addClass("separator");continue}var h=this.button.get(a);if(h.length){if(d[a]){this.button.setAwesome(a,d[a])}if(a==="table"&&g){h.parent().insertAfter(this.button.get(g).parent())}}else{this.wbutton._addCoreButton(a,(e[a]?e[a]:null),(d[a]?d[a]:null),g)}g=a}this.button.addCallback(this.button.get("image"),$.proxy(this.wbutton.insertImage,this));if(this.utils.isDesktop()){var b=this.button.addAfter("html","undo",WCF.Language.get("wcf.bbcode.button.undo"));var j=this.button.addAfter("undo","redo",WCF.Language.get("wcf.bbcode.button.redo"));this.button.addCallback(b,this.buffer.undo);this.button.addCallback(j,this.buffer.redo);j.parent().addClass("separator")}},_addCoreButton:function(b,c,a,d){var f={title:(c===null?b:c)};if(b==="subscript"||b==="superscript"){f.command=b}var e=this.button.build(b,f);$("<li />").append(e).insertAfter(this.button.get(d).parent());if(a!==null){this.button.setAwesome(b,a)}},_addBBCodeButton:function(b){var c="__wcf_"+b.name;var a=this.button.add(c,b.label);this.button.addCallback(a,this.wbutton._insertBBCode);this._bbcodes[c]={name:b.name,voidElement:(b.voidElement===true)};if(b.icon.match(/^fa\-[a-z\-]+$/)){this.button.setAwesome(c,b.icon)}else{a.css("background-image","url("+__REDACTOR_ICON_PATH+b.icon+")")}},_insertBBCode:function(a){var d=this._bbcodes[a].name;var b={buttonName:a,cancel:false,redactor:this};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","insertBBCode_"+d+"_"+this.$textarea.wcfIdentify(),b);if(b.cancel===false){var c=this.selection.getHtml();c=c.replace(/<p>@@@wcf_empty_line@@@<\/p>/g,"<p><br></p>");if(false&&d==="tt"){var e=(this.selection.getParent())?$(this.selection.getParent()):null;if(e&&e.closest("inline.inlineCode",this.$editor.get()[0]).length){this.inline.toggleClass("inlineCode")}else{this.inline.toggleClass("inlineCode")}}else{this.buffer.set();if(this.utils.browser("mozilla")&&!c.length){var f=getSelection().getRangeAt(0).startContainer;if(f.nodeType===Node.ELEMENT_NODE&&f.tagName==="P"&&f.innerHTML==="<br>"){f.removeChild(f.children[0])}}if(this._bbcodes[a].voidElement){this.insert.html(c+this.selection.getMarkerAsHtml()+"["+d+"]",false)}else{this.insert.html("["+d+"]"+c+this.selection.getMarkerAsHtml()+"[/"+d+"]",false)}this.selection.restore()}}},insertImage:function(){this.image.show()},_insertImage:function(){var d=$("#redactor-image-link-source");var b=d.val().trim();if(b.length){this.buffer.set();var c=$("#redactor-image-align").val();var a="";if(c==="left"||c==="right"){a=' style="float: '+c+'"'}this.insert.html('<img src="'+b+'"'+a+">",false);this.modal.close();this.observe.images()}else{if(!d.next("small.innerError")){$('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(d)}}}}};
// wfontcolor.js
(function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof exports?a(require("jquery")):a(jQuery)})(function(d){function b(h){return"string"==typeof h?parseInt(h,10):~~h}var f={wheelSpeed:1,wheelPropagation:!1,swipePropagation:!0,minScrollbarLength:null,maxScrollbarLength:null,useBothWheelAxes:!1,useKeyboard:!0,suppressScrollX:!1,suppressScrollY:!1,scrollXMarginOffset:0,scrollYMarginOffset:0,includePadding:!1},g=0,c=function(){var h=g++;return function(e){var i=".perfect-scrollbar-"+h;return e===void 0?i:e+i}},a="WebkitAppearance" in document.documentElement.style;d.fn.perfectScrollbar=function(h,e){return this.each(function(){function aS(m,p){var q=m+p,k=aq-ac;aK=0>q?0:q>k?k:q;var j=b(aK*(l-aq)/(aq-ac));ah.scrollTop(j)}function aD(m,p){var q=m+p,k=ap-aI;o=0>q?0:q>k?k:q;var j=b(o*(ar-ap)/(ap-aI));ah.scrollLeft(j)}function aQ(j){return ae.minScrollbarLength&&(j=Math.max(j,ae.minScrollbarLength)),ae.maxScrollbarLength&&(j=Math.min(j,ae.maxScrollbarLength)),j}function aC(){var k={width:al};k.left=at?ah.scrollLeft()+ap-ar:ah.scrollLeft(),ag?k.bottom=aT-ah.scrollTop():k.top=ad+ah.scrollTop(),am.css(k);var j={top:ah.scrollTop(),height:au};i?j.right=at?ar-ah.scrollLeft()-r-ak.outerWidth():r-ah.scrollLeft():j.left=at?ah.scrollLeft()+2*ap-ar-aw-ak.outerWidth():aw+ah.scrollLeft(),an.css(j),t.css({left:o,width:aI-ax}),ak.css({top:aK,height:ac-aF})}function aP(){ah.removeClass("ps-active-x"),ah.removeClass("ps-active-y"),ap=ae.includePadding?ah.innerWidth():ah.width(),aq=ae.includePadding?ah.innerHeight():ah.height(),ar=ah.prop("scrollWidth"),l=ah.prop("scrollHeight"),!ae.suppressScrollX&&ar>ap+ae.scrollXMarginOffset?(n=!0,al=ap-ao,aI=aQ(b(al*ap/ar)),o=b(ah.scrollLeft()*(al-aI)/(ar-ap))):(n=!1,aI=0,o=0,ah.scrollLeft(0)),!ae.suppressScrollY&&l>aq+ae.scrollYMarginOffset?(af=!0,au=aq-aN,ac=aQ(b(au*aq/l)),aK=b(ah.scrollTop()*(au-ac)/(l-aq))):(af=!1,ac=0,aK=0,ah.scrollTop(0)),o>=al-aI&&(o=al-aI),aK>=au-ac&&(aK=au-ac),aC(),n&&ah.addClass("ps-active-x"),af&&ah.addClass("ps-active-y")}function aG(){var j,m,p=function(q){aD(j,q.pageX-m),aP(),q.stopPropagation(),q.preventDefault()},k=function(){am.removeClass("in-scrolling"),d(aE).unbind(aj("mousemove"),p)};t.bind(aj("mousedown"),function(q){m=q.pageX,j=t.position().left,am.addClass("in-scrolling"),d(aE).bind(aj("mousemove"),p),d(aE).one(aj("mouseup"),k),q.stopPropagation(),q.preventDefault()}),j=m=null}function aO(){var j,m,p=function(q){aS(j,q.pageY-m),aP(),q.stopPropagation(),q.preventDefault()},k=function(){an.removeClass("in-scrolling"),d(aE).unbind(aj("mousemove"),p)};ak.bind(aj("mousedown"),function(q){m=q.pageY,j=ak.position().top,an.addClass("in-scrolling"),d(aE).bind(aj("mousemove"),p),d(aE).one(aj("mouseup"),k),q.stopPropagation(),q.preventDefault()}),j=m=null}function aB(k,j){var m=ah.scrollTop();if(0===k){if(!af){return !1}if(0===m&&j>0||m>=l-aq&&0>j){return !ae.wheelPropagation}}var p=ah.scrollLeft();if(0===j){if(!n){return !1}if(0===p&&0>k||p>=ar-ap&&k>0){return !ae.wheelPropagation}}return !0}function aM(p,k){var q=ah.scrollTop(),s=ah.scrollLeft(),m=Math.abs(p),j=Math.abs(k);if(j>m){if(0>k&&q===l-aq||k>0&&0===q){return !ae.swipePropagation}}else{if(m>j&&(0>p&&s===ar-ap||p>0&&0===s)){return !ae.swipePropagation}}return !0}function aR(){function k(q){var p=q.originalEvent.deltaX,s=-1*q.originalEvent.deltaY;return(p===void 0||s===void 0)&&(p=-1*q.originalEvent.wheelDeltaX/6,s=q.originalEvent.wheelDeltaY/6),q.originalEvent.deltaMode&&1===q.originalEvent.deltaMode&&(p*=10,s*=10),p!==p&&s!==s&&(p=0,s=q.originalEvent.wheelDelta),[p,s]}function j(q){if(a||!(ah.find("select:focus").length>0)){var u=k(q),s=u[0],p=u[1];m=!1,ae.useBothWheelAxes?af&&!n?(p?ah.scrollTop(ah.scrollTop()-p*ae.wheelSpeed):ah.scrollTop(ah.scrollTop()+s*ae.wheelSpeed),m=!0):n&&!af&&(s?ah.scrollLeft(ah.scrollLeft()+s*ae.wheelSpeed):ah.scrollLeft(ah.scrollLeft()-p*ae.wheelSpeed),m=!0):(ah.scrollTop(ah.scrollTop()-p*ae.wheelSpeed),ah.scrollLeft(ah.scrollLeft()+s*ae.wheelSpeed)),aP(),m=m||aB(s,p),m&&(q.stopPropagation(),q.preventDefault())}}var m=!1;window.onwheel!==void 0?ah.bind(aj("wheel"),j):window.onmousewheel!==void 0&&ah.bind(aj("mousewheel"),j)}function aL(){var j=!1;ah.bind(aj("mouseenter"),function(){j=!0}),ah.bind(aj("mouseleave"),function(){j=!1});var k=!1;d(aE).bind(aj("keydown"),function(s){if((!s.isDefaultPrevented||!s.isDefaultPrevented())&&j){for(var q=document.activeElement?document.activeElement:aE.activeElement;q.shadowRoot;){q=q.shadowRoot.activeElement}if(!d(q).is(":input,[contenteditable]")){var m=0,p=0;switch(s.which){case 37:m=-30;break;case 38:p=30;break;case 39:m=30;break;case 40:p=-30;break;case 33:p=90;break;case 32:case 34:p=-90;break;case 35:p=s.ctrlKey?-l:-aq;break;case 36:p=s.ctrlKey?ah.scrollTop():aq;break;default:return}ah.scrollTop(ah.scrollTop()-p),ah.scrollLeft(ah.scrollLeft()+m),k=aB(m,p),k&&s.preventDefault()}}})}function aA(){function j(k){k.stopPropagation()}ak.bind(aj("click"),j),an.bind(aj("click"),function(p){var q=b(ac/2),s=p.pageY-an.offset().top-q,m=aq-ac,k=s/m;0>k?k=0:k>1&&(k=1),ah.scrollTop((l-aq)*k)}),t.bind(aj("click"),j),am.bind(aj("click"),function(p){var q=b(aI/2),s=p.pageX-am.offset().left-q,m=ap-aI,k=s/m;0>k?k=0:k>1&&(k=1),ah.scrollLeft((ar-ap)*k)})}function aH(){function m(){var u=window.getSelection?window.getSelection():document.getSlection?document.getSlection():{rangeCount:0};return 0===u.rangeCount?null:u.getRangeAt(0).commonAncestorContainer}function q(){p||(p=setInterval(function(){return az()?(ah.scrollTop(ah.scrollTop()+j.top),ah.scrollLeft(ah.scrollLeft()+j.left),aP(),void 0):(clearInterval(p),void 0)},50))}function s(){p&&(clearInterval(p),p=null),am.removeClass("in-scrolling"),an.removeClass("in-scrolling")}var p=null,j={top:0,left:0},k=!1;d(aE).bind(aj("selectionchange"),function(){d.contains(ah[0],m())?k=!0:(k=!1,s())}),d(window).bind(aj("mouseup"),function(){k&&(k=!1,s())}),d(window).bind(aj("mousemove"),function(x){if(k){var v={x:x.pageX,y:x.pageY},w=ah.offset(),u={left:w.left,right:w.left+ah.outerWidth(),top:w.top,bottom:w.top+ah.outerHeight()};v.x<u.left+3?(j.left=-5,am.addClass("in-scrolling")):v.x>u.right-3?(j.left=5,am.addClass("in-scrolling")):j.left=0,v.y<u.top+3?(j.top=5>u.top+3-v.y?-5:-20,an.addClass("in-scrolling")):v.y>u.bottom-3?(j.top=5>v.y-u.bottom+3?5:20,an.addClass("in-scrolling")):j.top=0,0===j.top&&0===j.left?s():q()}})}function aa(H,m){function q(s,p){ah.scrollTop(ah.scrollTop()-p),ah.scrollLeft(ah.scrollLeft()-s),aP()}function j(){z=!0}function x(){z=!1}function y(p){return p.originalEvent.targetTouches?p.originalEvent.targetTouches[0]:p.originalEvent}function D(s){var p=s.originalEvent;return p.targetTouches&&1===p.targetTouches.length?!0:p.pointerType&&"mouse"!==p.pointerType&&p.pointerType!==p.MSPOINTER_TYPE_MOUSE?!0:!1}function I(s){if(D(s)){E=!0;var p=y(s);k.pageX=p.pageX,k.pageY=p.pageY,A=(new Date).getTime(),null!==C&&clearInterval(C),s.stopPropagation()}}function B(J){if(!z&&E&&D(J)){var u=y(J),K={pageX:u.pageX,pageY:u.pageY},w=K.pageX-k.pageX,p=K.pageY-k.pageY;q(w,p),k=K;var v=(new Date).getTime(),L=v-A;L>0&&(F.x=w/L,F.y=p/L,A=v),aM(w,p)&&(J.stopPropagation(),J.preventDefault())}}function G(){!z&&E&&(E=!1,clearInterval(C),C=setInterval(function(){return az()?0.01>Math.abs(F.x)&&0.01>Math.abs(F.y)?(clearInterval(C),void 0):(q(30*F.x,30*F.y),F.x*=0.8,F.y*=0.8,void 0):(clearInterval(C),void 0)},10))}var k={},A=0,F={},C=null,z=!1,E=!1;H&&(d(window).bind(aj("touchstart"),j),d(window).bind(aj("touchend"),x),ah.bind(aj("touchstart"),I),ah.bind(aj("touchmove"),B),ah.bind(aj("touchend"),G)),m&&(window.PointerEvent?(d(window).bind(aj("pointerdown"),j),d(window).bind(aj("pointerup"),x),ah.bind(aj("pointerdown"),I),ah.bind(aj("pointermove"),B),ah.bind(aj("pointerup"),G)):window.MSPointerEvent&&(d(window).bind(aj("MSPointerDown"),j),d(window).bind(aj("MSPointerUp"),x),ah.bind(aj("MSPointerDown"),I),ah.bind(aj("MSPointerMove"),B),ah.bind(aj("MSPointerUp"),G)))}function ay(){ah.bind(aj("scroll"),function(){aP()})}function ai(){ah.unbind(aj()),d(window).unbind(aj()),d(aE).unbind(aj()),ah.data("perfect-scrollbar",null),ah.data("perfect-scrollbar-update",null),ah.data("perfect-scrollbar-destroy",null),t.remove(),ak.remove(),am.remove(),an.remove(),ah=am=an=t=ak=n=af=ap=aq=ar=l=aI=o=aT=ag=ad=ac=aK=r=i=aw=at=aj=null}function ab(){aP(),ay(),aG(),aO(),aA(),aH(),aR(),(av||aJ)&&aa(av,aJ),ae.useKeyboard&&aL(),ah.data("perfect-scrollbar",ah),ah.data("perfect-scrollbar-update",aP),ah.data("perfect-scrollbar-destroy",ai)}var ae=d.extend(!0,{},f),ah=d(this),az=function(){return !!ah};if("object"==typeof h?d.extend(!0,ae,h):e=h,"update"===e){return ah.data("perfect-scrollbar-update")&&ah.data("perfect-scrollbar-update")(),ah}if("destroy"===e){return ah.data("perfect-scrollbar-destroy")&&ah.data("perfect-scrollbar-destroy")(),ah}if(ah.data("perfect-scrollbar")){return ah.data("perfect-scrollbar")}ah.addClass("ps-container");var ap,aq,ar,l,n,aI,o,al,af,ac,aK,au,at="rtl"===ah.css("direction"),aj=c(),aE=this.ownerDocument||document,am=d("<div class='ps-scrollbar-x-rail'>").appendTo(ah),t=d("<div class='ps-scrollbar-x'>").appendTo(am),aT=b(am.css("bottom")),ag=aT===aT,ad=ag?null:b(am.css("top")),ax=b(am.css("borderLeftWidth"))+b(am.css("borderRightWidth")),ao=b(am.css("marginLeft"))+b(am.css("marginRight")),an=d("<div class='ps-scrollbar-y-rail'>").appendTo(ah),ak=d("<div class='ps-scrollbar-y'>").appendTo(an),r=b(an.css("right")),i=r===r,aw=i?null:b(an.css("left")),aF=b(an.css("borderTopWidth"))+b(an.css("borderBottomWidth")),aN=b(an.css("marginTop"))+b(an.css("marginBottom")),av="ontouchstart" in window||window.DocumentTouch&&document instanceof window.DocumentTouch,aJ=null!==window.navigator.msMaxTouchPoints;return ab(),ah})}}); })(this);
// WCF.js
-(function (window, undefined) {"use strict";(function(){var c=jQuery.fn.data;jQuery.fn.data=function(f,h){if(f){switch(typeof f){case"object":for(var g in f){if(g.match(/ID$/)){var e=f[g];delete f[g];g=g.replace(/ID$/,"-id");f[g]=e}}arguments[0]=f;break;case"string":if(f.match(/ID$/)){arguments[0]=f.replace(/ID$/,"-id")}break}}var d=c.apply(this,arguments);if(f===undefined){for(var g in d){if(g.match(/Id$/)){d[g.replace(/Id$/,"ID")]=d[g];delete d[g]}}}return d};if(!window.console){window.console={}}var b=["log","info","warn","exception","assert","dir","dirxml","trace","group","groupEnd","groupCollapsed","profile","profileEnd","count","clear","time","timeEnd","timeStamp","table","error"];for(var a=0;a<b.length;a++){if(typeof(console[b[a]])==="undefined"){console[b[a]]=function(){}}}if(typeof(console.debug)==="undefined"){console.debug=function(d){console.log(d)}}})();String.prototype.hashCode=function(){var a;var b=0;if(this.length){for(var d=0,c=this.length;d<c;d++){a=this.charCodeAt(d);b=((b<<5)-b)+a;b=b&b}}return b};window.shuffle=function(d){var c=d.length,b,a;while(0!==c){a=Math.floor(Math.random()*c);c-=1;b=d[c];d[c]=d[a];d[a]=b}return this};(function(){var d=navigator.userAgent.toLowerCase();var c=/(chrome)[ \/]([\w.]+)/.exec(d)||/(webkit)[ \/]([\w.]+)/.exec(d)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(d)||/(msie) ([\w.]+)/.exec(d)||d.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(d)||[];var a={browser:c[1]||"",version:c[2]||"0"};var b={};if(a.browser){b[a.browser]=true;b.version=a.version}if(b.chrome){b.webkit=true}else{if(b.webkit){b.safari=true}}jQuery.browser=jQuery.browser||{};jQuery.browser=$.extend(jQuery.browser,b);jQuery.browser.touch=(!!("ontouchstart" in window)||(!!("msMaxTouchPoints" in window.navigator)&&window.navigator.msMaxTouchPoints>0));jQuery.browser.smartphone=($("html").css("caption-side")=="bottom");if(jQuery.browser.mozilla&&d.match(/trident/)){jQuery.browser.mozilla=false;jQuery.browser.msie=true}jQuery.browser.iOS=/\((ipad|iphone|ipod);/.test(d);if(jQuery.browser.iOS){$("html").addClass("iOS")}jQuery.browser.android=(d.indexOf("android")!==-1);jQuery.browser.editor="redactor";jQuery.browser.ckeditor=false;jQuery.browser.redactor=true})();window.WCF={};$.extend(true,{removeArrayValue:function(b,a){return $.grep(b,function(d,c){return a!==d})},wcfEscapeID:function(a){return a.replace(/(:|\.)/g,"\\$1")},wcfIsset:function(a){return !!$("#"+$.wcfEscapeID(a)).length},getLength:function(a){var c=0;for(var b in a){if(a.hasOwnProperty(b)){c++}}return c}});$.fn.extend({getTagName:function(){return(this.length)?this.get(0).tagName.toLowerCase():""},getDimensions:function(c){var b={};var d={};var a=false;if(this.is(":hidden")){b=WCF.getInlineCSS(this);a=true;this.css({display:"block",visibility:"hidden"})}switch(c){case"inner":d={height:this.innerHeight(),width:this.innerWidth()};break;case"outer":d={height:this.outerHeight(),width:this.outerWidth()};break;default:d={height:this.height(),width:this.width()};break}if(a){WCF.revertInlineCSS(this,b,["display","visibility"])}return d},getOffsets:function(c){var b={};var d={};var a=false;if(this.is(":hidden")){b=WCF.getInlineCSS(this);a=true;this.css({display:"block",visibility:"hidden"})}switch(c){case"offset":d=this.offset();break;case"position":default:d=this.position();break}if(a){WCF.revertInlineCSS(this,b,["display","visibility"])}return d},makePositioned:function(a,b){if(a!="absolute"&&a!="fixed"){a="absolute"}var c=this.getOffsets("position");this.css({position:a,left:c.left,margin:0,top:c.top});if(b){this.remove().appentTo("body")}return this},disable:function(){return this.attr("disabled","disabled")},enable:function(){return this.removeAttr("disabled")},wcfIdentify:function(){if(!this.attr("id")){this.attr("id",WCF.getRandomID())}return this.attr("id")},getCaret:function(){if(this.is("input")){if(this.attr("type")!="text"&&this.attr("type")!="password"){return -1}}else{if(!this.is("textarea")){return -1}}var c=0;var b=this.get(0);if(document.selection){this.focus();var a=document.selection.createRange();a.moveStart("character",-this.val().length);c=a.text.length}else{if(b.selectionStart||b.selectionStart=="0"){c=parseInt(b.selectionStart)}}return c},setCaret:function(b){if(this.is("input")){if(this.attr("type")!="text"&&this.attr("type")!="password"){return false}}else{if(!this.is("textarea")){return false}}var c=this.get(0);this.focus();if(document.selection){var a=document.selection.createRange();a.moveStart("character",b);a.moveEnd("character",0);a.select()}else{if(c.selectionStart||c.selectionStart=="0"){c.selectionStart=b;c.selectionEnd=b}}return true},wcfDropIn:function(b,c,a){if(!b){b="up"}if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"drop"),{direction:b},a,c)},wcfDropOut:function(b,c,a){if(!b){b="down"}if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"drop"),{direction:b},a,c)},wcfBlindIn:function(b,c,a){if(!b){b="vertical"}if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"blind"),{direction:b},a,c)},wcfBlindOut:function(b,c,a){if(!b){b="vertical"}if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"blind"),{direction:b},a,c)},wcfHighlight:function(a,b){return this.effect("highlight",a,600,b)},wcfFadeIn:function(b,a){if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"fade"),{},a,b)},wcfFadeOut:function(b,a){if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"fade"),{},a,b)},cssAsNumber:function(b){if(this.length){var a=this.css(b);if(a!==undefined){return parseInt(a.replace(/px$/,""))}}return 0}});$.extend(WCF,{activeDialogs:0,_idCounter:0,getRandomID:function(){var a="";do{a="wcf"+this._idCounter++}while($.wcfIsset(a));return a},inArray:function(b,a){return($.inArray(b,a)!=-1)},getEffect:function(a,b){if(a.is("tr")){return"highlight"}return b},getInlineCSS:function(b){var c={};var a=b.attr("style");if(!a){return{}}a=a.split(";");for(var f=0,d=a.length;f<d;f++){var e=$.trim(a[f]);if(e==""){continue}e=e.split(":");c[$.trim(e[0])]=$.trim(e[1])}return c},revertInlineCSS:function(a,c,e){for(var f=0,d=e.length;f<d;f++){var b=e[f];if(c[b]){a.css(b,c[b])}else{a.css(b,"")}}},getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(d){var b=Math.random()*16|0,a=d=="x"?b:(b&3|8);return a.toString(16)})},base64toBlob:function(h,g,a){g=g||"";a=a||512;var c=atob(h);var b=[];for(var j=0;j<c.length;j+=a){var f=c.slice(j,j+a);var d=new Array(f.length);for(var i=0;i<f.length;i++){d[i]=f.charCodeAt(i)}var e=new Uint8Array(d);b.push(e)}return new Blob(b,{type:g})},convertLegacyURL:function(a){if(URL_LEGACY_MODE){return a}return a.replace(/^index\.php\/(.*?)\/\?/,function(d,c){var e=c.split(/([A-Z][a-z0-9]+)/);var b="";for(var h=0,f=e.length;h<f;h++){var g=e[h].trim();if(g.length){if(b.length){b+="-"}b+=g.toLowerCase()}}return"index.php?"+b+"/&"})}});WCF.Browser={_isChrome:null,isChrome:function(){if(this._isChrome===null){this._isChrome=false;if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())){this._isChrome=true}}return this._isChrome}};WCF.Dropdown={_callbacks:{},_didInit:false,_dropdowns:{},_menuContainer:null,_menus:{},init:function(){if(this._menuContainer===null){this._menuContainer=$('<div id="dropdownMenuContainer" />').appendTo(document.body)}var a=this;$(".dropdownToggle:not(.jsDropdownEnabled)").each(function(b,c){a.initDropdown($(c),false)});if(!this._didInit){this._didInit=true;WCF.CloseOverlayHandler.addCallback("WCF.Dropdown",$.proxy(this._closeAll,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.Dropdown",$.proxy(this.init,this));$(document).on("scroll",$.proxy(this._scroll,this))}},_dialogScroll:function(b){var a=$(b.currentTarget);a.find(".dropdown.dropdownOpen").each(function(d,f){var i=$(f);var e=i.wcfIdentify();var g=i.offset();var c=a.offset();var h=$(f).height()/2;if(g.top+h<=c.top){WCF.Dropdown.toggleDropdown(e)}else{if(g.top>=c.top+a.height()){WCF.Dropdown.toggleDropdown(e)}else{if(g.left<=c.left){WCF.Dropdown.toggleDropdown(e)}else{if(g.left>=c.left+a.width()){WCF.Dropdown.toggleDropdown(e)}else{WCF.Dropdown.setAlignmentByID(i.wcfIdentify())}}}}})},_scroll:function(b){for(var a in this._dropdowns){var c=this._dropdowns[a];if(c.data("isOverlayDropdownButton")&&c.hasClass("dropdownOpen")){this.setAlignmentByID(a)}}},initDropdown:function(b,d){if(b.hasClass("jsDropdownEnabled")||b.data("target")){return}var e=b.parents(".dropdown");if(!e.length){console.debug("[WCF.Dropdown] Invalid dropdown passed, button '"+b.wcfIdentify()+"' does not have a parent with .dropdown, aborting.");return}var a=b.next(".dropdownMenu");if(!a.length){console.debug("[WCF.Dropdown] Invalid dropdown passed, dropdown '"+e.wcfIdentify()+"' does not have a dropdown menu, aborting.");return}a.detach().appendTo(this._menuContainer);var c=e.wcfIdentify();if(!this._dropdowns[c]){b.addClass("jsDropdownEnabled").click($.proxy(this._toggle,this));this._dropdowns[c]=e;this._menus[c]=a;if(!c.match(/^wcf\d+$/)){a.attr("data-source",c)}}b.data("target",c);if(d){b.trigger("click")}},removeDropdown:function(a){if(this._menus[a]){$(this._menus[a]).remove();delete this._menus[a];delete this._dropdowns[a]}},initDropdownFragment:function(c,a){var b=c.wcfIdentify();if(this._dropdowns[b]){console.debug("[WCF.Dropdown] Cannot register dropdown identified by '"+b+"' as a fragement.");return}this._dropdowns[b]=c;this._menus[b]=a.detach().appendTo(this._menuContainer)},registerCallback:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.Dropdown] Callback for '"+a+"' is invalid");return false}if(!this._callbacks[a]){this._callbacks[a]=[]}this._callbacks[a].push(b)},_toggle:function(g,e){var b=(g===null)?e:$(g.currentTarget).data("target");var a=this._dropdowns[b];if(a&&a.data("isOverlayDropdownButton")===undefined){var d=a.parents(".dialogContent");a.data("isOverlayDropdownButton",d.length>0);if(d.length){d.on("scroll",this._dialogScroll)}}for(var f in this._dropdowns){var h=this._dropdowns[f];var c=this._menus[f];if(h.hasClass("dropdownOpen")){h.removeClass("dropdownOpen");c.removeClass("dropdownOpen");this._notifyCallbacks(f,"close")}else{if(f===b&&c[0].children.length>0){h.addClass("dropdownOpen");c.addClass("dropdownOpen");this._notifyCallbacks(f,"open");this.setAlignment(h,c)}}}WCF.Dropdown.Interactive.Handler.closeAll();if(g!==null){g.stopPropagation();return false}},toggleDropdown:function(a){this._toggle(null,a)},getDropdown:function(a){if(this._dropdowns[a]){return this._dropdowns[a]}return null},getDropdownMenu:function(a){if(this._menus[a]){return this._menus[a]}return null},setAlignmentByID:function(a){var c=this.getDropdown(a);if(c===null){console.debug("[WCF.Dropdown] Unable to find dropdown identified by '"+a+"'")}var b=this.getDropdownMenu(a);if(b===null){console.debug("[WCF.Dropdown] Unable to find dropdown menu identified by '"+a+"'")}this.setAlignment(c,b)},setAlignment:function(t,u){if(!u.data("isInitialized")){u.data("isInitialized",true).css({left:0,top:0})}var p=t.getDimensions("outer");var g=t.getOffsets("offset");var s=u.getDimensions("outer");var i=$(window).width();var d=t.find(".dropdownToggle");if(d.hasClass("dropdownCaptionTextarea")){p=d.getDimensions("outer")}var f="left";if((g.left+s.width)>i){f="right"}var j="auto";var l="auto";if(f==="left"){u.removeClass("dropdownArrowRight");j=g.left}else{u.addClass("dropdownArrowRight");l=(i-(g.left+p.width))}if(WCF.Language.get("wcf.global.pageDirection")=="rtl"){var r=j;var n=l;if(j=="auto"){u.removeClass("dropdownArrowRight")}else{l=i-(g.left+p.width);j="auto";if(l+s.width>i){j=r;l=n;u.addClass("dropdownArrowRight")}}}if(j=="auto"){l+="px"}else{j+="px"}var q=true;if(u.hasClass("dropdownOpen")){q=false;u.removeClass("dropdownOpen")}var m="auto";var v=g.top+p.height+7;if($.browser.smartphone){var f="bottom";var c=false;var e=$(window).height();var h=v+s.height;if(h>e){var b=g.top+10-s.height;if(b>=0){f="top"}else{c=true;var a=Math.abs(b);var o=Math.abs(h-e);if(o<=a){f="bottom"}else{f="top"}}}if(f=="top"){m=$(window).height()-g.top+10;v="auto";if(c){v=0;u.children("ul.scrollableDropdownMenu").css("max-height",m)}u.addClass("dropdownArrowBottom")}else{if(c){m=0;var k=u.children("ul.scrollableDropdownMenu");k.css("max-height",Math.min(k.css("max-height").replace(/px$/,""),e-v))}u.removeClass("dropdownArrowBottom")}}else{if(v+s.height>$(window).height()+$(document).scrollTop()){m=$(window).height()-g.top+10;v="auto";u.addClass("dropdownArrowBottom")}else{u.removeClass("dropdownArrowBottom")}}if(!q){u.addClass("dropdownOpen")}u.css({bottom:m,left:j,right:l,top:v})},_closeAll:function(){for(var a in this._dropdowns){var b=this._dropdowns[a];if(b.hasClass("dropdownOpen")){b.removeClass("dropdownOpen");this._menus[a].removeClass("dropdownOpen");this._notifyCallbacks(a,"close")}}},close:function(a){if(!this._dropdowns[a]){return}this._dropdowns[a].removeClass("dropdownOpen");this._menus[a].removeClass("dropdownOpen")},_notifyCallbacks:function(a,b){if(!this._callbacks[a]){return}for(var d=0,c=this._callbacks[a].length;d<c;d++){this._callbacks[a][d](a,b)}},destroy:function(a){if(this._dropdowns[a]===undefined){return false}this.close(a);this._menus[a].remove();delete this._menus[a];delete this._dropdowns[a]}};WCF.Dropdown.Interactive={};WCF.Dropdown.Interactive.Handler={_dropdownContainer:null,_dropdownMenus:{},create:function(d,b,a){if(this._dropdownContainer===null){this._dropdownContainer=$('<div class="dropdownMenuContainer" />').appendTo(document.body);WCF.CloseOverlayHandler.addCallback("WCF.Dropdown.Interactive.Handler",$.proxy(this.closeAll,this))}var c=new WCF.Dropdown.Interactive.Instance(this._dropdownContainer,d,b,a);this._dropdownMenus[b]=c;return c},open:function(a){if(this._dropdownMenus[a]){this._dropdownMenus[a].open();return true}return false},close:function(a){if(this._dropdownMenus[a]){this._dropdownMenus[a].close();return true}return false},closeAll:function(){$.each(this._dropdownMenus,function(b,a){a.close()})}};WCF.Dropdown.Interactive.Instance=Class.extend({_container:null,_itemList:null,_linkList:null,_options:{},_pointer:null,_triggerElement:null,init:function(e,d,c,b){this._options=b||{};this._triggerElement=d;var f=null;if(b.staticDropdown===true){this._container=this._triggerElement.find(".interactiveDropdownStatic:eq(0)").data("source",c).click(function(g){g.stopPropagation()})}else{this._container=$('<div class="interactiveDropdown" data-source="'+c+'" />').click(function(g){g.stopPropagation()});var a=$('<div class="interactiveDropdownHeader" />').appendTo(this._container);$('<span class="interactiveDropdownTitle">'+b.title+"</span>").appendTo(a);this._linkList=$('<ul class="interactiveDropdownLinks"></ul>').appendTo(a);f=$('<div class="interactiveDropdownItemsContainer" />').appendTo(this._container);this._itemList=$('<ul class="interactiveDropdownItems" />').appendTo(f);$('<a href="'+b.showAllLink+'" class="interactiveDropdownShowAll">'+WCF.Language.get("wcf.user.panel.showAll")+"</a>").appendTo(this._container)}this._pointer=$('<span class="pointer"><span /></span>').appendTo(this._container);if(!$.browser.mobile&&f!==null){f.perfectScrollbar({suppressScrollX:true})}this._container.appendTo(e)},getContainer:function(){return this._container},getItemList:function(){return this._itemList},getLinkList:function(){return this._linkList},open:function(){WCF.Dropdown._closeAll();this._container.addClass("open");this.render()},close:function(){this._container.removeClass("open")},toggle:function(){if(this._container.hasClass("open")){this.close();return false}else{WCF.Dropdown.Interactive.Handler.closeAll();this.open();return true}},resetItems:function(){this._itemList.empty();this.close()},render:function(){var a=WCF.Language.get("wcf.global.pageDirection");if($("html").css("caption-side")==="bottom"){this._renderMobile(a)}else{this._renderDesktop(a)}},rebuildScrollbar:function(){if(!$.browser.mobile){var a=this._itemList.parent();a.perfectScrollbar("destroy");a.perfectScrollbar({suppressScrollX:true})}},_renderMobile:function(b){var d=this._triggerElement.getDimensions("outer");var c=Math.floor(d.width/2);var e=this._triggerElement.getOffsets("offset");var a=Math.floor(this._pointer.outerWidth()/2);this._container.css({top:e.top+d.height+"px"});this._pointer.css({left:(e.left+c)-a+"px"})},_renderDesktop:function(b){var e=this._triggerElement.getDimensions("outer");var f=this._triggerElement.getOffsets("offset");var d=this._container.getDimensions();var g=$(window).width();var c=null;var a=null;if(b==="ltr"){c=this._getPositionLeft(f,d,g);if(!c.result){a=this._getPositionRight(f,d,e,g);if(a.result){c=null}else{a=null}}}else{a=this._getPositionRight(f,d,e,g);if(!a.result){c=this._getPositionLeft(f,d,g);if(c.result){a=null}else{c=null}}}if(a===null){this._container.css({left:c.left+"px",top:f.top+e.height+"px"});this._pointer.css({left:(this._options.pointerOffset?this._options.pointerOffset:"4px")})}else{this._container.css({right:a.right+"px",top:f.top+e.height+"px"});this._pointer.css({right:(this._options.pointerOffset?this._options.pointerOffset:"4px")})}},_getPositionLeft:function(d,e,b){var c=d.left;var a=d.left+e.width;return{left:c,result:(a<b)}},_getPositionRight:function(e,f,b,c){var d=(e.left+b.width)-f.width;var a=c-(e.left+b.width);return{result:(d>0),right:a}}});WCF.Clipboard={_actionProxy:null,_actionObjects:{},_containers:null,_containerData:{},_hasMarkedItems:false,_markedObjectIDs:{},_page:"",_pageObjectID:0,_proxy:null,_trackedElements:{},init:function(d,b,e,c){this._page=d;this._actionObjects=e||{};this._hasMarkedItems=(b>0);this._pageObjectID=parseInt(c)||0;this._actionProxy=new WCF.Action.Proxy({success:$.proxy(this._actionSuccess,this),url:"index.php/ClipboardProxy/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),url:"index.php/Clipboard/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._containers=$(".jsClipboardContainer").each($.proxy(function(g,f){this._initContainer(f)},this));if(this._hasMarkedItems&&this._containers.length){this._loadMarkedItems()}var a=this;WCF.DOMNodeInsertedHandler.addCallback("WCF.Clipboard",function(){a._containers=$(".jsClipboardContainer").each($.proxy(function(g,f){a._initContainer(f)},a))})},_loadMarkedItems:function(){new WCF.Action.Proxy({autoSend:true,data:{containerData:this._containerData,pageClassName:this._page,pageObjectID:this._pageObjectID},success:$.proxy(this._loadMarkedItemsSuccess,this),url:"index.php/ClipboardLoadMarkedItems/?t="+SECURITY_TOKEN+SID_ARG_2ND})},reload:function(){if(this._containers===null){return}this._loadMarkedItems()},_loadMarkedItemsSuccess:function(d,f,c){this._resetMarkings();for(var a in d.markedItems){if(!this._markedObjectIDs[a]){this._markedObjectIDs[a]=[]}var b=d.markedItems[a];for(var e in b){this._markedObjectIDs[a].push(b[e])}this._containers.each($.proxy(function(h,g){var i=$(g);if(i.data("type")!=a){return true}i.find("input.jsClipboardItem").each($.proxy(function(l,k){var j=$(k);if(WCF.inArray(j.data("objectID"),this._markedObjectIDs[a])){j.prop("checked",true);j.parents(".jsClipboardObject").addClass("jsMarked")}},this));i.find("input.jsClipboardMarkAll").each(function(l,k){var j=true;i.find("input.jsClipboardItem").each(function(n,o){var m=$(o);if(!m.prop("checked")){j=false}});if(j){$(k).prop("checked",true)}})},this))}this._success(d,f,c)},_resetMarkings:function(){this._containers.each($.proxy(function(b,a){var c=$(a);this._markedObjectIDs[c.data("type")]=[];c.find("input.jsClipboardItem, input.jsClipboardMarkAll").prop("checked",false);c.find(".jsClipboardObject").removeClass("jsMarked")},this))},_initContainer:function(a){var c=$(a);var b=c.wcfIdentify();if(!this._trackedElements[b]){c.find(".jsClipboardMarkAll").data("hasContainer",b).click($.proxy(this._markAll,this));this._markedObjectIDs[c.data("type")]=[];this._containerData[c.data("type")]={};$.each(c.data(),$.proxy(function(d,e){if(d.match(/^type(.+)/)){this._containerData[c.data("type")][WCF.String.lcfirst(d.replace(/^type/,""))]=e}},this));this._trackedElements[b]=[]}c.find("input.jsClipboardItem").each($.proxy(function(f,e){var g=$(e);var d=g.wcfIdentify();if(!WCF.inArray(d,this._trackedElements[b])){this._trackedElements[b].push(d);g.data("hasContainer",b).click($.proxy(this._click,this))}},this))},_click:function(f){var b=$(f.target);var e=b.data("objectID");var h=(b.prop("checked"))?true:false;var d=[e];if(b.data("hasContainer")){var g=$("#"+b.data("hasContainer"));var a=g.data("type")}else{var a=b.data("type")}if(h){this._markedObjectIDs[a].push(e);b.parents(".jsClipboardObject").addClass("jsMarked")}else{this._markedObjectIDs[a]=$.removeArrayValue(this._markedObjectIDs[a],e);b.parents(".jsClipboardObject").removeClass("jsMarked")}if(b.data("hasContainer")){var c=true;g.find("input.jsClipboardItem").each(function(j,i){var k=$(i);if(!k.prop("checked")){c=false}});g.find(".jsClipboardMarkAll").each(function(i,j){if(c){$(j).prop("checked",true)}else{$(j).prop("checked",false)}})}this._saveState(a,d,h)},_markAll:function(d){var b=$(d.target);var c=[];var f=true;if(b.is("input")){f=b.prop("checked")}if(b.data("hasContainer")){var e=$("#"+b.data("hasContainer"));var a=e.data("type")}else{var a=b.data("type")}if(b.data("hasContainer")){e.find("input.jsClipboardItem").each($.proxy(function(h,g){var j=$(g);var i=j.data("objectID");if(f){if(!j.prop("checked")){j.prop("checked",true);this._markedObjectIDs[a].push(i);c.push(i)}}else{if(j.prop("checked")){j.prop("checked",false);this._markedObjectIDs[a]=$.removeArrayValue(this._markedObjectIDs[a],i);c.push(i)}}},this));if(f){e.find(".jsClipboardObject").addClass("jsMarked")}else{e.find(".jsClipboardObject").removeClass("jsMarked")}}this._saveState(a,c,f)},_saveState:function(b,c,a){this._proxy.setOption("data",{action:(a)?"mark":"unmark",containerData:this._containerData,objectIDs:c,pageClassName:this._page,pageObjectID:this._pageObjectID,type:b});this._proxy.sendRequest()},_success:function(data,textStatus,jqXHR){var $containers={};$(".jsClipboardEditor").each(function(index,container){var $container=$(container);var $types=eval($container.data("types"));for(var $i=0,$length=$types.length;$i<$length;$i++){var $typeName=$types[$i];$containers[$typeName]=$container}var $containerID=$container.wcfIdentify();WCF.CloseOverlayHandler.removeCallback($containerID);$container.empty()});if(!data.items){return}for(var $typeName in data.items){if(!$containers[$typeName]){continue}var $container=$containers[$typeName];var $list=$container.children("ul");if($list.length==0){$list=$("<ul />").appendTo($container)}var $editor=data.items[$typeName];var $label=$('<li class="dropdown"><span class="dropdownToggle button">'+$editor.label+"</span></li>").appendTo($list);var $itemList=$('<ol class="dropdownMenu"></ol>').appendTo($label);for(var $itemIndex in $editor.items){var $item=$editor.items[$itemIndex];var $listItem=$("<li><span>"+$item.label+"</span></li>").appendTo($itemList);$listItem.data("container",$container);$listItem.data("objectType",$typeName);$listItem.data("actionName",$item.actionName).data("parameters",$item.parameters);$listItem.data("internalData",$item.internalData).data("url",$item.url).data("type",$typeName);$listItem.click($.proxy(this._executeAction,this))}$('<li class="dropdownDivider" />').appendTo($itemList);var $foo=$typeName;$("<li><span>"+WCF.Language.get("wcf.clipboard.item.unmarkAll")+"</span></li>").data("typeName",$typeName).appendTo($itemList).click($.proxy(function(event){var $typeName=$(event.currentTarget).data("typeName");this._proxy.setOption("data",{action:"unmarkAll",type:$typeName});this._proxy.setOption("success",$.proxy(function(data,textStatus,jqXHR){this._containers.each($.proxy(function(index,container){var $container=$(container);if($container.data("type")==$typeName){$container.find(".jsClipboardMarkAll, .jsClipboardItem").prop("checked",false);$container.find(".jsClipboardObject").removeClass("jsMarked");return false}},this));this._success(data,textStatus,jqXHR);this._proxy.setOption("success",$.proxy(this._success,this));this._loadMarkedItems()},this));this._proxy.sendRequest()},this));WCF.Dropdown.initDropdown($label.children(".dropdownToggle"),false)}},_closeLists:function(){$(".jsClipboardEditor ul").removeClass("dropdownOpen")},_executeAction:function(f){var d=$(f.currentTarget);var e=d.data("url");if(e){window.location.href=e}var a=true;if(d.data("parameters").className&&d.data("parameters").actionName){if(d.data("parameters").actionName==="unmarkAll"||d.data("parameters").objectIDs){var c=d.data("internalData")["confirmMessage"];if(c){var b=d.data("internalData")["template"];if(b){b=$(b)}WCF.System.Confirmation.show(c,$.proxy(function(h){if(h==="confirm"){var g={};if(b&&b.length){$("#wcfSystemConfirmationContent").find("input, select, textarea").each(function(j,k){var i=$(k);g[i.prop("name")]=i.val()})}this._executeAJAXActions(d,g)}},this),"",b)}else{this._executeAJAXActions(d,{})}}}else{var c=d.data("internalData")["confirmMessage"];if(c){a=false;WCF.System.Confirmation.show(c,function(g){if(g==="confirm"){d.data("container").trigger("clipboardAction",[d.data("type"),d.data("actionName"),d.data("parameters")])}})}}if(a){d.data("container").trigger("clipboardAction",[d.data("type"),d.data("actionName"),d.data("parameters")])}},_executeAJAXActions:function(d,e){e=e||{};var a=[];if(d.data("parameters").actionName!=="unmarkAll"){$.each(d.data("parameters").objectIDs,function(g,h){a.push(parseInt(h))})}var b={data:e,containerData:this._containerData[d.data("type")]};var f=d.data("internalData")["parameters"];if(f!==undefined){for(var c in f){b[c]=f[c]}}new WCF.Action.Proxy({autoSend:true,data:{actionName:d.data("parameters").actionName,className:d.data("parameters").className,objectIDs:a,parameters:b},success:$.proxy(function(g){if(d.data("parameters").actionName!=="unmarkAll"){d.data("container").trigger("clipboardActionResponse",[g,d.data("type"),d.data("actionName"),d.data("parameters")])}this._loadMarkedItems()},this)});if(this._actionObjects[d.data("objectType")]&&this._actionObjects[d.data("objectType")][d.data("parameters").actionName]){this._actionObjects[d.data("objectType")][d.data("parameters").actionName].triggerEffect(a)}},sendRequest:function(b){var a=$(b);this._actionProxy.setOption("data",{parameters:a.data("parameters"),typeName:a.data("type")});this._actionProxy.sendRequest()}};WCF.PeriodicalExecuter=Class.extend({_callback:null,_delay:0,_intervalID:null,_isExecuting:false,init:function(b,a){if(!$.isFunction(b)){console.debug("[WCF.PeriodicalExecuter] Given callback is invalid, aborting.");return}this._callback=b;this._interval=a;this.resume()},_execute:function(){if(!this._isExecuting){try{this._isExecuting=true;this._callback(this);this._isExecuting=false}catch(a){this._isExecuting=false;throw a}}},stop:function(){if(!this._intervalID){return}clearInterval(this._intervalID)},resume:function(){this.restart()},restart:function(){if(this._intervalID){this.stop()}this._intervalID=setInterval($.proxy(this._execute,this),this._interval)},setInterval:function(a){this._interval=a;this.restart()}});WCF.LoadingOverlayHandler={_activeRequests:0,_loadingOverlay:null,_pending:null,show:function(){if(this._loadingOverlay===null){this._loadingOverlay=$('<div class="spinner"><span class="icon icon48 icon-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></div>").appendTo($("body"));var b=this._loadingOverlay.outerWidth();if(b<70){b=70}this._loadingOverlay.css({marginLeft:Math.ceil(-1*b/2),width:b}).hide()}this._activeRequests++;if(this._activeRequests==1){if(this._pending===null){var a=this;this._pending=new WCF.PeriodicalExecuter(function(c){if(a._activeRequests){a._loadingOverlay.stop(true,true).fadeIn(100)}c.stop();a._pending=null},250)}}},hide:function(){this._activeRequests--;if(this._activeRequests==0){if(this._pending!==null){this._pending.stop();this._pending=null}this._loadingOverlay.stop(true,true).fadeOut(100)}},updateIcon:function(b,c){var a=(c===undefined||c?"addClass":"removeClass");b.find(".icon")[a]("icon-spinner");if(b.hasClass("icon")){b[a]("icon-spinner")}}};WCF.Action={};WCF.Action.Proxy=Class.extend({_showLoadingOverlayOnce:false,_suppressErrors:false,_lastRequest:null,init:function(b){this.options=$.extend(true,{autoSend:false,data:{},dataType:"json",after:null,init:null,jsonp:"callback",async:true,failure:null,showLoadingOverlay:true,success:null,suppressErrors:false,type:"POST",url:"index.php/AJAXProxy/?t="+SECURITY_TOKEN+SID_ARG_2ND,aborted:null,autoAbortPrevious:false},b);this.options.url=WCF.convertLegacyURL(this.options.url);this.confirmationDialog=null;this.loading=null;this._showLoadingOverlayOnce=false;this._suppressErrors=(this.options.suppressErrors===true);if(this.options.autoSend){this.sendRequest()}var a=this;$(window).on("beforeunload",function(){a._suppressErrors=true})},sendRequest:function(a){this._init();if(a||this.options.autoAbortPrevious){this.abortPrevious()}this._lastRequest=$.ajax({data:this.options.data,dataType:this.options.dataType,jsonp:this.options.jsonp,async:this.options.async,type:this.options.type,url:this.options.url,success:$.proxy(this._success,this),error:$.proxy(this._failure,this)});return this._lastRequest},abortPrevious:function(){if(this._lastRequest!==null){this._lastRequest.abort();this._lastRequest=null;if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.hide()}}},showLoadingOverlayOnce:function(){this._showLoadingOverlayOnce=true},suppressErrors:function(){this._suppressErrors=true},_init:function(){if($.isFunction(this.options.init)){this.options.init(this)}if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.show()}},_failure:function(d,i,h){if(i=="abort"){if($.isFunction(this.options.aborted)){this.options.aborted(d)}return}try{var c=$.parseJSON(d.responseText);var f=true;if($.isFunction(this.options.failure)){f=this.options.failure(c,d,i,h)}if(!this._suppressErrors&&f!==false){var a="";if(c.stacktrace){a="<br /><p>Stacktrace:</p><p>"+c.stacktrace+"</p>"}else{if(c.exceptionID){a="<br /><p>Exception ID: <code>"+c.exceptionID+"</code></p>"}}$('<div class="ajaxDebugMessage"><p>'+c.message+"</p>"+a+"</div>").wcfDialog({title:WCF.Language.get("wcf.global.error.title")})}}catch(g){var f=true;if($.isFunction(this.options.failure)){f=this.options.failure(null,d,i,h)}if(!this._suppressErrors&&f!==false){var b=(i==="timeout")?WCF.Language.get("wcf.global.error.timeout"):d.responseText;if(b&&b!="undefined"){$('<div class="ajaxDebugMessage"><p>'+b+"</p></div>").wcfDialog({title:WCF.Language.get("wcf.global.error.title")})}}}this._after()},_success:function(b,c,a){if($.isFunction(this.options.success)){if(b&&b.returnValues&&b.returnValues.template!==undefined){b.returnValues.template=$.trim(b.returnValues.template)}this.options.success(b,c,a)}this._after()},_after:function(){this._lastRequest=null;if($.isFunction(this.options.after)){this.options.after()}if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.hide();if(this._showLoadingOverlayOnce){this._showLoadingOverlayOnce=false}}WCF.DOMNodeInsertedHandler.execute();$("a[href*=#]").each(function(c,e){var b=$(e);if(b.prop("href").indexOf("AJAXProxy")!=-1){var d=b.prop("href").substr(b.prop("href").indexOf("#"));var a=document.location.toString().replace(/#.*/,"");b.prop("href",a+d)}})},setOption:function(a,b){this.options[a]=b}});WCF.Action.SimpleProxy=Class.extend({init:function(a,b){this.options=$.extend(true,{action:"",className:"",elements:null,eventName:"click"},a);this.callbacks=$.extend(true,{after:null,failure:null,init:null,success:null},b);if(!this.options.elements){return}this.proxy=new WCF.Action.Proxy(this.callbacks);this.options.elements.each($.proxy(function(c,d){$(d).bind(this.options.eventName,$.proxy(this._handleEvent,this))},this))},_handleEvent:function(a){this.proxy.setOption("data",{actionName:this.options.action,className:this.options.className,objectIDs:[$(a.target).data("objectID")]});this.proxy.sendRequest()}});WCF.Action.Delete=Class.extend({_buttonSelector:"",_className:"",_containerSelector:"",_containers:[],init:function(c,a,b){this._containerSelector=a;this._className=c;this._buttonSelector=(b)?b:".jsDeleteButton";this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initElements();WCF.DOMNodeInsertedHandler.addCallback("WCF.Action.Delete"+this._className.hashCode(),$.proxy(this._initElements,this))},_initElements:function(){$(this._containerSelector).each((function(b,a){var d=$(a);var c=d.wcfIdentify();if(!WCF.inArray(c,this._containers)){var e=d.find(this._buttonSelector);if(e.length){this._containers.push(c);e.click($.proxy(this._click,this))}}}).bind(this))},_click:function(b){var a=$(b.currentTarget);b.preventDefault();if(a.data("confirmMessage")){WCF.System.Confirmation.show(a.data("confirmMessage"),$.proxy(this._execute,this),{target:a})}else{WCF.LoadingOverlayHandler.updateIcon(a);this._sendRequest(a)}},_didTriggerEffect:function(a){},_execute:function(b,a){if(b==="cancel"){return}WCF.LoadingOverlayHandler.updateIcon(a.target);this._sendRequest(a.target)},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"delete",className:this._className,interfaceName:"wcf\\data\\IDeleteAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){this.triggerEffect(b.objectIDs)},triggerEffect:function(d){for(var a in this._containers){var e=$("#"+this._containers[a]);var c=e.find(this._buttonSelector);if(WCF.inArray(c.data("objectID"),d)){var b=this;e.wcfBlindOut("up",function(){var f=$(this).remove();b._containers.splice(b._containers.indexOf(f.wcfIdentify()),1);b._didTriggerEffect(f);if(c.data("eventName")){WCF.System.Event.fireEvent("com.woltlab.wcf.action.delete",c.data("eventName"),{button:c,container:f})}})}}}});WCF.Action.NestedDelete=WCF.Action.Delete.extend({triggerEffect:function(c){for(var a in this._containers){var d=$("#"+this._containers[a]);if(WCF.inArray(d.find(this._buttonSelector).data("objectID"),c)){if(d.has("ol").has("li").length){if(d.is(":only-child")){d.parent().replaceWith(d.find("> ol"))}else{d.replaceWith(d.find("> ol > li"))}this._containers.splice(this._containers.indexOf(d.wcfIdentify()),1);this._didTriggerEffect(d)}else{var b=this;d.wcfBlindOut("up",function(){$(this).remove();b._containers.splice(b._containers.indexOf($(this).wcfIdentify()),1);b._didTriggerEffect($(this))})}}}}});WCF.Action.Toggle=Class.extend({_buttonSelector:".jsToggleButton",_className:"",_containerSelector:"",_containers:[],init:function(d,a,c){this._containerSelector=a;this._className=d;this._buttonSelector=(c)?c:".jsToggleButton";this._containers=[];var b={success:$.proxy(this._success,this)};this.proxy=new WCF.Action.Proxy(b);this._initElements();WCF.DOMNodeInsertedHandler.addCallback("WCF.Action.Toggle"+this._className.hashCode(),$.proxy(this._initElements,this))},_initElements:function(){$(this._containerSelector).each($.proxy(function(b,a){var d=$(a);var c=d.wcfIdentify();if(!WCF.inArray(c,this._containers)){this._containers.push(c);d.find(this._buttonSelector).click($.proxy(this._click,this))}},this))},_click:function(b){var a=$(b.currentTarget);b.preventDefault();if(a.data("confirmMessage")){WCF.System.Confirmation.show(a.data("confirmMessage"),$.proxy(this._execute,this),{target:a})}else{WCF.LoadingOverlayHandler.updateIcon(a);this._sendRequest(a)}},_execute:function(b,a){if(b==="cancel"){return}WCF.LoadingOverlayHandler.updateIcon(a.target);this._sendRequest(a.target)},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"toggle",className:this._className,interfaceName:"wcf\\data\\IToggleAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){this.triggerEffect(b.objectIDs)},triggerEffect:function(b){for(var a in this._containers){var d=$("#"+this._containers[a]);var c=d.find(this._buttonSelector);if(WCF.inArray(c.data("objectID"),b)){d.wcfHighlight();this._toggleButton(d,c)}}},_toggleButton:function(c,b){var a="";WCF.LoadingOverlayHandler.updateIcon(b,false);if(b.hasClass("icon-check-empty")){b.removeClass("icon-check-empty").addClass("icon-check");a=(b.data("disableTitle")?b.data("disableTitle"):WCF.Language.get("wcf.global.button.disable"));b.attr("title",a)}else{b.removeClass("icon-check").addClass("icon-check-empty");a=(b.data("enableTitle")?b.data("enableTitle"):WCF.Language.get("wcf.global.button.enable"));b.attr("title",a)}c.toggleClass("disabled")}});WCF.Action.Scroll=Class.extend({_callback:null,_reference:null,_target:null,_threshold:0,init:function(b,d,a,c){this._threshold=parseInt(b);if(this._threshold===0){console.debug("[WCF.Action.Scroll] Given threshold is invalid, aborting.");return}if($.isFunction(d)){this._callback=d}if(this._callback===null){console.debug("[WCF.Action.Scroll] Given callback is invalid, aborting.");return}this._reference=$((a)?a:window);this._target=$((c)?c:document);this.start();this._scroll()},_scroll:function(){var a=this._target.height();var b=this._reference.scrollTop();var c=this._reference.height();if((a-(c+b))<this._threshold){this._callback(this)}},start:function(){this._reference.on("scroll",$.proxy(this._scroll,this))},stop:function(){this._reference.off("scroll")}});WCF.Date={};WCF.Date.Picker={_dateFormat:"yy-mm-dd",_timeFormat:"g:ia",init:function(){var a=$.timepicker.log;$.timepicker.log=function(b){if(b.indexOf("Error parsing the date/time string: Unexpected literal at position")==-1&&b.indexOf("Error parsing the date/time string: Unknown name at position")==-1){a(b)}};this._convertDateFormat();this._initDatePicker();WCF.DOMNodeInsertedHandler.addCallback("WCF.Date.Picker",$.proxy(this._initDatePicker,this))},_convertDateFormat:function(){var a={a:"tt",A:"TT",g:"h",G:"H",h:"hh",H:"HH",i:"mm",s:"ss",u:"l",d:"dd",D:"D",j:"d",l:"DD",z:"o",S:"",F:"MM",m:"mm",M:"M",n:"m",o:"yy",Y:"yy",y:"y",U:"@"};this._dateFormat=WCF.Language.get("wcf.date.dateFormat").replace(/([^dDjlzSFmMnoYyU\\]*(?:\\.[^dDjlzSFmMnoYyU\\]*)*)([dDjlzSFmMnoYyU])/g,function(c,f,e,g,b){for(var d in a){if(e==d){e=a[d]}}return f+e});this._timeFormat=WCF.Language.get("wcf.date.timeFormat").replace(/([^aAgGhHisu\\]*(?:\\.[^aAgGhHisu\\]*)*)([aAgGhHisu])/g,function(c,f,e,g,b){for(var d in a){if(e==d){e=a[d]}}return f+e})},_initDatePicker:function(){$("input[type=date]:not(.jsDatePicker), input[type=datetime]:not(.jsDatePicker)").each($.proxy(function(g,j){var i=$(j);var d=i.prop("name");var m=i.val();var b=i.attr("type")=="datetime";i.prop("type","text").addClass("jsDatePicker");if(i.data("placeholder")){i.attr("placeholder",i.data("placeholder"))}i.removeAttr("name");i.before('<input type="hidden" id="'+i.wcfIdentify()+'DatePicker" name="'+d+'" value="'+m+'" />');var f=i.attr("max")?new Date(i.attr("max").replace(" ","T")):null;var n=i.attr("min")?new Date(i.attr("min").replace(" ","T")):null;var c={altField:"#"+i.wcfIdentify()+"DatePicker",altFormat:"yy-mm-dd",beforeShow:function(q,p){setTimeout(function(){p.dpDiv.position({my:"left top",at:"left bottom",collision:"none",of:q})},1)},changeMonth:true,changeYear:true,dateFormat:this._dateFormat,dayNames:WCF.Language.get("__days"),dayNamesMin:WCF.Language.get("__daysShort"),dayNamesShort:WCF.Language.get("__daysShort"),firstDay:parseInt(WCF.Language.get("wcf.date.firstDayOfTheWeek"))||0,isRTL:WCF.Language.get("wcf.global.pageDirection")=="rtl",maxDate:f,minDate:n,monthNames:WCF.Language.get("__months"),monthNamesShort:WCF.Language.get("__monthsShort"),showButtonPanel:false,onClose:function(q,p){if(q==""){$(p.settings.altField).val(q)}},showOtherMonths:true,yearRange:(i.hasClass("birthday")?"-100:+0":"1900:2038")};if(b){if(/[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(m)){m=m.replace(/:[0-9]{2}$/,"");i.val(m)}m=m.replace(" ","T");if(i.data("timeOnly")){var e=m.split(":");var a=new Date();a.setHours(e[0]);a.setMinutes(e[1]);a.setSeconds(0);m=a.toString()}if(i.data("ignoreTimezone")){var l=new Date(m).getTimezoneOffset();var o=(l>0)?"-":"+";l=Math.abs(l);var h=(Math.floor(l/60)).toString();var k=(l%60).toString();o+=(h.length==2)?h:"0"+h;o+=":";o+=(k.length==2)?k:"0"+k;m=m.replace(/[+-][0-9]{2}:[0-9]{2}$/,o)}c=$.extend(c,{altFieldTimeOnly:false,altTimeFormat:"HH:mm",controlType:"select",hourText:WCF.Language.get("wcf.date.hour"),minuteText:WCF.Language.get("wcf.date.minute"),showTime:false,timeFormat:this._timeFormat,timeOnly:i.data("timeOnly")?true:false,yearRange:(i.hasClass("birthday")?"-100:+0":"1900:2038")})}if(b){i.datetimepicker(c)}else{i.datepicker(c)}if(m){m=new Date(m);if(!b){m.setMinutes(m.getMinutes()+m.getTimezoneOffset())}i.datepicker("setDate",m)}i.datepicker("widget").hide();if(i.data("timeOnly")){i.datepicker("widget").addClass("timeOnlyPicker")}},this))}};WCF.Date.Util={gmdate:function(a){var b=(a)?a:new Date();return Math.round(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDay(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds())/1000)},getTimezoneDate:function(b,c){var d=new Date(b);var a=d.getTimezoneOffset()*60000;return new Date((b+a+c))}};WCF.Date.Time=Class.extend({_date:0,_elements:null,_offset:null,_timestamp:0,init:function(){this._elements=$("time.datetime");this._offset=null;this._timestamp=0;this._refresh();new WCF.PeriodicalExecuter($.proxy(this._refresh,this),60000);WCF.DOMNodeInsertedHandler.addCallback("WCF.Date.Time",$.proxy(this._domNodeInserted,this))},_domNodeInserted:function(){this._elements=$("time.datetime");this._refresh()},_refresh:function(){this._date=new Date();this._timestamp=(this._date.getTime()-this._date.getMilliseconds())/1000;if(this._offset===null){this._offset=this._timestamp-TIME_NOW}this._elements.each($.proxy(this._refreshElement,this))},_refreshElement:function(i,f){var n=$(f);if(!n.attr("title")){n.attr("title",n.text())}var d=n.data("timestamp")+this._offset;var b=n.data("date");var c=n.data("time");var o=n.data("offset");if(n.data("isFutureDate")){return}if(d>=this._timestamp||this._timestamp<(d+60)){n.text(WCF.Language.get("wcf.date.relative.now"))}else{if(this._timestamp<(d+3540)){var m=Math.max(Math.round((this._timestamp-d)/60),1);n.text(WCF.Language.get("wcf.date.relative.minutes",{minutes:m}))}else{if(this._timestamp<(d+86400)){var k=Math.round((this._timestamp-d)/3600);n.text(WCF.Language.get("wcf.date.relative.hours",{hours:k}))}else{if(this._timestamp<(d+518400)){var j=new Date(this._date.getFullYear(),this._date.getMonth(),this._date.getDate());var l=Math.ceil((j/1000-d)/86400);var g=WCF.Date.Util.getTimezoneDate((d*1000),o*1000);var h=g.getDay();var e=WCF.Language.get("__days")[h];n.text(WCF.Language.get("wcf.date.relative.pastDays",{days:l,day:e,time:c}))}else{var a=WCF.Language.get("wcf.date.shortDateTimeFormat");n.text(a.replace(/\%date\%/,b).replace(/\%time\%/,c))}}}}}});WCF.Dictionary=Class.extend({_variables:{},init:function(){this._variables={}},add:function(a,b){this._variables[a]=b},addObject:function(a){for(var b in a){this.add(b,a[b])}},addDictionary:function(a){a.each($.proxy(function(b){this.add(b.key,b.value)},this))},get:function(a){if(this.isset(a)){return this._variables[a]}return null},isset:function(a){return this._variables.hasOwnProperty(a)},remove:function(a){delete this._variables[a]},each:function(d){if(!$.isFunction(d)){return}for(var c in this._variables){var a=this._variables[c];var b={key:c,value:a};d(b)}},count:function(){return $.getLength(this._variables)},isEmpty:function(){return !this.count()}});WCF.Language={_variables:new WCF.Dictionary(),add:function(a,b){this._variables.add(a,b)},addObject:function(a){this._variables.addObject(a)},get:function(a,b){if(b==null){var b={}}var c=this._variables.get(a);if(c===null){return a}else{if(typeof c==="string"){this.add(a,new WCF.Template(c));return this.get(a,b)}else{if(typeof c.fetch==="function"){c=c.fetch(b)}}}return c}};WCF.MultipleLanguageInput=Class.extend({_availableLanguages:{},_button:null,_didInit:false,_element:null,_insertedDataAfterInit:false,_isEnabled:false,_forceSelection:false,_languageID:0,_list:null,_values:null,init:function(c,b,d,f){this._button=null;this._element=$("#"+$.wcfEscapeID(c));this._forceSelection=b;this._values=d;this._availableLanguages=f;if($.getLength(this._values)){for(var e in this._values){this._values[e]=WCF.String.unescapeHTML(this._values[e])}}this._languageID=LANGUAGE_ID;if(this._element.length==0){console.debug("[WCF.MultipleLanguageInput] element id '"+c+"' is unknown");return}var a=($.getLength(this._values)>0)?true:false;this._insertedDataAfterInit=a;this._prepareElement(a);this._element.parents("form").submit($.proxy(this._submit,this));this._didInit=true},_prepareElement:function(a){this._element.wrap('<div class="dropdown preInput" />');var c=this._element.parent();this._button=$('<p class="button dropdownToggle"><span>'+WCF.Language.get("wcf.global.button.disabledI18n")+"</span></p>").prependTo(c);this._list=$('<ul class="dropdownMenu"></ul>').insertAfter(this._button);if(this._button.nextAll("textarea").length){this._button.addClass("dropdownCaptionTextarea")}else{this._button.addClass("dropdownCaption")}for(var b in this._availableLanguages){$("<li><span>"+this._availableLanguages[b]+"</span></li>").data("languageID",b).click($.proxy(this._changeLanguage,this)).appendTo(this._list)}if(!this._forceSelection){$('<li class="dropdownDivider" />').appendTo(this._list);$("<li><span>"+WCF.Language.get("wcf.global.button.disabledI18n")+"</span></li>").click($.proxy(this._disable,this)).appendTo(this._list)}WCF.Dropdown.initDropdown(this._button,a);if(a||this._forceSelection){this._isEnabled=true;this._list.children("li").each($.proxy(function(d,f){var e=$(f);if(e.data("languageID")==this._languageID){e.trigger("click")}},this))}WCF.Dropdown.registerCallback(c.wcfIdentify(),$.proxy(this._handleAction,this))},_handleAction:function(a,b){if(b==="open"){this._enable()}else{this._closeSelection()}},_enable:function(a){if(!this._isEnabled){var b=(this._button.is("p"))?this._button.children("span:eq(0)"):this._button;b.addClass("active");this._isEnabled=true}if(this._list.is(":visible")){this._showSelection()}},_showSelection:function(){if(this._isEnabled){this._list.children("li").each($.proxy(function(b,d){var c=$(d);var a=c.data("languageID");if(a){if(this._values[a]&&this._values[a]!=""){c.removeClass("missingValue")}else{c.addClass("missingValue")}}},this))}},_closeSelection:function(){this._disable()},_changeLanguage:function(a){var b=$(a.currentTarget);this._insertedDataAfterInit=true;if(this._didInit){this._values[this._languageID]=this._element.val()}this._languageID=b.data("languageID");if(this._values[this._languageID]){this._element.val(this._values[this._languageID])}else{this._element.val("")}this._list.children("li").removeClass("active");b.addClass("active");this._button.children("span").addClass("active").text(this._availableLanguages[this._languageID]);if(this._didInit){this._element.blur().focus()}},_disable:function(a){if(a===undefined&&this._insertedDataAfterInit){a=null}if(this._forceSelection||!this._list||a===null){return}this._button.children("span").removeClass("active").text(WCF.Language.get("wcf.global.button.disabledI18n"));if(this._values[LANGUAGE_ID]){this._element.val(this._values[LANGUAGE_ID])}else{this._element.val()}if(a){this._list.children("li").removeClass("active");$(a.currentTarget).addClass("active")}this._element.blur().focus();this._insertedDataAfterInit=false;this._isEnabled=false;this._values={}},_submit:function(){if(!this._isEnabled){return 3735928559}if(this._languageID){this._values[this._languageID]=this._element.val()}var b=$(this._element.parents("form")[0]);var c=this._element.wcfIdentify();for(var a in this._availableLanguages){if(this._values[a]===undefined){this._values[a]=""}$('<input type="hidden" name="'+c+"_i18n["+a+']" value="'+WCF.String.escapeHTML(this._values[a])+'" />').appendTo(b)}this._element.removeAttr("name")}});WCF.Number={round:function(b,a){a=Math.pow(10,(a||0));return Math.round(b*a)/a}};WCF.String={addThousandsSeparator:function(a){return String(a).replace(/(^-?\d{1,3}|\d{3})(?=(?:\d{3})+(?:$|\.))/g,"$1"+WCF.Language.get("wcf.global.thousandsSeparator"))},escapeHTML:function(a){return String(a).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},escapeRegExp:function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},formatNumeric:function(b,a){b=String(WCF.Number.round(b,a||2));var c=b.split(".");b=this.addThousandsSeparator(c[0]);if(c.length>1){b+=WCF.Language.get("wcf.global.decimalPoint")+c[1]}b=b.replace("-","\u2212");return b},lcfirst:function(a){return String(a).substring(0,1).toLowerCase()+a.substring(1)},ucfirst:function(a){return String(a).substring(0,1).toUpperCase()+a.substring(1)},unescapeHTML:function(a){return String(a).replace(/&/g,"&").replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">")}};WCF.TabMenu={_containers:{},_didInit:false,init:function(){var d=$(".tabMenuContainer:not(.staticTabMenuContainer)");var c=this;d.each(function(f,e){var h=$(e);var g=h.wcfIdentify();if(c._containers[g]){return true}if(h.data("store")&&!$("#"+h.data("store")).length){$('<input type="hidden" name="'+h.data("store")+'" value="" id="'+h.data("store")+'" />').appendTo(h.parents("form").find(".formSubmit"))}c._containers[g]=h;h.wcfTabs({active:false,activate:function(j,i){var l=$(i.newPanel);var k=l.closest(".tabMenuContainer");var m=k;while(true){if(m.data("isParent")===undefined){break}if(m.data("isParent")){if(m.data("store")){$("#"+m.data("store")).val(l.attr("id"))}break}else{m=m.data("parent")}}if(WCF.TabMenu._didInit){if(l.data("inTabMenu")==undefined){l.data("inTabMenu",(l.parents(".dialogContainer").length))}if(!l.data("inTabMenu")){if(window.history){window.history.pushState(null,document.title,window.location.toString().replace(/#.+$/,"")+"#"+l.attr("id"))}else{location.hash="#"+l.attr("id")}}}}});h.data("isParent",(h.children(".tabMenuContainer, .tabMenuContent").length>0)).data("parent",false);if(!h.data("isParent")){if(h.parent().hasClass("tabMenuContainer")){h.data("parent",h.parent())}}});if(!this._didInit){this._selectActiveTab();$(window).bind("hashchange",$.proxy(this.selectTabs,this));if(!this._selectErroneousTab()){this.selectTabs()}if($.browser.mozilla&&location.hash){var a=$(location.hash);if(a.length&&a.hasClass("tabMenuContent")){var b=a.offset();window.scrollTo(b.left,b.top)}}}this._didInit=true},reload:function(){this._containers={};this.init()},_selectErroneousTab:function(){var d=false;for(var a in this._containers){var c=this._containers[a];if(c.find(".formError").length){d=true;if(!c.data("isParent")){while(true){if(c.data("parent")===false){break}c=c.data("parent").wcfTabs("selectTab",c.wcfIdentify())}return true}}}if(d){for(var a in this._containers){var c=this._containers[a];var b=c.find(".formError:eq(0)");if(b.length){c.wcfTabs("selectTab",b.parents(".tabMenuContent").wcfIdentify());while(true){if(c.data("parent")===false){break}c=c.data("parent").wcfTabs("selectTab",c.wcfIdentify())}return true}}}return false},_selectActiveTab:function(){for(var b in this._containers){var e=this._containers[b];if(e.data("active")){var a=e.data("active");var d=null;if(/-/.test(a)){var c=a.split("-");a=c[0];d=c[1]}e.find(".tabMenuContent").each(function(h,g){var f=$(g);if(f.wcfIdentify()==a){e.wcfTabs("select",h);if(d!==null){if(f.hasClass("tabMenuContainer")){f.wcfTabs("selectTab",e.data("active"))}else{e.wcfTabs("selectTab",e.data("active"))}}return false}})}}},selectTabs:function(){if(location.hash){var a=location.hash.substr(1);var b=$("#"+$.wcfEscapeID(a));if(b.length===1&&b.hasClass("ui-tabs-panel")){b=b.parent(".ui-tabs");if(b.length){b.wcfTabs("selectTab",a);if(b.hasClass("ui-tabs-panel")){a=b.wcfIdentify();b=b.parent(".ui-tabs");if(b.length){b.wcfTabs("selectTab",a)}}return true}}}return false}};WCF.Template=Class.extend({init:function(d){var f=new WCF.Dictionary();var a=0;d=d.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/(\r\n|\n|\r)/g,"\\n");d=d.replace(/\{literal\}(.*?)\{\/literal\}/g,$.proxy(function(e){var i="@@@@@@@@@@@"+Math.random()+"@@@@@@@@@@@";f.add(i,e.replace(/\{\/?literal\}/g,""));return i},this));d=d.replace(/\{\*.*?\*\}/g,"");var c=function(q){var l=q.split("");var i={};var k=true;var s="";var o="";var m=false;var n=false;var j=false;for(var p=0,e=l.length;p<e;p++){var r=l[p];if(k&&r!="="&&r!=" "){s+=r}else{if(k&&r=="="){k=false;n=false;m=false;j=false}else{if(!k&&!n&&!m&&r==" "){k=true;i[s]=o;o=s=""}else{if(!k&&n&&!j&&r=="'"){n=false;o+=r}else{if(!k&&!n&&!m&&r=="'"){n=true;o+=r}else{if(!k&&m&&!j&&r=='"'){m=false;o+=r}else{if(!k&&!n&&!m&&r=='"'){m=true;o+=r}else{if(!k&&(m||n)&&!j&&r=="\\"){j=true;o+=r}else{if(!k){j=false;o+=r}}}}}}}}}}i[s]=o;if(m||n||j){throw new Error('Syntax error in parameterList: "'+q+'"')}return i};var h=function(e){return e.replace(/\\n/g,"\n").replace(/\\\\/g,"\\").replace(/\\'/g,"'")};d=d.replace(/\{(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + WCF.String.escapeHTML("+i+") + '"}).replace(/\{#(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + WCF.String.formatNumeric("+i+") + '"}).replace(/\{@(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + "+i+" + '"}).replace(/\{lang\}(.+?)\{\/lang\}/g,function(e,i){return"' + WCF.Language.get('"+i+"', v) + '"}).replace(/\{include (.+?)\}/g,function(e,j){j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.file==="undefined"){throw new Error("Missing file attribute in include-tag")}i.file=i.file.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"' + "+i.file+".fetch(v) + '"}).replace(/\{if (.+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"';\nif ("+i+") {\n $output += '"}).replace(/\{else ?if (.+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"';\n}\nelse if ("+i+") {\n $output += '"}).replace(/\{implode (.+?)\}/g,function(e,j){a++;j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.from==="undefined"){throw new Error("Missing from attribute in implode-tag")}if(typeof i.item==="undefined"){throw new Error("Missing item attribute in implode-tag")}if(typeof i.glue==="undefined"){i.glue="', '"}i.from=i.from.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"';\nvar $implode_"+a+" = false;\nfor ($implodeKey_"+a+" in "+i.from+") {\n v["+i.item+"] = "+i.from+"[$implodeKey_"+a+"];\n"+(typeof i.key!=="undefined"?" v["+i.key+"] = $implodeKey_"+a+";\n":"")+" if ($implode_"+a+") $output += "+i.glue+";\n $implode_"+a+" = true;\n $output += '"}).replace(/\{foreach (.+?)\}/g,function(e,j){a++;j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.from==="undefined"){throw new Error("Missing from attribute in foreach-tag")}if(typeof i.item==="undefined"){throw new Error("Missing item attribute in foreach-tag")}i.from=i.from.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"';\n$foreach_"+a+" = false;\nfor ($foreachKey_"+a+" in "+i.from+") {\n $foreach_"+a+" = true;\n break;\n}\nif ($foreach_"+a+") {\n for ($foreachKey_"+a+" in "+i.from+") {\n v["+i.item+"] = "+i.from+"[$foreachKey_"+a+"];\n"+(typeof i.key!=="undefined"?" v["+i.key+"] = $foreachKey_"+a+";\n":"")+" $output += '"}).replace(/\{foreachelse\}/g,"';\n }\n}\nelse {\n {\n $output += '").replace(/\{\/foreach\}/g,"';\n }\n}\n$output += '").replace(/\{else\}/g,"';\n}\nelse {\n $output += '").replace(/\{\/(if|implode)\}/g,"';\n}\n$output += '");for(var b in WCF.Template.callbacks){d=WCF.Template.callbacks[b](d)}d=d.replace("{ldelim}","{").replace("{rdelim}","}");f.each(function(e){d=d.replace(e.key,e.value)});d="$output += '"+d+"';";try{this.fetch=new Function("v","v = window.$.extend({}, v, { __wcf: window.WCF, __window: window }); var $output = ''; "+d+" return $output;")}catch(g){console.debug("var $output = ''; "+d+" return $output;");throw g}},fetch:function(a){}});WCF.Template.callbacks=[];WCF.ToggleOptions=Class.extend({_element:null,_showItems:[],_hideItems:[],_callback:null,init:function(c,a,b,d){this._element=$("#"+c);this._showItems=a;this._hideItems=b;if(d!==undefined){this._callback=d}this._element.click($.proxy(this._toggle,this));this._toggle()},_toggle:function(){if(!this._element.prop("checked")){return}for(var c=0,b=this._showItems.length;c<b;c++){var a=this._showItems[c];$("#"+a).show()}for(var c=0,b=this._hideItems.length;c<b;c++){var a=this._hideItems[c];$("#"+a).hide()}if(this._callback!==null){this._callback()}}});WCF.Collapsible={};WCF.Collapsible.Simple={init:function(){$(".jsCollapsible").each($.proxy(function(a,b){this._initButton(b)},this))},_initButton:function(a){var c=$(a);var b=c.data("isOpen");if(!b){$("#"+c.data("collapsibleContainer")).hide()}c.click($.proxy(this._toggle,this))},_toggle:function(b){var d=$(b.currentTarget);var c=d.data("isOpen");var a=$("#"+$.wcfEscapeID(d.data("collapsibleContainer")));if(c){a.stop().wcfBlindOut("vertical",$.proxy(function(){this._toggleImage(d)},this));c=false}else{a.stop().wcfBlindIn("vertical",$.proxy(function(){this._toggleImage(d)},this));c=true}d.data("isOpen",c);b.stopPropagation();return false},_toggleImage:function(b){var a=b.find("span.icon");if(b.data("isOpen")){a.removeClass("icon-chevron-right").addClass("icon-chevron-down")}else{a.removeClass("icon-chevron-down").addClass("icon-chevron-right")}}};WCF.Collapsible.Remote=Class.extend({_className:"",_containers:{},_containerData:{},_proxy:null,init:function(a){this._className=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._init();WCF.DOMNodeInsertedHandler.addCallback("WCF.Collapsible.Remote",$.proxy(this._init,this))},_init:function(a){this._getContainers().each($.proxy(function(c,b){var e=$(b);var d=e.wcfIdentify();if(this._containers[d]===undefined){this._containers[d]=e;this._initContainer(d)}},this))},_initContainer:function(b){var a=this._getTarget(b);var c=this._getButtonContainer(b);var d=this._createButton(b,c);this._containerData[b]={button:d,buttonContainer:c,isOpen:this._containers[b].data("isOpen"),target:a};if(!this._containers[b].data("isOpen")){$("#"+b).addClass("jsCollapsed")}},_getContainers:function(){},_getTarget:function(a){},_getButtonContainer:function(a){},_createButton:function(a,b){var d=this._containers[a].data("isOpen");var c=$('<span class="collapsibleButton jsTooltip pointer icon icon16 icon-'+(d?"chevron-down":"chevron-right")+'" title="'+WCF.Language.get("wcf.global.button.collapsible")+'">').prependTo(b);c.data("containerID",a).click($.proxy(this._toggleContainer,this));return c},_toggleContainer:function(d){var f=$(d.currentTarget);var b=f.data("containerID");var e=this._containerData[b].isOpen;var a=(e)?"open":"close";var c=(e)?"close":"open";this._proxy.setOption("data",{actionName:"loadContainer",className:this._className,interfaceName:"wcf\\data\\ILoadableContainerAction",objectIDs:[this._getObjectID(b)],parameters:$.extend(true,{containerID:b,currentState:a,newState:c},this._getAdditionalParameters(b))});this._proxy.sendRequest();$("#"+b).toggleClass("jsCollapsed")},_exchangeIcon:function(b,a){a=a||"spinner";b.removeClass("icon-chevron-down icon-chevron-right icon-spinner").addClass("icon-"+a)},_getObjectID:function(a){return $("#"+a).data("objectID")},_getAdditionalParameters:function(a){return{}},_updateContent:function(a,b,c){this._containerData[a].target.html(b)},_success:function(d,e,c){if(!d.returnValues.containerID){return}var a=d.returnValues.containerID;if(!this._containers[a]){return}this._containerData[a].isOpen=(d.returnValues.isOpen)?true:false;var b=(d.returnValues.isOpen)?"open":"close";this._updateContent(a,$.trim(d.returnValues.content),b);this._exchangeIcon(this._containerData[a].button,(d.returnValues.isOpen?"chevron-down":"chevron-right"))}});WCF.Collapsible.SimpleRemote=WCF.Collapsible.Remote.extend({init:function(a){this._super(a);this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false})},_initContainer:function(a){this._super(a);if(!this._containerData[a].isOpen){this._containerData[a].target.hide();this._exchangeIcon(this._containerData[a].button,"chevron-right")}},_toggleContainer:function(d){var f=$(d.currentTarget);var b=f.data("containerID");var e=this._containerData[b].isOpen;var a=(e)?"open":"close";var c=(e)?"close":"open";this._proxy.setOption("data",{actionName:"toggleContainer",className:this._className,interfaceName:"wcf\\data\\IToggleContainerAction",objectIDs:[this._getObjectID(b)],parameters:$.extend(true,{containerID:b,currentState:a,newState:c},this._getAdditionalParameters(b))});this._proxy.sendRequest();this._exchangeIcon(this._containerData[b].button,(c==="open"?"chevron-down":"chevron-right"));if(c==="open"){this._containerData[b].target.show()}else{this._containerData[b].target.hide()}$("#"+b).toggleClass("jsCollapsed");this._containerData[b].isOpen=(c==="open"?true:false)}});WCF.Collapsible.Sidebar=Class.extend({_button:null,_buttonHeight:0,_isOpen:false,_mainContainer:null,_proxy:null,_sidebar:null,_sidebarHeight:0,_sidebarName:"",_sidebarOffset:0,_userPanelHeight:0,init:function(){this._sidebar=$(".sidebar:eq(0)");if(!this._sidebar.length){console.debug("[WCF.Collapsible.Sidebar] Could not find sidebar, aborting.");return}this._isOpen=(this._sidebar.data("isOpen"))?true:false;this._sidebarName=this._sidebar.data("sidebarName");this._mainContainer=$("#main");this._sidebarHeight=this._sidebar.height();this._sidebarOffset=this._sidebar.getOffsets("offset").top;this._userPanelHeight=$("#topMenu").outerHeight();this._button=$('<a class="collapsibleButton jsTooltip" title="'+WCF.Language.get("wcf.global.button.collapsible")+'" />').prependTo(this._sidebar);this._button.wrap("<span />");this._button.click($.proxy(this._click,this));this._buttonHeight=this._button.outerHeight();WCF.DOMNodeInsertedHandler.execute();this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,url:"index.php/AJAXInvoke/?t="+SECURITY_TOKEN+SID_ARG_2ND});$(document).scroll($.proxy(this._scroll,this)).resize($.proxy(this._scroll,this));this._renderSidebar();this._scroll();var a=$(window);this._sidebar.on("webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd",function(){a.trigger("resize")})},_click:function(){this._isOpen=(this._isOpen)?false:true;this._proxy.setOption("data",{actionName:"toggle",className:"wcf\\system\\user\\collapsible\\content\\UserCollapsibleSidebarHandler",isOpen:(this._isOpen?1:0),sidebarName:this._sidebarName});this._proxy.sendRequest();this._renderSidebar()},_scroll:function(){var e=$(window);var b=e.scrollTop();var a=Math.max(b-this._sidebarOffset,0);var c=Math.min(this._mainContainer.height(),(e.height()+b)-this._sidebarOffset);var f=0;if(c===a){f=this._sidebarOffset+this._sidebarHeight}else{f=a+((c-a)/2);var d=Math.max(Math.min(a-this._userPanelHeight,this._userPanelHeight),0);if(d>0){f+=(d/2)}}if((c-a-this._userPanelHeight)<this._buttonHeight){f=f-this._buttonHeight}else{f=Math.max(f-(this._buttonHeight/2),0)}this._button.css({top:f+"px"})},_renderSidebar:function(){if(this._isOpen){$(".sidebarOrientationLeft, .sidebarOrientationRight").removeClass("sidebarCollapsed")}else{$(".sidebarOrientationLeft, .sidebarOrientationRight").addClass("sidebarCollapsed")}this._scroll();if($.browser.msie&&$.browser.version.indexOf("9")===0){$(window).trigger("resize")}}});WCF.User={userID:0,username:"",init:function(a,b){this.userID=a;this.username=b}};WCF.Effect={};WCF.Effect.Scroll=Class.extend({scrollTo:function(c,a,b){if(!c.length){return true}var d=c.getOffsets("offset").top;var f=$(document).height();var e=$(window).height();if(d>f-e){d=f-e;if(d<0){d=0}}if(b===true){$("html,body").scrollTop(d)}else{$("html,body").animate({scrollTop:d},400,function(h,i,g,k,j){return -k*((i=i/j-1)*i*i*i-1)+g})}return false}});WCF.Effect.SmoothScroll=WCF.Effect.Scroll.extend({init:function(){var a=this;$(document).on("click","a[href$=#top],a[href$=#bottom]",function(){var b=$(this.hash);a.scrollTo(b,true);return false})}});WCF.Effect.BalloonTooltip=Class.extend({_didInit:false,_tooltip:null,_viewportDimensions:{},init:function(){if(jQuery.browser.mobile){return}if(!this._didInit){this._tooltip=$('<div id="balloonTooltip" class="balloonTooltip"><span id="balloonTooltipText"></span><span class="pointer"><span></span></span></div>').appendTo($("body")).hide();this._updateViewportDimensions();$(window).resize($.proxy(this._updateViewportDimensions,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.Effect.BalloonTooltip",$.proxy(this.init,this));this._didInit=true}$(".jsTooltip").each($.proxy(this._initTooltip,this))},_updateViewportDimensions:function(){this._viewportDimensions=$(document).getDimensions()},_initTooltip:function(b,c){var a=$(c);if(a.hasClass("jsTooltip")){a.removeClass("jsTooltip");var d=a.attr("title");if(d!==""){a.data("tooltip",d);a.removeAttr("title");a.hover($.proxy(this._mouseEnterHandler,this),$.proxy(this._mouseLeaveHandler,this));a.click($.proxy(this._mouseLeaveHandler,this))}}},_mouseEnterHandler:function(c){var e,d;var o=$(c.currentTarget);var k=o.attr("title");if(k&&k!==""){o.data("tooltip",k);o.removeAttr("title")}this._tooltip.css({top:"0px",left:"0px"});if(!o.data("tooltip")){this._tooltip.hide();return}this._tooltip.children("span:eq(0)").text(o.data("tooltip"));var m=this._tooltip.find(".pointer");this._tooltip.show();var b=m.outerWidth();this._tooltip.hide();var f=o.getOffsets("offset");var l=o.getDimensions("outer");var n=this._tooltip.getDimensions("outer");var a=this._tooltip.getDimensions("inner");var i=f.left+Math.ceil(l.width/2);var j=Math.ceil(n.width/2);var h="center";if((i-j)<5){h="left"}else{if((this._viewportDimensions.width-5)<(i+j)){h="right"}}if(f.top+l.height+n.height-$(document).scrollTop()<$(window).height()){e=f.top+l.height+7;this._tooltip.removeClass("inverse");m.css("top",-5)}else{e=f.top-n.height-7;this._tooltip.addClass("inverse");m.css("top",n.height)}var g=(WCF.Language.get("wcf.global.pageDirection")=="rtl"?"right":"left");switch(h){case"center":d=Math.round(f.left-j+(l.width/2));m.css(g,(a.width/2-b/2)+"px");break;case"left":d=f.left;if(g==="right"){m.css(g,(a.width-b-5)+"px")}else{m.css(g,"5px")}break;case"right":d=f.left+l.width-n.width;if(g==="right"){m.css(g,"5px")}else{m.css(g,(a.width-b-5)+"px")}break}this._tooltip.css({top:e+"px",left:d+"px"});this._tooltip.wcfFadeIn()},_mouseLeaveHandler:function(a){this._tooltip.stop().hide().css({opacity:1})}});WCF.CloseOverlayHandler={_callbacks:new WCF.Dictionary(),_isListening:false,addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.CloseOverlayHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},forceExecution:function(){this._executeCallbacks()},_bindListener:function(){if(this._isListening){return}$(document.body).click($.proxy(this._executeCallbacks,this));this._isListening=true},_executeCallbacks:function(a){this._callbacks.each(function(b){b.value()})}};WCF.DOMNodeInsertedHandler={_callbacks:[],_isExecuting:false,addCallback:function(a,b){this._callbacks.push(b)},_executeCallbacks:function(){if(this._isExecuting){return}this._isExecuting=true;for(var b=0,a=this._callbacks.length;b<a;b++){this._callbacks[b]()}this._isExecuting=false},execute:function(){this._executeCallbacks()}};WCF.DOMNodeRemovedHandler={_callbacks:new WCF.Dictionary(),_isExecuting:false,_isListening:false,addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.DOMNodeRemovedHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},_bindListener:function(){if(this._isListening){return}if(window.MutationObserver){var a=new MutationObserver((function(b){var c=false;b.forEach((function(d){if(d.removedNodes.length){c=true}}).bind(this));if(c){this._executeCallbacks({})}}).bind(this));a.observe(document.body,{childList:true,subtree:true})}else{$(document).bind("DOMNodeRemoved",$.proxy(this._executeCallbacks,this))}this._isListening=true},_executeCallbacks:function(a){if(this._isExecuting){return}this._isExecuting=true;this._callbacks.each(function(b){b.value(a)});this._isExecuting=false}};WCF.Option={};WCF.Option.Handler=Class.extend({init:function(){this._initOptions();WCF.DOMNodeInsertedHandler.addCallback("WCF.Option.Handler",$.proxy(this._initOptions,this))},_initOptions:function(){$(".jsEnablesOptions").each($.proxy(this._initOption,this))},_initOption:function(a,b){this._change(b);$(b).change($.proxy(this._handleChange,this))},_handleChange:function(a){this._change($(a.target))},_change:function(option){option=$(option);var $disableOptions=eval(option.data("disableOptions"));var $enableOptions=eval(option.data("enableOptions"));switch(option.getTagName()){case"input":switch(option.attr("type")){case"checkbox":this._execute(option.prop("checked"),$disableOptions,$enableOptions);break;case"radio":if(option.prop("checked")){this._execute(true,$disableOptions,$enableOptions)}break}break;case"select":var $value=option.val();var $disableOptions=$enableOptions=[];if(option.data("disableOptions").length>0){for(var $index in option.data("disableOptions")){var $item=option.data("disableOptions")[$index];if($item.value==$value){$disableOptions.push($item.option)}}}if(option.data("enableOptions").length>0){for(var $index in option.data("enableOptions")){var $item=option.data("enableOptions")[$index];if($item.value==$value){$enableOptions.push($item.option)}}}this._execute(true,$disableOptions,$enableOptions);break}},_execute:function(e,f,d){if(f.length>0){for(var g=0,b=f.length;g<b;g++){var a=f[g];if($.wcfIsset(a)){this._enableOption(a,!e)}else{var c=$("."+a+"Input");if(c.length){this._enableOptions(c.children("dd").find("input, select, textarea"),!e)}}}}if(d.length>0){for(var g=0,b=d.length;g<b;g++){var a=d[g];if($.wcfIsset(a)){this._enableOption(a,e)}else{var c=$("."+a+"Input");if(c.length){this._enableOptions(c.children("dd").find("input, select, textarea"),e)}}}}},_enableOption:function(b,a){this._enableOptionElement($("#"+$.wcfEscapeID(b)),a)},_enableOptionElement:function(c,b){c=$(c);var a=c.getTagName();if(a=="select"||(a=="input"&&(c.attr("type")=="checkbox"||c.attr("type")=="file"||c.attr("type")=="radio"))){if(b){c.enable()}else{c.disable()}}else{if(b){c.removeAttr("readonly")}else{c.attr("readonly",true)}}if(b){c.closest("dl").removeClass("disabled")}else{c.closest("dl").addClass("disabled")}},_enableOptions:function(a,b){for(var d=0,c=a.length;d<c;d++){this._enableOptionElement(a[d],b)}}});WCF.PageVisibilityHandler={_callbacks:new WCF.Dictionary(),_isListening:false,_hiddenFieldName:"",addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.PageVisibilityHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},_bindListener:function(){if(this._isListening){return}var a=null;if(typeof document.hidden!=="undefined"){this._hiddenFieldName="hidden";a="visibilitychange"}else{if(typeof document.mozHidden!=="undefined"){this._hiddenFieldName="mozHidden";a="mozvisibilitychange"}else{if(typeof document.msHidden!=="undefined"){this._hiddenFieldName="msHidden";a="msvisibilitychange"}else{if(typeof document.webkitHidden!=="undefined"){this._hiddenFieldName="webkitHidden";a="webkitvisibilitychange"}}}}if(a===null){console.debug("[WCF.PageVisibilityHandler] This browser does not support the page visibility API.")}else{$(document).on(a,$.proxy(this._executeCallbacks,this))}this._isListening=true},_executeCallbacks:function(b){if(this._isExecuting){return}this._isExecuting=true;var a=document[this._hiddenFieldName];this._callbacks.each(function(c){c.value(a)});this._isExecuting=false}};WCF.Table={};WCF.Table.EmptyTableHandler=Class.extend({_options:{},_rowClassName:"",init:function(b,c,a){this._rowClassName=c;this._tableContainer=b;this._options=$.extend(true,{emptyMessage:null,messageType:"info",refreshPage:false,updatePageNumber:false},a||{});WCF.DOMNodeRemovedHandler.addCallback("WCF.Table.EmptyTableHandler."+c,$.proxy(this._remove,this))},_getRowCount:function(){return this._tableContainer.find("table tr."+this._rowClassName).length},_handleEmptyTable:function(){if(this._options.emptyMessage){this._tableContainer.replaceWith($("<p />").addClass(this._options.messageType).text(this._options.emptyMessage))}else{if(this._options.refreshPage){if(this._options.updatePageNumber){var a=window.location.href.match(/(\?|&)pageNo=(\d+)/g);if(a){var b=a[a.length-1].match(/\d+/g);if(this._options.updatePageNumber>0){b++}else{b--}window.location=window.location.href.replace(a[a.length-1],a[a.length-1][0]+"pageNo="+b)}}else{window.location.reload()}}else{this._tableContainer.remove()}}},_remove:function(c){if($.getLength(c)){var b=$(c.target);if(b.hasClass(this._rowClassName)){var a=b.parents("tbody:eq(0)");if(a.children("tr").length==1){this._handleEmptyTable()}}}else{if(!this._getRowCount()){this._handleEmptyTable()}}}});WCF.Search={};WCF.Search.Base=Class.extend({_callback:null,_caretAt:-1,_className:"",_commaSeperated:false,_delay:0,_excludedSearchValues:[],_itemCount:0,_itemIndex:-1,_list:null,_oldSearchString:[],_proxy:null,_searchInput:null,_triggerLength:3,_timer:null,init:function(b,e,a,c,d){if(e!==null&&e!==undefined&&!$.isFunction(e)){console.debug("[WCF.Search.Base] The given callback is invalid, aborting.");return}this._callback=(e)?e:null;this._caretAt=-1;this._delay=0;this._excludedSearchValues=[];if(a){this._excludedSearchValues=a}this._searchInput=$(b);if(!this._searchInput.length){console.debug("[WCF.Search.Base] Selector '"+b+"' for search input is invalid, aborting.");return}this._searchInput.keydown($.proxy(this._keyDown,this)).keyup($.proxy(this._keyUp,this)).wrap('<span class="dropdown" />');if($.browser.mozilla&&$.browser.touch){this._searchInput.on("input",$.proxy(this._keyUp,this))}this._list=$('<ul class="dropdownMenu" />').insertAfter(this._searchInput);this._commaSeperated=(c)?true:false;this._oldSearchString=[];this._itemCount=0;this._itemIndex=-1;this._proxy=new WCF.Action.Proxy({showLoadingOverlay:(d!==true?false:true),success:$.proxy(this._success,this),autoAbortPrevious:true});if(this._searchInput.is("input")){this._searchInput.attr("autocomplete","off")}this._searchInput.blur($.proxy(this._blur,this));WCF.Dropdown.initDropdownFragment(this._searchInput.parent(),this._list)},_blur:function(){var a=this;new WCF.PeriodicalExecuter(function(b){if(a._list.is(":visible")){a._clearList(false)}b.stop()},250)},_keyDown:function(a){if(a.which===$.ui.keyCode.ENTER){var b=this._searchInput.parents(".dropdown");if(b.data("disableAutoFocus")){if(this._itemIndex!==-1){a.preventDefault()}}else{if(b.data("preventSubmit")||this._itemIndex!==-1){a.preventDefault()}}}},_keyUp:function(d){switch(d.which){case 37:case 39:return;break;case 38:this._selectPreviousItem();return;break;case 40:this._selectNextItem();return;break;case 13:return this._selectElement(d);break}var b=this._getSearchString(d);if(b===""){this._clearList(false)}else{if(b.length>=this._triggerLength){var c={data:{excludedSearchValues:this._excludedSearchValues,searchString:b}};if(this._delay){if(this._timer!==null){this._timer.stop()}var a=this;this._timer=new WCF.PeriodicalExecuter(function(){a._queryServer(c);a._timer.stop();a._timer=null},this._delay)}else{this._queryServer(c)}}else{this._clearList(false)}}},_queryServer:function(a){this._searchInput.parents(".searchBar").addClass("loading");this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters(a)});this._proxy.sendRequest()},setDelay:function(a){this._delay=a},_selectNextItem:function(){if(this._itemCount===0){return}this._itemIndex++;if(this._itemIndex===this._itemCount){this._itemIndex=0}this._highlightSelectedElement()},_selectPreviousItem:function(){if(this._itemCount===0){return}this._itemIndex--;if(this._itemIndex===-1){this._itemIndex=this._itemCount-1}this._highlightSelectedElement()},_highlightSelectedElement:function(){this._list.find("li").removeClass("dropdownNavigationItem");this._list.find("li:eq("+this._itemIndex+")").addClass("dropdownNavigationItem")},_selectElement:function(a){if(this._itemCount===0){return true}this._list.find("li.dropdownNavigationItem").trigger("click");return false},_getSearchString:function(d){var a=$.trim(this._searchInput.val());if(this._commaSeperated){var c=d.keyCode||d.which;if(c==$.ui.keyCode.COMMA){return""}var b=a.split(",");var e=b.length;for(var g=0;g<e;g++){b[g]=$.trim(b[g])}for(var g=0;g<e;g++){var f=b[g];if(this._oldSearchString[g]){if(f!=this._oldSearchString[g]){a=f;this._caretAt=g;break}}else{a=f;break}}this._oldSearchString=b}return a},_getParameters:function(a){return a},_success:function(d,f,c){this._clearList(false);this._searchInput.parents(".searchBar").removeClass("loading");if($.getLength(d.returnValues)){for(var e in d.returnValues){var a=d.returnValues[e];this._createListItem(a)}}else{if(!this._handleEmptyResult()){return}}WCF.CloseOverlayHandler.addCallback("WCF.Search.Base",$.proxy(function(){this._clearList()},this));var b=this._searchInput.parents(".dropdown").wcfIdentify();if(!WCF.Dropdown.getDropdownMenu(b).hasClass("dropdownOpen")){WCF.Dropdown.toggleDropdown(b)}this._itemIndex=-1;if(!WCF.Dropdown.getDropdown(b).data("disableAutoFocus")){this._selectNextItem()}},_handleEmptyResult:function(){return false},_createListItem:function(b){var a=$("<li><span>"+WCF.String.escapeHTML(b.label)+"</span></li>").appendTo(this._list);a.data("objectID",b.objectID).data("label",b.label).click($.proxy(this._executeCallback,this));this._itemCount++;return a},_executeCallback:function(d){var a=false;var c=$(d.currentTarget);if(this._commaSeperated){var b=c.data("label");this._oldSearchString[this._caretAt]=b;this._searchInput.val(this._oldSearchString.join(", "));if($.browser.webkit){this._searchInput.css({display:"block"})}var e=this._searchInput.val().toLowerCase().indexOf(b.toLowerCase())+b.length;this._searchInput.focus().setCaret(e)}else{if(this._callback===null){this._searchInput.val(c.data("label"))}else{a=(this._callback(c.data())===true)?true:false}}this._clearList(a)},_clearList:function(a){if(a&&!this._commaSeperated){this._searchInput.val("")}WCF.Dropdown.getDropdown(this._searchInput.parents(".dropdown").wcfIdentify()).removeClass("dropdownOpen");WCF.Dropdown.getDropdownMenu(this._searchInput.parents(".dropdown").wcfIdentify()).removeClass("dropdownOpen");this._list.end().empty();WCF.CloseOverlayHandler.removeCallback("WCF.Search.Base");this._itemCount=0;this._itemIndex=-1},addExcludedSearchValue:function(a){if(!WCF.inArray(a,this._excludedSearchValues)){this._excludedSearchValues.push(a)}},removeExcludedSearchValue:function(b){var a=$.inArray(b,this._excludedSearchValues);if(a!=-1){this._excludedSearchValues.splice(a,1)}}});WCF.Search.User=WCF.Search.Base.extend({_className:"wcf\\data\\user\\UserAction",_includeUserGroups:false,init:function(c,e,a,b,d){this._includeUserGroups=a;this._super(c,e,b,d)},_getParameters:function(a){a.data.includeUserGroups=this._includeUserGroups?1:0;return a},_createListItem:function(e){var d=this._super(e);var b=null;if(e.icon){b=$(e.icon)}else{if(this._includeUserGroups&&e.type==="group"){b=$('<span class="icon icon16 icon-group" />')}}if(b){var a=d.find("span").detach();var c=$("<div />").addClass("box16").appendTo(d);c.append(b);c.append($("<div />").append(a))}d.data("type",e.type);return d}});WCF.System={};WCF.System.Dependency={};WCF.System.Dependency.Manager={_callbacks:{},_loaded:[],_setupCallbacks:{},register:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Dependency.Manager] Callback for identifier '"+a+"' is invalid, aborting.");return}if(WCF.inArray(a,this._loaded)){setTimeout(function(){b()},1)}else{if(!this._callbacks[a]){this._callbacks[a]=[]}this._callbacks[a].push(b)}},setup:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Dependency.Manager] Setup callback for identifier '"+a+"' is invalid, aborting.");return}if(!this._setupCallbacks[a]){this._setupCallbacks[a]=[]}this._setupCallbacks[a].push(b)},invoke:function(a){if(this._setupCallbacks[a]){for(var c=0,b=this._setupCallbacks[a].length;c<b;c++){this._setupCallbacks[a][c]()}delete this._setupCallbacks[a]}this._loaded.push(a);if(this._callbacks[a]){for(var c=0,b=this._callbacks[a].length;c<b;c++){this._callbacks[a][c]()}delete this._callbacks[a]}}};WCF.System.FlexibleMenu={_containers:{},_containerIDs:[],_dropdowns:{},_dropdownMenus:{},_hasHiddenItems:{},_isWorking:false,_menuItems:{},init:function(){this.registerMenu("mainMenu");this.registerMenu($(".navigationHeader:eq(0)").wcfIdentify());this._registerTabMenus();$(window).resize($.proxy(this.rebuildAll,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.System.FlexibleMenu",$.proxy(this._registerTabMenus,this))},_registerTabMenus:function(){$(".tabMenuContainer:not(.jsFlexibleMenuEnabled), .messageTabMenu:not(.jsFlexibleMenuEnabled)").each(function(a,b){var c=$(b).addClass("jsFlexibleMenuEnabled").children("nav");if(c.length&&c.find("> ul:eq(0) > li").length){WCF.System.FlexibleMenu.registerMenu(c.wcfIdentify())}})},registerMenu:function(a){var b=$("#"+a);if(!b.length){console.debug("[WCF.System.FlexibleMenu] Unable to find container identified by '"+a+"', aborting.");return}this._containerIDs.push(a);this._containers[a]=b;this._menuItems[a]=b.find("> ul:eq(0) > li");this._dropdowns[a]=$('<li class="dropdown jsFlexibleMenuDropdown"><a class="icon icon16 icon-list" /></li>').data("containerID",a).click($.proxy(this._click,this));this._dropdownMenus[a]=$('<ul class="dropdownMenu" />').appendTo(this._dropdowns[a]);this._hasHiddenItems[a]=false;this.rebuild(a);WCF.Dropdown.initDropdown(this._dropdowns[a].children("a"))},rebuildAll:function(){if(this._isWorking){return}this._isWorking=true;for(var b=0,a=this._containerIDs.length;b<a;b++){this.rebuild(this._containerIDs[b])}this._isWorking=false},rebuild:function(j){if(!this._containers[j]){console.debug("[WCF.System.FlexibleMenu] Cannot rebuild unknown container identified by '"+j+"'");return}var l=this._containers[j];var f=this._menuItems[j].hide();var a=f.filter(".active, .ui-state-active").show();if(!this._hasHiddenItems[j]){this._dropdowns[j].appendTo(l.children("ul:eq(0)"))}var g=this._dropdowns[j].outerWidth(true);var e=l.parent();var b=e.innerWidth();b-=e.cssAsNumber("padding-left")+e.cssAsNumber("padding-right");b-=l.cssAsNumber("margin-left")+l.cssAsNumber("margin-right");b-=l.cssAsNumber("padding-left")+l.cssAsNumber("padding-right");b-=l.children("ul:eq(0)").cssAsNumber("padding-left")+l.children("ul:eq(0)").cssAsNumber("padding-right");b-=a.outerWidth(true);this._hasHiddenItems[j]=false;for(var i=0;i<f.length;i++){var h=$(f[i]);if(h.hasClass("active")||h.hasClass("ui-state-active")){continue}var c=h.outerWidth(true);if(b-c>0){b-=c;h.show()}else{if(b<g){var d=h.prev();if(d.hasClass("active")||d.hasClass("ui-state-active")){d.prev().hide()}else{d.hide()}}this._hasHiddenItems[j]=true;break}}if(this._hasHiddenItems[j]){this._dropdownMenus[j].empty();var k=this;f.each($.proxy(function(m,n){if($(n).is(":visible")){return true}$("<li>"+$(n).html()+"</li>").data("index",m).appendTo(this._dropdownMenus[j]).click(function(p){var o=$(f[$(p.currentTarget).data("index")]);if(o[0].tagName==="A"){o.trigger("click")}else{if(o[0].tagName==="LI"){o.find("a").trigger("click")}}if(o.parent().hasClass("ui-tabs-nav")){p.preventDefault()}setTimeout(function(){k.rebuild(j)},50)})},this))}else{this._dropdowns[j].detach()}}};WCF.System.Mobile={};WCF.System.Mobile.UX={_enabled:false,_main:null,_sidebar:null,init:function(){this._enabled=false;this._main=$("#main");this._sidebar=this._main.find("> div > div > .sidebar");if($.browser.touch){$("html").addClass("touch")}enquire.register("screen and (max-width: 800px)",{match:$.proxy(this._enable,this),unmatch:$.proxy(this._disable,this),setup:$.proxy(this._setup,this),deferSetup:true});if($.browser.msie&&this._sidebar.width()>305){this._sidebar.css("display","none").css("display","")}},_setup:function(){this._initSidebarToggleButtons();this._initSearchBar();this._initButtonGroupNavigation();WCF.CloseOverlayHandler.addCallback("WCF.System.Mobile.UX",$.proxy(this._closeMenus,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.System.Mobile.UX",$.proxy(this._initButtonGroupNavigation,this))},_enable:function(){this._enabled=true;if($.browser.msie){this._sidebar.css("display","none").css("display","")}},_disable:function(){this._enabled=false;if($.browser.msie){this._sidebar.css("display","none").css("display","")}},_initSidebarToggleButtons:function(){var c=this._main.hasClass("sidebarOrientationLeft");var b=this._main.hasClass("sidebarOrientationRight");if(c||b){var d="wcf.global.sidebar.show"+(c?"Left":"Right")+"Sidebar";if(d===WCF.Language.get(d)||WCF.Language.get(d)===""){d='<span class="icon icon16 icon-double-angle-'+(c?"left":"right")+'" />'}var e="wcf.global.sidebar.hide"+(c?"Left":"Right")+"Sidebar";if(e===WCF.Language.get(e)||WCF.Language.get(e)===""){e='<span class="icon icon16 icon-double-angle-'+(c?"right":"left")+'" />'}var a=this;$('<span class="button small mobileSidebarToggleButton">'+d+"</span>").appendTo($(".content")).click(function(){a._main.addClass("mobileShowSidebar")});$('<span class="button small mobileSidebarToggleButton">'+e+"</span>").appendTo($(".sidebar")).click(function(){a._main.removeClass("mobileShowSidebar")})}},_initSearchBar:function(){var b=$(".searchBar:eq(0)");var a=this;b.click(function(){if(a._enabled){b.addClass("searchBarOpen")}});this._main.click(function(){b.removeClass("searchBarOpen")})},_initButtonGroupNavigation:function(){$(".buttonGroupNavigation:not(.jsMobileButtonGroupNavigation)").each(function(b,a){var d=$(a).addClass("jsMobileButtonGroupNavigation");var c=$('<a class="dropdownLabel"><span class="icon icon24 icon-list" /></a>').prependTo(d);c.click(function(){c.next().toggleClass("open");return false})})},_closeMenus:function(){$(".jsMobileButtonGroupNavigation > ul.open").removeClass("open")}};WCF.System.ObjectStore={_objects:{},add:function(a,b){if(this._objects[a]===undefined){this._objects[a]=[]}this._objects[a].push(b)},invoke:function(a,c){if(this._objects[a]){for(var b=0;b<this._objects[a].length;b++){c(this._objects[a][b])}}}};WCF.System.Captcha={_captchas:{},addCallback:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Captcha] Given callback is no function");return}this._captchas[a]=b},getData:function(a){if(this._captchas[a]===undefined){console.debug('[WCF.System.Captcha] Unknow captcha id "'+a+'"');return}return this._captchas[a]()},removeCallback:function(a){delete this._captchas[a]}};WCF.System.Page={};WCF.System.Page.Multiple=Class.extend({_cache:{},_options:{},_pageNo:1,_pages:0,_previousPageNo:0,init:function(a){this._options=$.extend({container:null,pagination:null,loadItems:null},a);this._cache={};this._pageNo=1;this._pages=0;this._previousPageNo=0;if(this._pagination.data("pages")){this._pagination.wcfPages({maxPage:this._pagination.data("pages")}).on("wcfpagesswitched",$.proxy(this._showPage,this))}},_showPage:function(a,b){if(b&&b.activePage){if(!b.template){this._previousPageNo=this._pageNo}this._pageNo=b.activePage}if(this._cache[this._pageNo]||(b&&b.template)){this._cache[this._previousPageNo]=this._list.children().detach();if(b&&b.template){this._list.html(b.template)}else{this._list.append(this._cache[this._pageNo])}}else{this._options.loadItems()}},showPage:function(a,b){this._showPage(null,{activePage:a,template:b})},getPageNo:function(){return this._pageNo}});WCF.System.Notification=Class.extend({_callback:null,_cssClassNames:"",_message:"",_overlay:null,_timer:null,init:function(a,b){this._cssClassNames=b||"success";this._message=a||WCF.Language.get("wcf.global.success");this._overlay=$("#systemNotification");this._timer=null;if(!this._overlay.length){this._overlay=$('<div id="systemNotification"><p></p></div>').hide().appendTo(document.body);this._overlay.children("p").click((function(){this._hide()}).bind(this))}},show:function(d,b,a,c){b=parseInt(b);if(!b){b=2000}if(d&&$.isFunction(d)){this._callback=d}this._overlay.children("p").html((a||this._message));this._overlay.children("p").removeClass().addClass((c||this._cssClassNames));this._timer=new WCF.PeriodicalExecuter($.proxy(this._hide,this),b);this._overlay.wcfFadeIn(undefined,300)},_hide:function(a){a=(a)?a:this._timer;if(this._callback!==null){this._callback()}this._overlay.wcfFadeOut(undefined,300);a.stop();a=null}});WCF.System.Confirmation={_callback:null,_dialog:null,_parameters:null,_visible:false,_confirmationButton:null,show:function(c,e,b,a){if(this._visible){console.debug("[WCF.System.Confirmation] Confirmation dialog is already open, refusing action.");return}if(!$.isFunction(e)){console.debug("[WCF.System.Confirmation] Given callback is invalid, aborting.");return}this._callback=e;this._parameters=b;var d=true;if(this._dialog===null){this._createDialog();d=false}this._dialog.find("#wcfSystemConfirmationContent").empty().hide();if(a&&a.length){a.appendTo(this._dialog.find("#wcfSystemConfirmationContent").show())}this._dialog.find("p").text(c);this._dialog.wcfDialog({onClose:$.proxy(this._close,this),onShow:$.proxy(this._show,this),title:WCF.Language.get("wcf.global.confirmation.title")});if(d){this._dialog.wcfDialog("render")}this._confirmationButton.focus();this._visible=true},_createDialog:function(){this._dialog=$('<div id="wcfSystemConfirmation" class="systemConfirmation"><p /><div id="wcfSystemConfirmationContent" /></div>').hide().appendTo(document.body);var a=$('<div class="formSubmit" />').appendTo(this._dialog);this._confirmationButton=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.confirmation.confirm")+"</button>").data("action","confirm").click($.proxy(this._click,this)).appendTo(a);$("<button>"+WCF.Language.get("wcf.global.confirmation.cancel")+"</button>").data("action","cancel").click($.proxy(this._click,this)).appendTo(a)},_click:function(a){this._notify($(a.currentTarget).data("action"))},_close:function(){if(this._visible){this._notify("cancel")}},_notify:function(a){this._visible=false;this._dialog.wcfDialog("close");this._confirmationButton.blur();this._callback(a,this._parameters)},_show:function(){this._dialog.find("button.buttonPrimary").blur().focus()}};WCF.System.DisableScrolling={_depth:0,_oldOverflow:null,disable:function(){if($.browser.touch){return}if(this._depth===0){this._oldOverflow=$(document.body).css("overflow");$(document.body).css("overflow","hidden")}this._depth++},enable:function(){if(this._depth===0){return}this._depth--;if(this._depth===0){$(document.body).css("overflow",this._oldOverflow)}}};WCF.System.DisableZoom={_depth:0,_oldViewportSettings:null,disable:function(){if(this._depth===0){var a=$("meta[name=viewport]");this._oldViewportSettings=a.attr("content");a.attr("content",this._oldViewportSettings+",maximum-scale=1")}this._depth++},enable:function(){if(this._depth===0){return}this._depth--;if(this._depth===0){$("meta[name=viewport]").attr("content",this._oldViewportSettings)}}};WCF.System.Fullscreen={enterFullscreen:function(a){if(a.requestFullscreen){a.requestFullscreen()}else{if(a.msRequestFullscreen){a.msRequestFullscreen()}else{if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else{if(a.webkitRequestFullscreen){a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}},toggleFullscreen:function(a){if(this.getFullscreenElement()===null){this.enterFullscreen(a)}else{this.exitFullscreen()}},getFullscreenElement:function(){if(document.fullscreenElement){return document.fullscreenElement}else{if(document.mozFullScreenElement){return document.mozFullScreenElement}else{if(document.webkitFullscreenElement){return document.webkitFullscreenElement}else{if(document.msFullscreenElement){return document.msFullscreenElement}}}}return null},exitFullscreen:function(){if(document.exitFullscreen){document.exitFullscreen()}else{if(document.msExitFullscreen){document.msExitFullscreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitExitFullscreen){document.webkitExitFullscreen()}}}}},isSupported:function(){if(document.documentElement.requestFullscreen||document.documentElement.msRequestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen){return true}return false}};WCF.System.PageNavigation={_button:null,_description:null,_dialog:null,_elementID:"",_elements:{},_pageNo:null,init:function(a,c){var b=$(a);if(!b.length){return}c=c||null;if(c!==null&&!$.isFunction(c)){console.debug("[WCF.System.PageNavigation] Callback for selector '"+a+"' is invalid, aborting.");return}this._initElements(b,c)},_initElements:function(b,c){var a=this;b.each(function(e,f){var d=$(f);var g=d.wcfIdentify();if(a._elements[g]===undefined){a._elements[g]=d;d.find("li.jumpTo").data("elementID",g).click($.proxy(a._click,a))}}).data("callback",c)},_click:function(b){this._elementID=$(b.currentTarget).data("elementID");if(this._dialog===null){this._dialog=$('<div id="pageNavigationOverlay" />').hide().appendTo(document.body);var c=$("<fieldset><legend>"+WCF.Language.get("wcf.global.page.jumpTo")+"</legend></fieldset>").appendTo(this._dialog);$('<dl><dt><label for="jsPageNavigationPageNo">'+WCF.Language.get("wcf.global.page.jumpTo")+"</label></dt><dd></dd></dl>").appendTo(c);this._pageNo=$('<input type="number" id="jsPageNavigationPageNo" value="1" min="1" max="1" class="tiny" />').keyup($.proxy(this._keyUp,this)).appendTo(c.find("dd"));this._description=$("<small></small>").insertAfter(this._pageNo);var a=$('<div class="formSubmit" />').appendTo(this._dialog);this._button=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.button.submit")+"</button>").click($.proxy(this._submit,this)).appendTo(a)}this._button.enable();this._description.html(WCF.Language.get("wcf.global.page.jumpTo.description").replace(/#pages#/,this._elements[this._elementID].data("pages")));this._pageNo.val(this._elements[this._elementID].data("pages")).attr("max",this._elements[this._elementID].data("pages"));this._dialog.wcfDialog({title:WCF.Language.get("wcf.global.page.pageNavigation")})},_keyUp:function(b){if(b.which==$.ui.keyCode.ENTER&&!this._button.prop("disabled")){this._submit();return}var a=parseInt(this._pageNo.val())||0;if(a<1||a>this._pageNo.attr("max")){this._button.disable()}else{this._button.enable()}},_submit:function(){var b=this._elements[this._elementID];if(b.data("callback")===null){var a=b.data("link").replace(/pageNo=%d/,"pageNo="+this._pageNo.val());window.location=a}else{b.data("callback")(this._pageNo.val());this._dialog.wcfDialog("close")}}};WCF.System.KeepAlive=Class.extend({init:function(a){new WCF.PeriodicalExecuter(function(b){new WCF.Action.Proxy({autoSend:true,data:{actionName:"keepAlive",className:"wcf\\data\\session\\SessionAction"},failure:function(){b.stop()},showLoadingOverlay:false,success:function(c){WCF.System.PushNotification.executeCallbacks(c)},suppressErrors:true})},(a*1000))}});WCF.System.PushNotification={_callbacks:{},addCallback:function(a,b){if(this._callbacks[a]===undefined){this._callbacks[a]=[]}this._callbacks[a].push(b)},executeCallbacks:function(b){for(var a in b.returnValues){if(this._callbacks[a]!==undefined){for(var c=0;c<this._callbacks[a].length;c++){this._callbacks[a][c](b.returnValues[a])}}}}};WCF.System.Event={_listeners:{},addListener:function(b,d,c){if(typeof this._listeners[b]==="undefined"){this._listeners[b]={}}if(typeof this._listeners[b][d]==="undefined"){this._listeners[b][d]=[]}var a=WCF.getUUID();this._listeners[b][d].push({callback:c,uuid:a});return a},removeListener:function(a,c,b){if(this._listeners[a]&&this._listeners[a][c]){for(var d=0;d<this._listeners[a][c].length;d++){if(this._listeners[a][c][d].uuid==b){this._listeners[a][c].splice(d,1);return true}}}return false},removeAllListeners:function(a,b){if(this._listeners[a]&&this._listeners[a][b]){delete this._listeners[a][b];return true}return false},fireEvent:function(a,c,b){b=b||{};if(this._listeners[a]&&this._listeners[a][c]){for(var d=0;d<this._listeners[a][c].length;d++){this._listeners[a][c][d].callback(b)}}}};WCF.System.Worker=Class.extend({_aborted:false,_actionName:"",_callback:null,_className:"",_dialog:null,_proxy:null,_title:"",init:function(a,b,d,c,e){this._aborted=false;this._actionName=a;this._callback=e||null;this._className=b;this._dialog=null;this._proxy=new WCF.Action.Proxy({autoSend:true,data:{actionName:this._actionName,className:this._className,parameters:c||{}},showLoadingOverlay:false,success:$.proxy(this._success,this)});this._title=d},_success:function(c){if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.wcfDialog({closeConfirmMessage:WCF.Language.get("wcf.worker.abort.confirmMessage"),closeViaModal:false,onClose:$.proxy(function(){this._aborted=true;this._proxy.abortPrevious();window.location.reload()},this),title:this._title})}if(this._aborted){return}if(c.returnValues.template){this._dialog.html(c.returnValues.template)}this._dialog.find("progress").attr("value",c.returnValues.progress).text(c.returnValues.progress+"%").next("span").text(c.returnValues.progress+"%");if(c.returnValues.progress<100){var b=c.returnValues.parameters||{};b.loopCount=c.returnValues.loopCount;this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:b});this._proxy.sendRequest()}else{if(this._callback!==null){this._callback(this,c)}else{this._dialog.find(".fa-spinner").removeClass("fa-spinner").addClass("fa-check green");this._dialog.find(".boxHeadline h1").text(WCF.Language.get("wcf.global.worker.completed"));var a=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.button.next")+"</button>").appendTo(a).focus().click(function(){if(c.returnValues.redirectURL){window.location=c.returnValues.redirectURL}else{window.location.reload()}});this._dialog.wcfDialog("render")}}}});WCF.InlineEditor=Class.extend({_callbacks:[],_dropdowns:{},_elements:{},_notification:null,_options:[],_proxy:null,_triggerElements:{},_updateData:[],init:function(d){var c=$(d);if(!c.length){return}this._setOptions();var b="";for(var f=0,e=this._options.length;f<e;f++){if(this._options[f].isQuickOption){b=this._options[f].optionName;break}}var a=this;c.each(function(i,j){var h=$(j);var k=h.wcfIdentify();var g=a._getTriggerElement(h);if(g===null||g.length!==1){return}g.click($.proxy(a._show,a)).data("elementID",k);if(b){g.disableSelection().data("optionName",b).dblclick($.proxy(a._click,a))}a._elements[k]=h});this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});WCF.CloseOverlayHandler.addCallback("WCF.InlineEditor",$.proxy(this._closeAll,this));this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success"),"success")},_closeAll:function(){for(var a in this._elements){this._hide(a)}},_setOptions:function(){this._options=[]},registerCallback:function(a){if($.isFunction(a)){this._callbacks.push(a)}},_getTriggerElement:function(a){return null},_show:function(b){b.preventDefault();var g=$(b.currentTarget).data("elementID");var h=null;if(!this._dropdowns[g]){this._triggerElements[g]=h=this._getTriggerElement(this._elements[g]).addClass("dropdownToggle").wrap('<span class="dropdown" />');this._dropdowns[g]=$('<ul class="dropdownMenu" />').insertAfter(h)}this._dropdowns[g].empty();var c=false;var d="";for(var k=0,i=this._options.length;k<i;k++){var a=this._options[k];if(a.optionName==="divider"){if(d!==""&&d!=="divider"){$('<li class="dropdownDivider" />').appendTo(this._dropdowns[g]);d=a.optionName}}else{if(this._validate(g,a.optionName)||this._validateCallbacks(g,a.optionName)){var f=$("<li><span>"+a.label+"</span></li>").appendTo(this._dropdowns[g]);f.data("elementID",g).data("optionName",a.optionName).data("isQuickOption",(a.isQuickOption?true:false)).click($.proxy(this._click,this));c=true;d=a.optionName}}}if(c){var l=this._dropdowns[g].children().last();if(l.hasClass("dropdownDivider")){l.remove()}var j=null;var e=0;this._dropdowns[g].children().each(function(m,o){var n=$(o);if(!n.hasClass("dropdownDivider")){if(n.data("isQuickOption")){j=n}else{e++}}});if(!e){j.trigger("click");if(this._triggerElements[g]){WCF.Dropdown.close(this._triggerElements[g].parents(".dropdown").wcfIdentify())}return false}}if(h!==null){WCF.Dropdown.initDropdown(h,true)}return false},_validate:function(a,b){return false},_validateCallbacks:function(a,b){var c=this._callbacks.length;if(c){for(var d=0;d<c;d++){if(this._callbacks[d].validate(this._elements[a],b)){return true}}}return false},_success:function(b,d,a){var c=this._updateData.length;if(!c){return}this._updateState(b);this._updateData=[]},_updateState:function(a){},_click:function(c){var b=$(c.currentTarget);var d=b.data("elementID");var a=b.data("optionName");if(!this._execute(d,a)){this._executeCallback(d,a)}this._hide(d)},_execute:function(a,b){return false},_executeCallback:function(a,b){var c=this._callbacks.length;if(c){for(var d=0;d<c;d++){if(this._callbacks[d].execute(this._elements[a],b)){return true}}}return false},_hide:function(a){if(this._dropdowns[a]){this._dropdowns[a].empty().removeClass("dropdownOpen")}}});WCF.Upload=Class.extend({_name:"__files[]",_buttonSelector:null,_fileListSelector:null,_fileUpload:null,_className:"",_iframe:null,_internalFileID:0,_options:{},_uploadMatrix:[],_supportsAJAXUpload:true,_overlay:null,init:function(c,e,d,b){this._buttonSelector=c;this._fileListSelector=e;this._className=d;this._internalFileID=0;this._options=$.extend(true,{action:"upload",multiple:false,url:"index.php/AJAXUpload/?t="+SECURITY_TOKEN+SID_ARG_2ND},b||{});this._options.url=WCF.convertLegacyURL(this._options.url);var a=new XMLHttpRequest();this._supportsAJAXUpload=(a&&("upload" in a)&&("onprogress" in a.upload));this._createButton()},_createButton:function(){if(this._supportsAJAXUpload){this._fileUpload=$('<input type="file" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/>");this._fileUpload.change($.proxy(this._upload,this));var a=$('<p class="button uploadButton"><span>'+WCF.Language.get("wcf.global.button.upload")+"</span></p>");a.prepend(this._fileUpload)}else{var a=$('<p class="button uploadFallbackButton"><span>'+WCF.Language.get("wcf.global.button.upload")+"</span></p>");a.click($.proxy(this._showOverlay,this))}this._insertButton(a)},_insertButton:function(a){this._buttonSelector.prepend(a)},_removeButton:function(){var a=".uploadButton";if(!this._supportsAJAXUpload){a=".uploadFallbackButton"}this._buttonSelector.find(a).remove()},_upload:function(c,e,b){var j=null;var a=[];if(e){a.push(e)}else{if(b){var g="";switch(b.type){case"image/png":g=".png";break;case"image/jpeg":g=".jpg";break;case"image/gif":g=".gif";break}a.push({name:"pasted-from-clipboard"+g})}else{a=this._fileUpload.prop("files")}}if(a.length){var m=new FormData();j=this._createUploadMatrix(a);if(!this._uploadMatrix[j].length){return null}for(var i=0,f=a.length;i<f;i++){if(this._uploadMatrix[j][i]){var h=this._uploadMatrix[j][i].data("internalFileID");if(b){m.append("__files["+h+"]",b,a[i].name)}else{m.append("__files["+h+"]",a[i])}}}m.append("actionName",this._options.action);m.append("className",this._className);var d=this._getParameters();for(var l in d){m.append("parameters["+l+"]",d[l])}var k=this;$.ajax({type:"POST",url:this._options.url,enctype:"multipart/form-data",data:m,contentType:false,processData:false,success:function(o,p,n){k._success(j,o)},error:$.proxy(this._error,this),xhr:function(){var n=$.ajaxSettings.xhr();if(n){n.upload.addEventListener("progress",function(o){k._progress(j,o)},false)}return n}})}return j},_createUploadMatrix:function(b){if(b.length){var c=this._uploadMatrix.length;this._uploadMatrix[c]=[];for(var f=0,d=b.length;f<d;f++){var a=b[f];var e=this._initFile(a);if(!e.hasClass("uploadFailed")){e.data("filename",a.name).data("internalFileID",this._internalFileID++);this._uploadMatrix[c][f]=e}}return c}return null},_success:function(b,a){},_error:function(a,c,b){},_progress:function(c,a){var b=Math.round(a.loaded*100/a.total);for(var d in this._uploadMatrix[c]){this._uploadMatrix[c][d].find("progress").attr("value",b)}},_getParameters:function(){return{}},_initFile:function(a){return $("<li>"+a.name+" ("+a.size+')<progress max="100" /></li>').appendTo(this._fileListSelector)},_showOverlay:function(){if(this._iframe===null){this._iframe=$('<iframe name="__fileUploadIFrame" />').hide().appendTo(document.body)}if(!this._overlay){this._overlay=$('<div><form enctype="multipart/form-data" method="post" action="'+this._options.url+'" target="__fileUploadIFrame" /></div>').hide().appendTo(document.body);var a=this._overlay.find("form");$('<dl class="wide"><dd><input type="file" id="__fileUpload" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/></dd></dl>").appendTo(a);$('<div class="formSubmit"><input type="submit" value="Upload" accesskey="s" /></div></form>').appendTo(a);$('<input type="hidden" name="isFallback" value="1" />').appendTo(a);$('<input type="hidden" name="actionName" value="'+this._options.action+'" />').appendTo(a);$('<input type="hidden" name="className" value="'+this._className+'" />').appendTo(a);var b=this._getParameters();for(var c in b){$('<input type="hidden" name="'+c+'" value="'+b[c]+'" />').appendTo(a)}a.submit($.proxy(function(){var d={name:this._getFilename(),size:""};var f=this._createUploadMatrix([d]);var e=this;this._iframe.data("loading",true).off("load").load(function(){e._evaluateResponse(f)});this._overlay.wcfDialog("close")},this))}this._overlay.wcfDialog({title:WCF.Language.get("wcf.global.button.upload")})},_evaluateResponse:function(b){var a=$.parseJSON(this._iframe.contents().find("pre").html());this._success(b,a)},_getFilename:function(){return $("#__fileUpload").val().split("\\").pop()}});WCF.Upload.Parallel=WCF.Upload.extend({init:function(b,d,c,a){a=$.extend(true,a||{},{multiple:true});this._super(b,d,c,a)},_upload:function(){var b=this._fileUpload.prop("files");for(var h=0,e=b.length;h<e;h++){var a=b[h];var c=new FormData();var g=this._createUploadMatrix(a);if(!this._uploadMatrix[g].length){continue}c.append("__files["+g+"]",a);c.append("actionName",this._options.action);c.append("className",this._className);var d=this._getParameters();for(var f in d){c.append("parameters["+f+"]",d[f])}this._sendRequest(g,c)}},_sendRequest:function(c,b){var a=this;$.ajax({type:"POST",url:this._options.url,enctype:"multipart/form-data",data:b,contentType:false,processData:false,success:function(e,f,d){a._success(c,e)},error:$.proxy(this._error,this),xhr:function(){var d=$.ajaxSettings.xhr();if(d){d.upload.addEventListener("progress",function(e){a._progress(c,e)},false)}return d}})},_createUploadMatrix:function(a){var b=this._initFile(a);if(!b.hasClass("uploadFailed")){b.data("filename",a.name).data("internalFileID",this._internalFileID);this._uploadMatrix[this._internalFileID++]=b;return this._internalFileID-1}return null},_success:function(b,a){},_progress:function(b,a){var c=Math.round(a.loaded*100/a.total);this._uploadMatrix[b].find("progress").attr("value",c)},_showOverlay:function(){if(this._iframe===null){this._iframe=$('<iframe name="__fileUploadIFrame" />').hide().appendTo(document.body)}if(!this._overlay){this._overlay=$('<div><form enctype="multipart/form-data" method="post" action="'+this._options.url+'" target="__fileUploadIFrame" /></div>').hide().appendTo(document.body);var a=this._overlay.find("form");$('<dl class="wide"><dd><input type="file" id="__fileUpload" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/></dd></dl>").appendTo(a);$('<div class="formSubmit"><input type="submit" value="Upload" accesskey="s" /></div></form>').appendTo(a);$('<input type="hidden" name="isFallback" value="1" />').appendTo(a);$('<input type="hidden" name="actionName" value="'+this._options.action+'" />').appendTo(a);$('<input type="hidden" name="className" value="'+this._className+'" />').appendTo(a);var b=this._getParameters();for(var c in b){$('<input type="hidden" name="'+c+'" value="'+b[c]+'" />').appendTo(a)}a.submit($.proxy(function(){var d={name:this._getFilename(),size:""};var f=this._createUploadMatrix(d);var e=this;this._iframe.data("loading",true).off("load").load(function(){e._evaluateResponse(f)});this._overlay.wcfDialog("close")},this))}this._overlay.wcfDialog({title:WCF.Language.get("wcf.global.button.upload")})},_evaluateResponse:function(b){var a=$.parseJSON(this._iframe.contents().find("pre").html());this._success(b,a)}});WCF.Sortable={};WCF.Sortable.List=Class.extend({_additionalParameters:{},_className:"",_containerID:"",_container:null,_notification:null,_offset:0,_options:{},_proxy:null,_structure:{},init:function(a,f,g,d,e,c){this._additionalParameters=c||{};this._containerID=$.wcfEscapeID(a);this._container=$("#"+this._containerID);this._className=f;this._offset=(g)?g:0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._structure={};this._options=$.extend(true,{axis:"y",connectWith:"#"+this._containerID+" .sortableList",disableNesting:"sortableNoNesting",doNotClear:true,errorClass:"sortableInvalidTarget",forcePlaceholderSize:true,helper:"clone",items:"li:not(.sortableNoSorting)",opacity:0.6,placeholder:"sortablePlaceholder",tolerance:"pointer",toleranceElement:"> span"},d||{});if(e){$("#"+this._containerID+" .sortableList").sortable(this._options)}else{$("#"+this._containerID+" > .sortableList").nestedSortable(this._options)}if(this._className){var b=this._container.find(".formSubmit");if(!b.length){b=this._container.next(".formSubmit");if(!b.length){console.debug("[WCF.Sortable.Simple] Unable to find form submit for saving, aborting.");return}}b.children('button[data-type="submit"]').click($.proxy(this._submit,this))}},_submit:function(){this._structure={};this._container.find(".sortableList").each($.proxy(function(c,e){var b=$(e);var d=b.data("objectID");if(d!==undefined){b.children(this._options.items).each($.proxy(function(f,h){var g=$(h).data("objectID");if(!this._structure[d]){this._structure[d]=[]}this._structure[d].push(g)},this))}},this));var a=$.extend(true,{data:{offset:this._offset,structure:this._structure}},this._additionalParameters);this._proxy.setOption("data",{actionName:"updatePosition",className:this._className,interfaceName:"wcf\\data\\ISortableAction",parameters:a});this._proxy.sendRequest()},_success:function(b,c,a){if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))}this._notification.show()}});WCF.Popover=Class.extend({_activeElementID:"",_cancelPopover:false,_data:{},_defaultDimensions:{height:150,width:450},_defaultOrientation:{x:"right",y:"top"},_delay:{show:800,hide:500},_hoverElement:false,_hoverElementID:"",_hoverPopover:false,_margin:20,_peOut:null,_peOverElement:null,_popover:null,_popoverContent:null,_popoverOffset:10,_selector:"",init:function(a){if($.browser.mobile){return}this._activeElementID="";this._cancelPopover=false;this._data={};this._defaultDimensions={height:150,width:450};this._defaultOrientation={x:(WCF.Language.get("wcf.global.pageDirection")==="rtl"?"left":"right"),y:"top"};this._delay={show:800,hide:500};this._hoverElement=false;this._hoverElementID="";this._hoverPopover=false;this._margin=20;this._peOut=null;this._peOverElement=null;this._popoverOffset=10;this._selector=a;this._popover=$('<div class="popover"><span class="icon icon48 icon-spinner"></span><div class="popoverContent"></div></div>').hide().appendTo(document.body);this._popoverContent=this._popover.children(".popoverContent:eq(0)");this._popover.hover($.proxy(this._overPopover,this),$.proxy(this._out,this));this._initContainers();WCF.DOMNodeInsertedHandler.addCallback("WCF.Popover."+a,$.proxy(this._initContainers,this));$(window).on("beforeunload",(function(){this._cancelPopover=true;this._hide(true)}).bind(this))},_initContainers:function(){if($.browser.mobile){return}var a=$(this._selector);if(!a.length){return}a.each($.proxy(function(c,d){var b=$(d);var e=b.wcfIdentify();if(!this._data[e]){this._data[e]={content:null,isLoading:false};b.hover($.proxy(this._overElement,this),$.proxy(this._out,this));if(b.is("a")&&b.attr("href")){b.click((function(){this._hide(true)}).bind(this))}}},this))},_overElement:function(a){if(this._cancelPopover){return}if(this._peOverElement!==null){this._peOverElement.stop()}var b=$(a.currentTarget).wcfIdentify();this._hoverElementID=b;this._peOverElement=new WCF.PeriodicalExecuter($.proxy(function(c){c.stop();if(this._hoverElementID===b){this._activeElementID=b;this._prepare()}},this),this._delay.show);this._hoverElement=true;this._hoverPopover=false},_prepare:function(){if(this._cancelPopover){return}if(this._peOut!==null){this._peOut.stop()}if(this._popover.is(":visible")){this._hide(true)}if(!this._data[this._activeElementID].loading&&this._data[this._activeElementID].content){this._popoverContent.html(this._data[this._activeElementID].content);WCF.DOMNodeInsertedHandler.execute()}else{this._data[this._activeElementID].loading=true}var a=this._popover.show().getDimensions();if(this._data[this._activeElementID].loading){a={height:Math.max(a.height,this._defaultDimensions.height),width:Math.max(a.width,this._defaultDimensions.width)}}else{a=this._fixElementDimensions(this._popover,a)}this._popover.hide();var b=this._getOrientation(a.height,a.width);this._popover.css(this._getCSS(b.x,b.y));this._popover.removeClass("bottom left right top").addClass(b.x).addClass(b.y);this._show()},_show:function(){if(this._cancelPopover){return}this._popover.stop().show().css({opacity:1}).wcfFadeIn();if(this._data[this._activeElementID].loading){this._popover.children("span").show();this._loadContent()}else{this._popover.children("span").hide();this._popoverContent.css({opacity:1})}},_loadContent:function(){},_insertContent:function(a,e,c){this._data[a]={content:e,loading:false};if(this._activeElementID===a){if(c){var d=this._popoverContent.getDimensions();this._popoverContent.css({height:"auto",width:"auto"});this._popoverContent.html(this._data[a].content);var f=this._popoverContent.getDimensions();this._popoverContent.html("").css({height:d.height+"px",width:d.width+"px"});var b=this;this._popoverContent.animate({height:f.height+"px",width:f.width+"px"},300,function(){b._popover.children("span").hide();b._popoverContent.html(b._data[a].content).css({opacity:0}).animate({opacity:1},200);WCF.DOMNodeInsertedHandler.execute()})}else{this._popover.children("span").hide();this._popoverContent.html(this._data[a].content);WCF.DOMNodeInsertedHandler.execute()}}},_hide:function(b){var a=this;this._popoverContent.stop();this._popover.stop();if(b){a._popover.css({opacity:0}).hide();a._popoverContent.empty().css({height:"auto",opacity:0,width:"auto"})}else{this._popover.wcfFadeOut(function(){a._popoverContent.empty().css({height:"auto",opacity:0,width:"auto"});a._popover.hide()})}},_overPopover:function(){if(this._peOut!==null){this._peOut.stop()}this._hoverElement=false;this._hoverPopover=true},_out:function(a){if(this._cancelPopover){return}this._hoverElementID="";this._hoverElement=false;this._hoverPopover=false;this._peOut=new WCF.PeriodicalExecuter($.proxy(function(b){b.stop();if(!this._hoverElement&&!this._hoverPopover){this._hide(false)}},this),this._delay.hide)},_getOrientation:function(i,a){var h=$("#"+this._activeElementID);var g=h.getOffsets("offset");var f=h.getDimensions();var b=$(document).getDimensions();var e=(this._defaultOrientation.x==="left")?"left":"right";var d=(this._defaultOrientation.y==="bottom")?"bottom":"top";var c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="left")?"right":"left";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="right")?"left":"right";d=(d==="bottom")?"top":"bottom";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="left")?"right":"left";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(this._defaultOrientationX==="left")?"left":"right";d=(this._defaultOrientationY==="bottom")?"bottom":"top"}}}}return{x:e,y:d}},_evaluateOrientation:function(g,f,b,h,j,i,a){var d=0,e=0;switch(g){case"left":e=b.left-a;break;case"right":e=j.width-(b.left+a);break}switch(f){case"bottom":d=j.height-(b.top+h.height+this._popoverOffset+i);break;case"top":d=b.top-(i-this._popoverOffset);break}var c=false;if(d<this._margin||e<this._margin){c=true}return{flawed:c,x:e,y:d}},_getCSS:function(d,c){var g={bottom:"auto",left:"auto",right:"auto",top:"auto"};var b=$("#"+this._activeElementID);var e=b.getOffsets("offset");var f=this._fixElementDimensions(b,b.getDimensions());var a=$(window).getDimensions();switch(d){case"left":g.right=a.width-(e.left+f.width);break;case"right":g.left=e.left;break}switch(c){case"bottom":g.top=e.top+(f.height+this._popoverOffset);break;case"top":g.bottom=a.height-(e.top-this._popoverOffset);break}return g},_fixElementDimensions:function(a,b){var c=a.parent().getDimensions();if(c.height<b.height){b.height=c.height}if(c.width<b.width){b.width=c.width}return b}});WCF.EditableItemList=Class.extend({_allowCustomInput:false,_className:"",_data:{},_form:null,_itemList:null,_objectID:0,_objectTypeID:0,_search:null,_searchInput:null,init:function(c,a){this._itemList=$(c);this._searchInput=$(a);this._data={};if(!this._itemList.length||!this._searchInput.length){console.debug("[WCF.EditableItemList] Item list and/or search input do not exist, aborting.");return}this._objectID=this._getObjectID();this._objectTypeID=this._getObjectTypeID();this._itemList.find(".jsEditableItem").click($.proxy(this._click,this));if(!this._itemList.children("ul").length){$("<ul />").appendTo(this._itemList)}this._itemList=this._itemList.children("ul");this._form=this._itemList.parents("form").submit($.proxy(this._submit,this));if(this._allowCustomInput){var b=this;this._searchInput.keydown($.proxy(this._keyDown,this)).keypress($.proxy(this._keyPress,this)).on("paste",function(){setTimeout(function(){b._onPaste()},100)})}this._searchInput.parents(".dropdown").data("preventSubmit",true)},_keyDown:function(a){if(a===null){return this._keyPress(null)}return true},_keyPress:function(b){if(b===null||b.charCode===44||b.charCode===$.ui.keyCode.ENTER||($.browser.mozilla&&b.keyCode===$.ui.keyCode.ENTER)){if(b!==null&&b.charCode===$.ui.keyCode.ENTER&&this._search){if(this._search._itemIndex!==-1){return false}}var a=$.trim(this._searchInput.val());if(b&&b.charCode===44){a=a.substring(0,this._searchInput.getCaret())}if(a===""){return true}this.addItem({objectID:0,label:a});if(b&&b.charCode===44){this._searchInput.val($.trim(this._searchInput.val().substr(this._searchInput.getCaret())))}else{this._searchInput.val("")}if(b!==null){b.stopPropagation()}return false}return true},_onPaste:function(){var b=$.trim(this._searchInput.val());b=b.split(",");for(var d=0,c=b.length;d<c;d++){var a=$.trim(b[d]);if(a===""){continue}this.addItem({objectID:0,label:a})}this._searchInput.val("")},load:function(a){},_click:function(d){var b=$(d.currentTarget);var c=b.data("objectID");var a=b.data("label");if(this._search){this._search.removeExcludedSearchValue(a)}this._removeItem(c,a);b.remove();d.stopPropagation();return false},_getObjectID:function(){return 0},_getObjectTypeID:function(){return 0},addItem:function(b){if(this._data[b.objectID]){if(!(b.objectID===0&&this._allowCustomInput)){return true}}var a=$('<li class="badge">'+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},clearList:function(){this._itemList.children("li").each($.proxy(function(b,c){var a=$(c);if(this._search){this._search.removeExcludedSearchValue(a.data("label"))}a.remove();this._removeItem(a.data("objectID"),a.data("label"))},this))},_submit:function(){this._keyDown(null)},_addItem:function(b,a){this._data[b]=a},_removeItem:function(b,a){delete this._data[b]},getSearchInput:function(){return this._searchInput}});WCF.Sitemap=Class.extend({_cache:[],_dialog:null,_didInit:false,_proxy:null,init:function(){$("#sitemap").click($.proxy(this._click,this));this._cache=[];this._dialog=null;this._didInit=false;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_click:function(a){a.preventDefault();if(this._dialog===null){this._dialog=$('<div id="sitemapDialog" />').appendTo(document.body);this._proxy.setOption("data",{actionName:"getSitemap",className:"wcf\\data\\sitemap\\SitemapAction"});this._proxy.sendRequest()}else{this._dialog.wcfDialog("open");$(document).trigger("resize")}},_success:function(b,c,a){if(this._didInit){this._cache.push(b.returnValues.sitemapName);this._dialog.find("#sitemap_"+b.returnValues.sitemapName).html(b.returnValues.template);this._dialog.wcfDialog("render")}else{this._cache.push(b.returnValues.sitemapName);this._dialog.html(b.returnValues.template);this._dialog.find(".sitemapNavigation").click($.proxy(this._navigate,this));this._dialog.find(".tabMenuContainer").wcfTabs("select","sitemap_"+b.returnValues.sitemapName);this._dialog.wcfDialog({title:WCF.Language.get("wcf.page.sitemap")});this._didInit=true}$(document).trigger("resize")},_navigate:function(a){var b=$(a.currentTarget).data("sitemapName");if(WCF.inArray(b,this._cache)){this._dialog.find(".tabMenuContainer").wcfTabs("select","sitemap_"+b);this._dialog.wcfDialog("render")}else{this._proxy.setOption("data",{actionName:"getSitemap",className:"wcf\\data\\sitemap\\SitemapAction",parameters:{sitemapName:b}});this._proxy.sendRequest()}}});WCF.Language.Chooser=Class.extend({_callback:null,_dropdown:null,_input:null,init:function(m,h,g,b,l,f){var n=$("#"+m);if(n.length!=1){console.debug("[WCF.Language.Chooser] Invalid container id '"+m+"' given");return}this._input=$("#"+h);if(!this._input.length){this._input=$('<input type="hidden" name="'+h+'" value="'+g+'" />').appendTo(n)}if(l!==undefined){if(!$.isFunction(l)){console.debug("[WCF.Language.Chooser] Given callback is invalid");return}this._callback=l}this._dropdown=$('<div class="dropdown" id="'+m+'-languageChooser" />').appendTo(n);$('<div class="dropdownToggle boxFlag box24" data-toggle="'+m+'-languageChooser"></div>').appendTo(this._dropdown);var c=$('<ul class="dropdownMenu" />').appendTo(this._dropdown);for(var a in b){var j=b[a];var i=$('<li class="boxFlag"><a class="box24"><div class="framed"><img src="'+j.iconPath+'" alt="" class="iconFlag" /></div> <div><h3>'+j.languageName+"</h3></div></a></li>").appendTo(c);i.data("languageID",a).click($.proxy(this._click,this));if(a==g){var d=$(""+i.html());var k=d.children().detach();this._dropdown.children(".dropdownToggle").empty().append(k)}}if(f){$('<li class="dropdownDivider" />').appendTo(c);var i=$("<li><a>"+WCF.Language.get("wcf.global.language.noSelection")+"</a></li>").data("languageID",0).click($.proxy(this._click,this)).appendTo(c);if(g===0){this._dropdown.children(".dropdownToggle").empty().append(i.html())}}else{if(g===0){var e=$('<div><span class="icon icon24 fa-question" /></div> <div><h3>'+WCF.Language.get("wcf.global.language.noSelection")+"</h3></div>");this._dropdown.children(".dropdownToggle").empty().append(e)}}WCF.Dropdown.destroy(m+"-languageChooser");WCF.Dropdown.init()},_click:function(e){var d=$(e.currentTarget);var c=d.data("languageID");this._input.val(c);var b=$(""+d.html());var a=(c===0)?b:b.children().detach();this._dropdown.children(".dropdownToggle").empty().append(a);if(this._callback!==null){this._callback(d)}}});WCF.Style={};WCF.Style.Chooser=Class.extend({_dialog:null,_proxy:null,init:function(){$('<li class="styleChooser"><a href="#">'+WCF.Language.get("wcf.style.changeStyle")+"</a></li>").appendTo($("#footerNavigation > ul.navigationItems")).click($.proxy(this._showDialog,this));this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_showDialog:function(a){if(a!==null){a.preventDefault()}if(this._dialog===null){this._dialog=$('<div id="styleChooser" />').hide().appendTo(document.body);this._loadDialog()}else{this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.changeStyle")})}},_loadDialog:function(){this._proxy.setOption("data",{actionName:"getStyleChooser",className:"wcf\\data\\style\\StyleAction"});this._proxy.sendRequest()},_success:function(b,c,a){if(b.actionName==="changeStyle"){window.location.reload();return}this._dialog.html(b.returnValues.template);this._dialog.find("li").addClass("pointer").click($.proxy(this._click,this));this._showDialog(null)},_click:function(a){this._proxy.setOption("data",{actionName:"changeStyle",className:"wcf\\data\\style\\StyleAction",objectIDs:[$(a.currentTarget).data("styleID")]});this._proxy.sendRequest()}});WCF.UserPanel=Class.extend({_container:null,_didLoad:false,_link:null,_noItems:"",_revertOnEmpty:true,init:function(a){this._container=$("#"+a);this._didLoad=false;this._revertOnEmpty=true;if(this._container.length!=1){console.debug("[WCF.UserPanel] Unable to find container identfied by '"+a+"', aborting.");return}this._convert()},_convert:function(){this._container.addClass("dropdown");this._link=this._container.children("a").remove();var b=$('<a href="'+this._link.attr("href")+'" class="dropdownToggle">'+this._link.html()+"</a>").appendTo(this._container).click($.proxy(this._click,this));var a=$('<ul class="dropdownMenu" />').appendTo(this._container);$('<li class="jsDropdownPlaceholder"><span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(a);this._addDefaultItems(a);this._container.dblclick($.proxy(function(){window.location=this._link.attr("href");return false},this));WCF.Dropdown.initDropdown(b,false)},_addDefaultItems:function(a){},_addDivider:function(a){$('<li class="dropdownDivider" />').appendTo(a)},_click:function(a){a.preventDefault();if(this._didLoad){return}new WCF.Action.Proxy({autoSend:true,data:this._getParameters(),success:$.proxy(this._success,this)});this._didLoad=true},_getParameters:function(){return{}},_success:function(c,d,b){var a=WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify());a.children(".jsDropdownPlaceholder").remove();if(c.returnValues&&c.returnValues.template){$(""+c.returnValues.template).prependTo(a);this._updateBadge(c.returnValues.totalCount);this._after(a)}else{$("<li><span>"+WCF.Language.get(this._noItems)+"</span></li>").prependTo(a);this._updateBadge(0)}},_updateBadge:function(a){a=parseInt(a)||0;if(a){var b=this._container.find(".badge");if(!b.length){b=$('<span class="badge badgeInverse" />').appendTo(this._container.children(".dropdownToggle"));b.before(" ")}b.html(a)}else{this._container.find(".badge").remove()}},_after:function(a){}});$.widget("ui.wcfDialog",{_closeButton:null,_container:null,_content:null,_overlay:null,_title:null,_titlebar:null,_isOpen:false,options:{autoOpen:true,closable:true,closeButtonLabel:null,closeConfirmMessage:null,closeViaModal:true,hideTitle:false,modal:true,title:"",zIndex:400,onClose:null,onShow:null},_createWidget:function(a,b){if($(b).getTagName()==="script"){console.debug("[ui.wcfDialog] Ignored script tag");this.element=false;return null}$.Widget.prototype._createWidget.apply(this,arguments)},_init:function(){if(this.options.autoOpen){this.open()}$(window).resize($.proxy(this._resize,this))},_create:function(){if(this.options.closeButtonLabel===null){this.options.closeButtonLabel=WCF.Language.get("wcf.global.button.close")}this._container=$('<div class="dialogContainer" />').hide().css({zIndex:this.options.zIndex}).appendTo(document.body);this._titlebar=$('<header class="dialogTitlebar" />').hide().appendTo(this._container);this._title=$('<span class="dialogTitle" />').hide().appendTo(this._titlebar);this._closeButton=$('<a class="dialogCloseButton jsTooltip" title="'+this.options.closeButtonLabel+'"><span /></a>').click($.proxy(this.close,this)).hide().appendTo(this._titlebar);this._content=$('<div class="dialogContent" />').appendTo(this._container);this._setOption("title",this.options.title);this._setOption("closable",this.options.closable);var a=this.element.detach();this._content.html(a);if(this.options.modal){this._overlay=$("#jsWcfDialogOverlay");if(!this._overlay.length){this._overlay=$('<div id="jsWcfDialogOverlay" class="dialogOverlay" />').css({height:"100%",zIndex:399}).hide().appendTo(document.body)}if(this.options.closable&&this.options.closeViaModal){this._overlay.click($.proxy(this.close,this));$(document).keyup($.proxy(function(b){if(b.keyCode&&b.keyCode===$.ui.keyCode.ESCAPE){this.close();b.preventDefault()}},this))}}WCF.DOMNodeInsertedHandler.execute()},_setOption:function(a,b){this.options[a]=b;if(a=="hideTitle"||a=="title"){if(!this.options.hideTitle&&this.options.title!=""){this._title.html(this.options.title).show()}else{this._title.html("")}}else{if(a=="closable"||a=="closeButtonLabel"){if(this.options.closable){this._closeButton.attr("title",this.options.closeButtonLabel).show().find("span").html(this.options.closeButtonLabel);WCF.DOMNodeInsertedHandler.execute()}else{this._closeButton.hide()}}}if((!this.options.hideTitle&&this.options.title!="")||this.options.closable){this._titlebar.show()}else{this._titlebar.hide()}return this},open:function(){if(this.element===false){return}if(this.isOpen()){return}if(this._overlay!==null){WCF.activeDialogs++;if(WCF.activeDialogs===1){this._overlay.show()}}this.render();this._isOpen=true;this._content.find(".jsDialogAutoFocus:visible:first").focus()},isOpen:function(){return this._isOpen},close:function(a){if(!this.isOpen()){return}if(this.options.closeConfirmMessage){WCF.System.Confirmation.show(this.options.closeConfirmMessage,$.proxy(function(b){if(b==="confirm"){this._close()}},this))}else{this._close()}if(a!==undefined){a.preventDefault()}},_close:function(){this._isOpen=false;this._container.wcfFadeOut();if(this._container.data("wcfDialogScrollOffset")){window.scrollTo(0,this._container.data("wcfDialogScrollOffset"))}if(this._overlay!==null){WCF.activeDialogs--;if(WCF.activeDialogs===0){this._overlay.hide()}}if(this.options.onClose!==null){this.options.onClose()}},_resize:function(){if(this.isOpen()){this.render()}},render:function(){if(!this._container.is(":visible")&&this._container.css("top")==="0px"){this._container.data("wcfDialogScrollOffset",$(window).scrollTop());window.scrollTo(0,0)}this._container.show();this._content.children().show();this._content.css({height:"auto",width:"auto"});this._container.stop();this._content.stop();this._container.show().css("opacity",1);var e=0;if(this._content.find(".formSubmit:visible").length){e=this._content.find(".formSubmit").outerHeight();this._content.addClass("dialogForm").css({marginBottom:e+"px"})}else{this._content.removeClass("dialogForm").css({marginBottom:"0px"})}var b=$(window).getDimensions();if(b.width*0.9>800){this._container.css("maxWidth","800px")}var h=this._container.getDimensions("outer");var d=this._content.getDimensions();var e=h.height-d.height;var g=b.height-e-120;this._content.css({maxHeight:g+"px"});this._determineOverflow();h=this._container.getDimensions("outer");var f=Math.round((b.width-h.width)/2);var a=Math.round((b.height-h.height)/2);var c=Math.round((b.height/100)*20);if(c<a){a=c}this._container.css({left:f+"px",top:a+"px"});this._content.css({height:"auto",width:"auto"});if(!this.isOpen()){this._container.hide();this._container.wcfFadeIn($.proxy(function(){if(this.options.onShow!==null){this.options.onShow()}},this))}},_determineOverflow:function(){var b=$(window).getDimensions();var c=this._content.css("maxHeight");this._content.css("maxHeight","none");var e=this._container.getDimensions("outer");var d="visible";if((b.height*0.8<e.height)||(b.width*0.8<e.width)){d="auto"}this._content.css("overflow",d);this._content.css("maxHeight",c);if(d==="visible"){var a=0;this._content.children().each(function(f,g){a+=$(g).outerHeight()});if(this._content.height()<a){d="auto";this._content.css("overflow","auto")}}if($.browser.mozilla&&!$.browser.mobile){if(d==="auto"){this._content.children("div").css("margin-bottom",this._content.css("padding-bottom"))}else{this._content.children("div").css("margin-bottom",false)}}},_getContentDimensions:function(a){var b=this._content.getDimensions();if(a&&b.height>a){b.height=a}return b}});$.widget("ui.wcfSlideshow",{_buttonList:null,_count:0,_index:0,_itemList:null,_items:null,_timer:null,_width:0,options:{cycle:true,cycleInterval:5,itemGap:50,},_create:function(){this._itemList=this.element.children("ul");this._items=this._itemList.children("li");this._count=this._items.length;this._index=0;if(this._count>1){this._initSlideshow()}},_initSlideshow:function(){var b=$(this._items.get(0)).outerHeight();this._items.addClass("slideshowItem");this._width=this.element.css("height",b).innerWidth();this._itemList.addClass("slideshowItemList").css("left",0);this._items.each($.proxy(function(d,e){$(e).show().css({height:b,left:((this._width+this.options.itemGap)*d),width:this._width})},this));this.element.css({height:b,width:this._width}).hover($.proxy(this._hoverIn,this),$.proxy(this._hoverOut,this));this._buttonList=$('<ul class="slideshowButtonList" />').appendTo(this.element);for(var c=0;c<this._count;c++){var a=$('<li><a><span class="icon icon16 icon-circle" /></a></li>').data("index",c).click($.proxy(this._click,this)).appendTo(this._buttonList);if(c==0){a.find(".icon").addClass("active")}}this._resetTimer();$(window).resize($.proxy(this._resize,this))},rebuildHeight:function(){var a=$(this._items.get(0)).css("height","auto");var b=a.outerHeight();this._items.css("height",b+"px");this.element.css("height",b+"px")},_resize:function(){this._width=this.element.css("width","auto").innerWidth();this._items.each($.proxy(function(a,b){$(b).css({left:((this._width+this.options.itemGap)*a),width:this._width})},this));this._index--;this.moveTo(null)},_hoverIn:function(){if(this._timer!==null){this._timer.stop()}},_hoverOut:function(){this._resetTimer()},_resetTimer:function(){if(!this.options.cycle){return}if(this._timer!==null){this._timer.stop()}var a=this;this._timer=new WCF.PeriodicalExecuter(function(){a.moveTo(null)},this.options.cycleInterval*1000)},_click:function(a){this.moveTo($(a.currentTarget).data("index"));this._resetTimer()},moveTo:function(a){this._index=(a===null)?this._index+1:a;if(this._index==this._count){this._index=0}$(this._buttonList.find(".icon").removeClass("active").get(this._index)).addClass("active");this._itemList.css("left",this._index*(this._width+this.options.itemGap)*-1);this._trigger("moveTo",null,{index:this._index})},getItem:function(a){if(this._items[a]){return this._items[a]}return null}});$.widget("ui.wcfTabs",$.ui.tabs,{_sanitizeSelector:function(a){return a.replace(/([:\.])/g,"\\$1")},select:function(a){if(!$.isNumeric(a)){this.panels.each(function(c,b){if($(b).wcfIdentify()===a){a=c;return false}});if(!$.isNumeric(a)){console.debug("[ui.wcfTabs] Unable to find panel identified by '"+a+"', aborting.");return}}this._setOption("active",a)},selectTab:function(a){a="#"+a;this.anchors.each(function(c,b){var d=$(b);if(d.prop("hash")===a){d.trigger("click");return false}})},getCurrentIndex:function(){return this.lis.index(this.lis.filter(".ui-tabs-selected"))},hasAnchor:function(b,a){var c=false;this.anchors.each(function(e,d){var g=$(d).attr("href");if(/#.+/.test(g)){var f=g.split("#",2);if(a){f=f[1].split("-",2)}if(f[1]===b){c=true;return false}}});return c},revertToDefault:function(){var a=this.element.data("active");if(!a||a===""){a=0}this.select(a)},_processTabs:function(){var a=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist");this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1});this.anchors=this.tabs.map(function(){return $("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1});this.panels=$();this.anchors.each(function(f,e){var b,c,d=$(e).uniqueId().attr("id"),g=$(e).closest("li"),h=g.attr("aria-controls");b=e.hash;c=a.element.find(a._sanitizeSelector(b));if(c.length){a.panels=a.panels.add(c)}if(h){g.data("ui-tabs-aria-controls",h)}g.attr({"aria-controls":b.substring(1),"aria-labelledby":d});c.attr("aria-labelledby",d)});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},load:function(a,b){return}});$.widget("ui.wcfPages",{SHOW_LINKS:11,SHOW_SUB_LINKS:20,options:{activePage:1,maxPage:1,nextPage:null,previousPage:null},_create:function(){if(this.options.nextPage===null){this.options.nextPage=WCF.Language.get("wcf.global.page.next")}if(this.options.previousPage===null){this.options.previousPage=WCF.Language.get("wcf.global.page.previous")}this.element.addClass("pageNavigation");this._render()},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);this.element.children().remove()},_render:function(){if(!this.options.disabled&&this.options.maxPage>1){var g=false;if(this.element.hasClass("hidden")){this.element.removeClass("hidden")}this.element.show();this.element.children().remove();var o=$("<ul />");this.element.append(o);var n=$('<li class="button skip" />');o.append(n);if(this.options.activePage>1){var d=$("<a"+((this.options.previousPage!=null)?(' title="'+this.options.previousPage+'"'):(""))+"></a>");n.append(d);this._bindSwitchPage(d,this.options.activePage-1);var l=$('<span class="icon icon16 icon-double-angle-left" />');d.append(l)}else{var l=$('<span class="icon icon16 icon-double-angle-left" />');n.append(l);n.addClass("disabled").removeClass("button");l.addClass("disabled")}o.append(this._renderLink(1));var a=this.SHOW_LINKS-4;var e=this.options.activePage-2;if(e<0){e=0}var i=this.options.maxPage-(this.options.activePage+1);if(i<0){i=0}if(this.options.activePage>1&&this.options.activePage<this.options.maxPage){a--}var k=a/2;var c=this.options.activePage;var j=this.options.activePage;if(c<1){c=1}if(j<1){j=1}if(j>this.options.maxPage-1){j=this.options.maxPage-1}if(e>=k){c-=k}else{c-=e;j+=k-e}if(i>=k){j+=k}else{j+=i;c-=k-i}j=Math.ceil(j);c=Math.ceil(c);if(c<1){c=1}if(j>this.options.maxPage){j=this.options.maxPage}if(c>1){if(c-1<2){o.append(this._renderLink(2))}else{$('<li class="button jumpTo"><a title="'+WCF.Language.get("wcf.global.page.jumpTo")+'" class="jsTooltip">...</a></li>').appendTo(o);g=true}}for(var m=c+1;m<j;m++){o.append(this._renderLink(m))}if(j<this.options.maxPage){if(this.options.maxPage-j<2){o.append(this._renderLink(this.options.maxPage-1))}else{$('<li class="button jumpTo"><a title="'+WCF.Language.get("wcf.global.page.jumpTo")+'" class="jsTooltip">...</a></li>').appendTo(o);g=true}}o.append(this._renderLink(this.options.maxPage));var h=$('<li class="button skip" />');o.append(h);if(this.options.activePage<this.options.maxPage){var f=$("<a"+((this.options.nextPage!=null)?(' title="'+this.options.nextPage+'"'):(""))+"></a>");h.append(f);this._bindSwitchPage(f,this.options.activePage+1);var b=$('<span class="icon icon16 icon-double-angle-right" />');f.append(b)}else{var b=$('<span class="icon icon16 icon-double-angle-right" />');h.append(b);h.addClass("disabled").removeClass("button");b.addClass("disabled")}if(g){o.data("pages",this.options.maxPage);WCF.System.PageNavigation.init("#"+o.wcfIdentify(),$.proxy(function(p){this.switchPage(p)},this))}}else{this.element.hide()}},_renderLink:function(d,a){var e=$('<li class="button"></li>');if(a!=undefined&&a){e.addClass("break")}if(d!=this.options.activePage){var b=$("<a>"+WCF.String.addThousandsSeparator(d)+"</a>");e.append(b);this._bindSwitchPage(b,d)}else{e.addClass("active");var c=$("<span>"+WCF.String.addThousandsSeparator(d)+'</span><span class="invisible">'+WCF.Language.get("wcf.page.pagePosition",{pageNo:d,pages:this.options.maxPage})+"</span>");e.append(c)}return e},_bindSwitchPage:function(a,b){var c=this;a.click(function(){c.switchPage(b)})},switchPage:function(a){this._setOption("activePage",a)},_setOption:function(b,c){if(b=="activePage"){if(c!=this.options[b]&&c>0&&c<=this.options.maxPage){var a=this._trigger("shouldSwitch",undefined,{nextPage:c});if(a||a!==undefined){this.options[b]=c;this._render();this._trigger("switched",undefined,{activePage:c})}else{this._trigger("notSwitched",undefined,{activePage:c})}}}else{this.options[b]=c;if(b=="disabled"){if(c){this.element.children().remove()}else{this._render()}}else{if(b=="maxPage"){this._render()}}}return this},_startInput:function(b){var a=$(b.currentTarget);if(!a.is("a")){a=a.parent("a")}a.hide();var c=a.parent("li").children("input").css("display","block").val("");c.focus()},_stopInput:function(b){var c=$(b.currentTarget);c.css("display","none");var a=c.parent("li");if(a!=undefined&&a!=null){a.children("a").show()}},_handleInput:function(b){var a=($.browser.msie&&$.browser.version=="7.0");if(b.type!="keyup"||a){if(!a||((b.which==13||b.which==27)&&b.type=="keyup")){if(b.which==13){this.switchPage(parseInt($(b.currentTarget).val()))}if(b.which==13||b.which==27){this._stopInput(b);b.stopPropagation()}}}}});WCF.Category={};WCF.Category.NestedList=Class.extend({_categories:{},init:function(){var a=this;$(".jsCategory").each(function(c,d){var b=$(d).data("parentCategoryID",null).change($.proxy(a._updateSelection,a));a._categories[b.val()]=b;var e=[];b.parents("li").find(".jsChildCategory").each(function(h,g){var f=$(g).data("parentCategoryID",b.val()).change($.proxy(a._updateSelection,a));a._categories[f.val()]=f;e.push(f.val());if(f.is(":checked")){b.prop("checked","checked")}});b.data("childCategoryIDs",e)})},_updateSelection:function(b){var a=$(b.currentTarget);var f=a.data("parentCategoryID");if(a.is(":checked")){if(f!==null){this._categories[f].prop("checked","checked")}}else{if(f===null){var e=a.data("childCategoryIDs");for(var d=0,c=e.length;d<c;d++){this._categories[e[d]].prop("checked",false)}}}}});WCF.Category.FlexibleCategoryList=Class.extend({_list:null,_categories:{},init:function(a){this._list=$("#"+a);this._buildStructure();this._list.find("input:checked").each(function(){$(this).trigger("change")});if(this._list.children("li").length<2){this._list.addClass("flexibleCategoryListDisabled");return}if($.browser.chrome){this._resize();$(window).resize(this._resize.bind(this))}},_buildStructure:function(){var a=this;this._list.find(".jsCategory").each(function(d,f){var c=$(f).change(a._updateSelection.bind(a));var e=parseInt(c.val());var b=[];c.parents("li:eq(0)").find(".jsChildCategory").each(function(h,k){var g=$(k);g.data("parentCategory",c).change(a._updateSelection.bind(a));var i=parseInt(g.val());b.push(g);var l=[];g.parents("li:eq(0)").find(".jsSubChildCategory").each(function(m,j){var n=$(j);n.data("parentCategory",g).change(a._updateSelection.bind(a));l.push(n)});a._categories[i]=l});a._categories[e]=b})},_resize:function(){var a=-1;var b=0;var c=this._list.children("li");c.each(function(g,h){if(a===-1||g+1===c.length||c[g+1].offsetLeft!=a){var e=$(h);var f=e.outerHeight(true);var d=e.position();b=Math.max(b,d.top+f);a=h.offsetLeft}});this._list.css("max-height",b+"px")},_updateSelection:function(a){var g=$(a.currentTarget);var e=parseInt(g.val());var d=g.data("parentCategory");if(g.is(":checked")){if(d){d.prop("checked","checked");d=d.data("parentCategory");if(d){d.prop("checked","checked")}}}else{if(this._categories[e]){for(var k=0,h=this._categories[e].length;k<h;k++){var i=this._categories[e][k];i.prop("checked",false);var f=parseInt(i.val());if(this._categories[f]){for(var j=0,b=this._categories[f].length;j<b;j++){this._categories[f][j].prop("checked",false)}}}}if(d){var c=parseInt(d.val());for(var k=0,h=this._categories[c].length;k<h;k++){if(this._categories[c][k].prop("checked")){return}}d=d.data("parentCategory");if(d){c=parseInt(d.val());for(var k=0,h=this._categories[c].length;k<h;k++){if(this._categories[c][k].prop("checked")){return}}}}}}});WCF.Condition={};WCF.Condition.PageControllerDependence=Class.extend({_pageControllerSelection:null,_supportedPageObjectTypeIDs:[],init:function(a,b){this._supportedPageObjectTypeIDs=b;this._pageControllerSelection=$("#pageControllers").change($.proxy(this._checkVisibility,this));this._pageControllerContainer=this._pageControllerSelection.parents("dl:eq(0)");this._fieldset=this._pageControllerContainer.parent("fieldset");this._nextFieldset=this._fieldset.next("fieldset");if(this._nextFieldset){this._nextFieldset.data("margin-top",this._nextFieldset.css("margin-top"))}this._input=$("#"+a);this._inputContainer=this._input.parents("dl:eq(0)");this._checkVisibility()},_checkVisibility:function(){var b=this._pageControllerSelection.val()||[];var a=true;if(b.length){for(var d=0,c=b.length;d<c;d++){if(this._supportedPageObjectTypeIDs.indexOf(parseInt(b[d]))==-1){a=false;break}}}else{a=false}if(a){this._inputContainer.show();this._input.enable();this._fieldset.show();if(this._nextFieldset){this._nextFieldset.css("margin-top",this._nextFieldset.data("margin-top"))}}else{this._inputContainer.hide();this._input.disable();if(!this._fieldset.children("dl:visible").length){this._fieldset.hide();if(this._nextFieldset){this._nextFieldset.css("margin-top",0)}}}}});WCF.Notice={};WCF.Notice.Dismiss=Class.extend({_notices:{},_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var a=$(".jsDismissNoticeButton").click($.proxy(this._click,this));a.each($.proxy(function(b,c){this._notices[$(c).data("objectID")]=$(c).parent()},this))},_click:function(a){this._proxy.setOption("data",{actionName:"dismiss",className:"wcf\\data\\notice\\NoticeAction",objectIDs:[$(a.currentTarget).data("objectID")]});this._proxy.sendRequest()},_success:function(b,c,a){this._notices[b.returnValues.noticeID].wcfFadeOut()}});function wcfEval(expression){return eval(expression)}; })(this);
+(function (window, undefined) {"use strict";(function(){var c=jQuery.fn.data;jQuery.fn.data=function(f,h){if(f){switch(typeof f){case"object":for(var g in f){if(g.match(/ID$/)){var e=f[g];delete f[g];g=g.replace(/ID$/,"-id");f[g]=e}}arguments[0]=f;break;case"string":if(f.match(/ID$/)){arguments[0]=f.replace(/ID$/,"-id")}break}}var d=c.apply(this,arguments);if(f===undefined){for(var g in d){if(g.match(/Id$/)){d[g.replace(/Id$/,"ID")]=d[g];delete d[g]}}}return d};if(!window.console){window.console={}}var b=["log","info","warn","exception","assert","dir","dirxml","trace","group","groupEnd","groupCollapsed","profile","profileEnd","count","clear","time","timeEnd","timeStamp","table","error"];for(var a=0;a<b.length;a++){if(typeof(console[b[a]])==="undefined"){console[b[a]]=function(){}}}if(typeof(console.debug)==="undefined"){console.debug=function(d){console.log(d)}}})();String.prototype.hashCode=function(){var a;var b=0;if(this.length){for(var d=0,c=this.length;d<c;d++){a=this.charCodeAt(d);b=((b<<5)-b)+a;b=b&b}}return b};window.shuffle=function(d){var c=d.length,b,a;while(0!==c){a=Math.floor(Math.random()*c);c-=1;b=d[c];d[c]=d[a];d[a]=b}return this};(function(e){var d=navigator.userAgent.toLowerCase();var c=/(chrome)[ \/]([\w.]+)/.exec(d)||/(webkit)[ \/]([\w.]+)/.exec(d)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(d)||/(msie) ([\w.]+)/.exec(d)||d.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(d)||[];var a={browser:c[1]||"",version:c[2]||"0"};var b={};if(a.browser){b[a.browser]=true;b.version=a.version}if(b.chrome){b.webkit=true}else{if(b.webkit){b.safari=true}}e.browser=e.browser||{};e.browser=$.extend(e.browser,b);e.browser.touch=(!!("ontouchstart" in window)||(!!("msMaxTouchPoints" in window.navigator)&&window.navigator.msMaxTouchPoints>0));e.browser.smartphone=($("html").css("caption-side")=="bottom");if(e.browser.mozilla&&d.match(/trident/)){e.browser.mozilla=false;e.browser.msie=true}e.browser.iOS=/\((ipad|iphone|ipod);/.test(d);if(e.browser.iOS){$("html").addClass("iOS")}e.browser.android=(d.indexOf("android")!==-1);e.browser.editor="redactor";e.browser.ckeditor=false;e.browser.redactor=true;if(e.browser.iOS){e.fn.focus=function(){return arguments[0]}}})(jQuery);window.WCF={};$.extend(true,{removeArrayValue:function(b,a){return $.grep(b,function(d,c){return a!==d})},wcfEscapeID:function(a){return a.replace(/(:|\.)/g,"\\$1")},wcfIsset:function(a){return !!$("#"+$.wcfEscapeID(a)).length},getLength:function(a){var c=0;for(var b in a){if(a.hasOwnProperty(b)){c++}}return c}});$.fn.extend({getTagName:function(){return(this.length)?this.get(0).tagName.toLowerCase():""},getDimensions:function(c){var b={};var d={};var a=false;if(this.is(":hidden")){b=WCF.getInlineCSS(this);a=true;this.css({display:"block",visibility:"hidden"})}switch(c){case"inner":d={height:this.innerHeight(),width:this.innerWidth()};break;case"outer":d={height:this.outerHeight(),width:this.outerWidth()};break;default:d={height:this.height(),width:this.width()};break}if(a){WCF.revertInlineCSS(this,b,["display","visibility"])}return d},getOffsets:function(c){var b={};var d={};var a=false;if(this.is(":hidden")){b=WCF.getInlineCSS(this);a=true;this.css({display:"block",visibility:"hidden"})}switch(c){case"offset":d=this.offset();break;case"position":default:d=this.position();break}if(a){WCF.revertInlineCSS(this,b,["display","visibility"])}return d},makePositioned:function(a,b){if(a!="absolute"&&a!="fixed"){a="absolute"}var c=this.getOffsets("position");this.css({position:a,left:c.left,margin:0,top:c.top});if(b){this.remove().appentTo("body")}return this},disable:function(){return this.attr("disabled","disabled")},enable:function(){return this.removeAttr("disabled")},wcfIdentify:function(){if(!this.attr("id")){this.attr("id",WCF.getRandomID())}return this.attr("id")},getCaret:function(){if(this.is("input")){if(this.attr("type")!="text"&&this.attr("type")!="password"){return -1}}else{if(!this.is("textarea")){return -1}}var c=0;var b=this.get(0);if(document.selection){this.focus();var a=document.selection.createRange();a.moveStart("character",-this.val().length);c=a.text.length}else{if(b.selectionStart||b.selectionStart=="0"){c=parseInt(b.selectionStart)}}return c},setCaret:function(b){if(this.is("input")){if(this.attr("type")!="text"&&this.attr("type")!="password"){return false}}else{if(!this.is("textarea")){return false}}var c=this.get(0);this.focus();if(document.selection){var a=document.selection.createRange();a.moveStart("character",b);a.moveEnd("character",0);a.select()}else{if(c.selectionStart||c.selectionStart=="0"){c.selectionStart=b;c.selectionEnd=b}}return true},wcfDropIn:function(b,c,a){if(!b){b="up"}if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"drop"),{direction:b},a,c)},wcfDropOut:function(b,c,a){if(!b){b="down"}if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"drop"),{direction:b},a,c)},wcfBlindIn:function(b,c,a){if(!b){b="vertical"}if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"blind"),{direction:b},a,c)},wcfBlindOut:function(b,c,a){if(!b){b="vertical"}if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"blind"),{direction:b},a,c)},wcfHighlight:function(a,b){return this.effect("highlight",a,600,b)},wcfFadeIn:function(b,a){if(!a||!parseInt(a)){a=200}return this.show(WCF.getEffect(this,"fade"),{},a,b)},wcfFadeOut:function(b,a){if(!a||!parseInt(a)){a=200}return this.hide(WCF.getEffect(this,"fade"),{},a,b)},cssAsNumber:function(b){if(this.length){var a=this.css(b);if(a!==undefined){return parseInt(a.replace(/px$/,""))}}return 0}});$.extend(WCF,{activeDialogs:0,_idCounter:0,getRandomID:function(){var a="";do{a="wcf"+this._idCounter++}while($.wcfIsset(a));return a},inArray:function(b,a){return($.inArray(b,a)!=-1)},getEffect:function(a,b){if(a.is("tr")){return"highlight"}return b},getInlineCSS:function(b){var c={};var a=b.attr("style");if(!a){return{}}a=a.split(";");for(var f=0,d=a.length;f<d;f++){var e=$.trim(a[f]);if(e==""){continue}e=e.split(":");c[$.trim(e[0])]=$.trim(e[1])}return c},revertInlineCSS:function(a,c,e){for(var f=0,d=e.length;f<d;f++){var b=e[f];if(c[b]){a.css(b,c[b])}else{a.css(b,"")}}},getUUID:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(d){var b=Math.random()*16|0,a=d=="x"?b:(b&3|8);return a.toString(16)})},base64toBlob:function(h,g,a){g=g||"";a=a||512;var c=atob(h);var b=[];for(var j=0;j<c.length;j+=a){var f=c.slice(j,j+a);var d=new Array(f.length);for(var i=0;i<f.length;i++){d[i]=f.charCodeAt(i)}var e=new Uint8Array(d);b.push(e)}return new Blob(b,{type:g})},convertLegacyURL:function(a){if(URL_LEGACY_MODE){return a}return a.replace(/^index\.php\/(.*?)\/\?/,function(d,c){var e=c.split(/([A-Z][a-z0-9]+)/);var b="";for(var h=0,f=e.length;h<f;h++){var g=e[h].trim();if(g.length){if(b.length){b+="-"}b+=g.toLowerCase()}}return"index.php?"+b+"/&"})}});WCF.Browser={_isChrome:null,isChrome:function(){if(this._isChrome===null){this._isChrome=false;if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase())){this._isChrome=true}}return this._isChrome}};WCF.Dropdown={_callbacks:{},_didInit:false,_dropdowns:{},_menuContainer:null,_menus:{},init:function(){if(this._menuContainer===null){this._menuContainer=$('<div id="dropdownMenuContainer" />').appendTo(document.body)}var a=this;$(".dropdownToggle:not(.jsDropdownEnabled)").each(function(b,c){a.initDropdown($(c),false)});if(!this._didInit){this._didInit=true;WCF.CloseOverlayHandler.addCallback("WCF.Dropdown",$.proxy(this._closeAll,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.Dropdown",$.proxy(this.init,this));$(document).on("scroll",$.proxy(this._scroll,this))}},_dialogScroll:function(b){var a=$(b.currentTarget);a.find(".dropdown.dropdownOpen").each(function(d,f){var i=$(f);var e=i.wcfIdentify();var g=i.offset();var c=a.offset();var h=$(f).height()/2;if(g.top+h<=c.top){WCF.Dropdown.toggleDropdown(e)}else{if(g.top>=c.top+a.height()){WCF.Dropdown.toggleDropdown(e)}else{if(g.left<=c.left){WCF.Dropdown.toggleDropdown(e)}else{if(g.left>=c.left+a.width()){WCF.Dropdown.toggleDropdown(e)}else{WCF.Dropdown.setAlignmentByID(i.wcfIdentify())}}}}})},_scroll:function(b){for(var a in this._dropdowns){var c=this._dropdowns[a];if(c.data("isOverlayDropdownButton")&&c.hasClass("dropdownOpen")){this.setAlignmentByID(a)}}},initDropdown:function(b,d){if(b.hasClass("jsDropdownEnabled")||b.data("target")){return}var e=b.parents(".dropdown");if(!e.length){console.debug("[WCF.Dropdown] Invalid dropdown passed, button '"+b.wcfIdentify()+"' does not have a parent with .dropdown, aborting.");return}var a=b.next(".dropdownMenu");if(!a.length){console.debug("[WCF.Dropdown] Invalid dropdown passed, dropdown '"+e.wcfIdentify()+"' does not have a dropdown menu, aborting.");return}a.detach().appendTo(this._menuContainer);var c=e.wcfIdentify();if(!this._dropdowns[c]){b.addClass("jsDropdownEnabled").click($.proxy(this._toggle,this));this._dropdowns[c]=e;this._menus[c]=a;if(!c.match(/^wcf\d+$/)){a.attr("data-source",c)}}b.data("target",c);if(d){b.trigger("click")}},removeDropdown:function(a){if(this._menus[a]){$(this._menus[a]).remove();delete this._menus[a];delete this._dropdowns[a]}},initDropdownFragment:function(c,a){var b=c.wcfIdentify();if(this._dropdowns[b]){console.debug("[WCF.Dropdown] Cannot register dropdown identified by '"+b+"' as a fragement.");return}this._dropdowns[b]=c;this._menus[b]=a.detach().appendTo(this._menuContainer)},registerCallback:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.Dropdown] Callback for '"+a+"' is invalid");return false}if(!this._callbacks[a]){this._callbacks[a]=[]}this._callbacks[a].push(b)},_toggle:function(g,e){var b=(g===null)?e:$(g.currentTarget).data("target");var a=this._dropdowns[b];if(a&&a.data("isOverlayDropdownButton")===undefined){var d=a.parents(".dialogContent");a.data("isOverlayDropdownButton",d.length>0);if(d.length){d.on("scroll",this._dialogScroll)}}for(var f in this._dropdowns){var h=this._dropdowns[f];var c=this._menus[f];if(h.hasClass("dropdownOpen")){h.removeClass("dropdownOpen");c.removeClass("dropdownOpen");this._notifyCallbacks(f,"close")}else{if(f===b&&c[0].children.length>0){h.addClass("dropdownOpen");c.addClass("dropdownOpen");this._notifyCallbacks(f,"open");this.setAlignment(h,c)}}}WCF.Dropdown.Interactive.Handler.closeAll();if(g!==null){g.stopPropagation();return false}},toggleDropdown:function(a){this._toggle(null,a)},getDropdown:function(a){if(this._dropdowns[a]){return this._dropdowns[a]}return null},getDropdownMenu:function(a){if(this._menus[a]){return this._menus[a]}return null},setAlignmentByID:function(a){var c=this.getDropdown(a);if(c===null){console.debug("[WCF.Dropdown] Unable to find dropdown identified by '"+a+"'")}var b=this.getDropdownMenu(a);if(b===null){console.debug("[WCF.Dropdown] Unable to find dropdown menu identified by '"+a+"'")}this.setAlignment(c,b)},setAlignment:function(t,u){if(!u.data("isInitialized")){u.data("isInitialized",true).css({left:0,top:0})}var p=t.getDimensions("outer");var g=t.getOffsets("offset");var s=u.getDimensions("outer");var i=$(window).width();var d=t.find(".dropdownToggle");if(d.hasClass("dropdownCaptionTextarea")){p=d.getDimensions("outer")}var f="left";if((g.left+s.width)>i){f="right"}var j="auto";var l="auto";if(f==="left"){u.removeClass("dropdownArrowRight");j=g.left}else{u.addClass("dropdownArrowRight");l=(i-(g.left+p.width))}if(WCF.Language.get("wcf.global.pageDirection")=="rtl"){var r=j;var n=l;if(j=="auto"){u.removeClass("dropdownArrowRight")}else{l=i-(g.left+p.width);j="auto";if(l+s.width>i){j=r;l=n;u.addClass("dropdownArrowRight")}}}if(j=="auto"){l+="px"}else{j+="px"}var q=true;if(u.hasClass("dropdownOpen")){q=false;u.removeClass("dropdownOpen")}var m="auto";var v=g.top+p.height+7;if($.browser.smartphone){var f="bottom";var c=false;var e=$(window).height();var h=v+s.height;if(h>e){var b=g.top+10-s.height;if(b>=0){f="top"}else{c=true;var a=Math.abs(b);var o=Math.abs(h-e);if(o<=a){f="bottom"}else{f="top"}}}if(f=="top"){m=$(window).height()-g.top+10;v="auto";if(c){v=0;u.children("ul.scrollableDropdownMenu").css("max-height",m)}u.addClass("dropdownArrowBottom")}else{if(c){m=0;var k=u.children("ul.scrollableDropdownMenu");k.css("max-height",Math.min(k.css("max-height").replace(/px$/,""),e-v))}u.removeClass("dropdownArrowBottom")}}else{if(v+s.height>$(window).height()+$(document).scrollTop()){m=$(window).height()-g.top+10;v="auto";u.addClass("dropdownArrowBottom")}else{u.removeClass("dropdownArrowBottom")}}if(!q){u.addClass("dropdownOpen")}u.css({bottom:m,left:j,right:l,top:v})},_closeAll:function(){for(var a in this._dropdowns){var b=this._dropdowns[a];if(b.hasClass("dropdownOpen")){b.removeClass("dropdownOpen");this._menus[a].removeClass("dropdownOpen");this._notifyCallbacks(a,"close")}}},close:function(a){if(!this._dropdowns[a]){return}this._dropdowns[a].removeClass("dropdownOpen");this._menus[a].removeClass("dropdownOpen")},_notifyCallbacks:function(a,b){if(!this._callbacks[a]){return}for(var d=0,c=this._callbacks[a].length;d<c;d++){this._callbacks[a][d](a,b)}},destroy:function(a){if(this._dropdowns[a]===undefined){return false}this.close(a);this._menus[a].remove();delete this._menus[a];delete this._dropdowns[a]}};WCF.Dropdown.Interactive={};WCF.Dropdown.Interactive.Handler={_dropdownContainer:null,_dropdownMenus:{},create:function(d,b,a){if(this._dropdownContainer===null){this._dropdownContainer=$('<div class="dropdownMenuContainer" />').appendTo(document.body);WCF.CloseOverlayHandler.addCallback("WCF.Dropdown.Interactive.Handler",$.proxy(this.closeAll,this))}var c=new WCF.Dropdown.Interactive.Instance(this._dropdownContainer,d,b,a);this._dropdownMenus[b]=c;return c},open:function(a){if(this._dropdownMenus[a]){this._dropdownMenus[a].open();return true}return false},close:function(a){if(this._dropdownMenus[a]){this._dropdownMenus[a].close();return true}return false},closeAll:function(){$.each(this._dropdownMenus,function(b,a){a.close()})}};WCF.Dropdown.Interactive.Instance=Class.extend({_container:null,_itemList:null,_linkList:null,_options:{},_pointer:null,_triggerElement:null,init:function(e,d,c,b){this._options=b||{};this._triggerElement=d;var f=null;if(b.staticDropdown===true){this._container=this._triggerElement.find(".interactiveDropdownStatic:eq(0)").data("source",c).click(function(g){g.stopPropagation()})}else{this._container=$('<div class="interactiveDropdown" data-source="'+c+'" />').click(function(g){g.stopPropagation()});var a=$('<div class="interactiveDropdownHeader" />').appendTo(this._container);$('<span class="interactiveDropdownTitle">'+b.title+"</span>").appendTo(a);this._linkList=$('<ul class="interactiveDropdownLinks"></ul>').appendTo(a);f=$('<div class="interactiveDropdownItemsContainer" />').appendTo(this._container);this._itemList=$('<ul class="interactiveDropdownItems" />').appendTo(f);$('<a href="'+b.showAllLink+'" class="interactiveDropdownShowAll">'+WCF.Language.get("wcf.user.panel.showAll")+"</a>").appendTo(this._container)}this._pointer=$('<span class="pointer"><span /></span>').appendTo(this._container);if(!$.browser.mobile&&f!==null){f.perfectScrollbar({suppressScrollX:true})}this._container.appendTo(e)},getContainer:function(){return this._container},getItemList:function(){return this._itemList},getLinkList:function(){return this._linkList},open:function(){WCF.Dropdown._closeAll();this._container.addClass("open");this.render()},close:function(){this._container.removeClass("open")},toggle:function(){if(this._container.hasClass("open")){this.close();return false}else{WCF.Dropdown.Interactive.Handler.closeAll();this.open();return true}},resetItems:function(){this._itemList.empty();this.close()},render:function(){var a=WCF.Language.get("wcf.global.pageDirection");if($("html").css("caption-side")==="bottom"){this._renderMobile(a)}else{this._renderDesktop(a)}},rebuildScrollbar:function(){if(!$.browser.mobile){var a=this._itemList.parent();a.perfectScrollbar("destroy");a.perfectScrollbar({suppressScrollX:true})}},_renderMobile:function(b){var d=this._triggerElement.getDimensions("outer");var c=Math.floor(d.width/2);var e=this._triggerElement.getOffsets("offset");var a=Math.floor(this._pointer.outerWidth()/2);this._container.css({top:e.top+d.height+"px"});this._pointer.css({left:(e.left+c)-a+"px"})},_renderDesktop:function(b){var e=this._triggerElement.getDimensions("outer");var f=this._triggerElement.getOffsets("offset");var d=this._container.getDimensions();var g=$(window).width();var c=null;var a=null;if(b==="ltr"){c=this._getPositionLeft(f,d,g);if(!c.result){a=this._getPositionRight(f,d,e,g);if(a.result){c=null}else{a=null}}}else{a=this._getPositionRight(f,d,e,g);if(!a.result){c=this._getPositionLeft(f,d,g);if(c.result){a=null}else{c=null}}}if(a===null){this._container.css({left:c.left+"px",top:f.top+e.height+"px"});this._pointer.css({left:(this._options.pointerOffset?this._options.pointerOffset:"4px")})}else{this._container.css({right:a.right+"px",top:f.top+e.height+"px"});this._pointer.css({right:(this._options.pointerOffset?this._options.pointerOffset:"4px")})}},_getPositionLeft:function(d,e,b){var c=d.left;var a=d.left+e.width;return{left:c,result:(a<b)}},_getPositionRight:function(e,f,b,c){var d=(e.left+b.width)-f.width;var a=c-(e.left+b.width);return{result:(d>0),right:a}}});WCF.Clipboard={_actionProxy:null,_actionObjects:{},_containers:null,_containerData:{},_hasMarkedItems:false,_markedObjectIDs:{},_page:"",_pageObjectID:0,_proxy:null,_trackedElements:{},init:function(d,b,e,c){this._page=d;this._actionObjects=e||{};this._hasMarkedItems=(b>0);this._pageObjectID=parseInt(c)||0;this._actionProxy=new WCF.Action.Proxy({success:$.proxy(this._actionSuccess,this),url:"index.php/ClipboardProxy/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),url:"index.php/Clipboard/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._containers=$(".jsClipboardContainer").each($.proxy(function(g,f){this._initContainer(f)},this));if(this._hasMarkedItems&&this._containers.length){this._loadMarkedItems()}var a=this;WCF.DOMNodeInsertedHandler.addCallback("WCF.Clipboard",function(){a._containers=$(".jsClipboardContainer").each($.proxy(function(g,f){a._initContainer(f)},a))})},_loadMarkedItems:function(){new WCF.Action.Proxy({autoSend:true,data:{containerData:this._containerData,pageClassName:this._page,pageObjectID:this._pageObjectID},success:$.proxy(this._loadMarkedItemsSuccess,this),url:"index.php/ClipboardLoadMarkedItems/?t="+SECURITY_TOKEN+SID_ARG_2ND})},reload:function(){if(this._containers===null){return}this._loadMarkedItems()},_loadMarkedItemsSuccess:function(d,f,c){this._resetMarkings();for(var a in d.markedItems){if(!this._markedObjectIDs[a]){this._markedObjectIDs[a]=[]}var b=d.markedItems[a];for(var e in b){this._markedObjectIDs[a].push(b[e])}this._containers.each($.proxy(function(h,g){var i=$(g);if(i.data("type")!=a){return true}i.find("input.jsClipboardItem").each($.proxy(function(l,k){var j=$(k);if(WCF.inArray(j.data("objectID"),this._markedObjectIDs[a])){j.prop("checked",true);j.parents(".jsClipboardObject").addClass("jsMarked")}},this));i.find("input.jsClipboardMarkAll").each(function(l,k){var j=true;i.find("input.jsClipboardItem").each(function(n,o){var m=$(o);if(!m.prop("checked")){j=false}});if(j){$(k).prop("checked",true)}})},this))}this._success(d,f,c)},_resetMarkings:function(){this._containers.each($.proxy(function(b,a){var c=$(a);this._markedObjectIDs[c.data("type")]=[];c.find("input.jsClipboardItem, input.jsClipboardMarkAll").prop("checked",false);c.find(".jsClipboardObject").removeClass("jsMarked")},this))},_initContainer:function(a){var c=$(a);var b=c.wcfIdentify();if(!this._trackedElements[b]){c.find(".jsClipboardMarkAll").data("hasContainer",b).click($.proxy(this._markAll,this));this._markedObjectIDs[c.data("type")]=[];this._containerData[c.data("type")]={};$.each(c.data(),$.proxy(function(d,e){if(d.match(/^type(.+)/)){this._containerData[c.data("type")][WCF.String.lcfirst(d.replace(/^type/,""))]=e}},this));this._trackedElements[b]=[]}c.find("input.jsClipboardItem").each($.proxy(function(f,e){var g=$(e);var d=g.wcfIdentify();if(!WCF.inArray(d,this._trackedElements[b])){this._trackedElements[b].push(d);g.data("hasContainer",b).click($.proxy(this._click,this))}},this))},_click:function(f){var b=$(f.target);var e=b.data("objectID");var h=(b.prop("checked"))?true:false;var d=[e];if(b.data("hasContainer")){var g=$("#"+b.data("hasContainer"));var a=g.data("type")}else{var a=b.data("type")}if(h){this._markedObjectIDs[a].push(e);b.parents(".jsClipboardObject").addClass("jsMarked")}else{this._markedObjectIDs[a]=$.removeArrayValue(this._markedObjectIDs[a],e);b.parents(".jsClipboardObject").removeClass("jsMarked")}if(b.data("hasContainer")){var c=true;g.find("input.jsClipboardItem").each(function(j,i){var k=$(i);if(!k.prop("checked")){c=false}});g.find(".jsClipboardMarkAll").each(function(i,j){if(c){$(j).prop("checked",true)}else{$(j).prop("checked",false)}})}this._saveState(a,d,h)},_markAll:function(d){var b=$(d.target);var c=[];var f=true;if(b.is("input")){f=b.prop("checked")}if(b.data("hasContainer")){var e=$("#"+b.data("hasContainer"));var a=e.data("type")}else{var a=b.data("type")}if(b.data("hasContainer")){e.find("input.jsClipboardItem").each($.proxy(function(h,g){var j=$(g);var i=j.data("objectID");if(f){if(!j.prop("checked")){j.prop("checked",true);this._markedObjectIDs[a].push(i);c.push(i)}}else{if(j.prop("checked")){j.prop("checked",false);this._markedObjectIDs[a]=$.removeArrayValue(this._markedObjectIDs[a],i);c.push(i)}}},this));if(f){e.find(".jsClipboardObject").addClass("jsMarked")}else{e.find(".jsClipboardObject").removeClass("jsMarked")}}this._saveState(a,c,f)},_saveState:function(b,c,a){this._proxy.setOption("data",{action:(a)?"mark":"unmark",containerData:this._containerData,objectIDs:c,pageClassName:this._page,pageObjectID:this._pageObjectID,type:b});this._proxy.sendRequest()},_success:function(data,textStatus,jqXHR){var $containers={};$(".jsClipboardEditor").each(function(index,container){var $container=$(container);var $types=eval($container.data("types"));for(var $i=0,$length=$types.length;$i<$length;$i++){var $typeName=$types[$i];$containers[$typeName]=$container}var $containerID=$container.wcfIdentify();WCF.CloseOverlayHandler.removeCallback($containerID);$container.empty()});if(!data.items){return}for(var $typeName in data.items){if(!$containers[$typeName]){continue}var $container=$containers[$typeName];var $list=$container.children("ul");if($list.length==0){$list=$("<ul />").appendTo($container)}var $editor=data.items[$typeName];var $label=$('<li class="dropdown"><span class="dropdownToggle button">'+$editor.label+"</span></li>").appendTo($list);var $itemList=$('<ol class="dropdownMenu"></ol>').appendTo($label);for(var $itemIndex in $editor.items){var $item=$editor.items[$itemIndex];var $listItem=$("<li><span>"+$item.label+"</span></li>").appendTo($itemList);$listItem.data("container",$container);$listItem.data("objectType",$typeName);$listItem.data("actionName",$item.actionName).data("parameters",$item.parameters);$listItem.data("internalData",$item.internalData).data("url",$item.url).data("type",$typeName);$listItem.click($.proxy(this._executeAction,this))}$('<li class="dropdownDivider" />').appendTo($itemList);var $foo=$typeName;$("<li><span>"+WCF.Language.get("wcf.clipboard.item.unmarkAll")+"</span></li>").data("typeName",$typeName).appendTo($itemList).click($.proxy(function(event){var $typeName=$(event.currentTarget).data("typeName");this._proxy.setOption("data",{action:"unmarkAll",type:$typeName});this._proxy.setOption("success",$.proxy(function(data,textStatus,jqXHR){this._containers.each($.proxy(function(index,container){var $container=$(container);if($container.data("type")==$typeName){$container.find(".jsClipboardMarkAll, .jsClipboardItem").prop("checked",false);$container.find(".jsClipboardObject").removeClass("jsMarked");return false}},this));this._success(data,textStatus,jqXHR);this._proxy.setOption("success",$.proxy(this._success,this));this._loadMarkedItems()},this));this._proxy.sendRequest()},this));WCF.Dropdown.initDropdown($label.children(".dropdownToggle"),false)}},_closeLists:function(){$(".jsClipboardEditor ul").removeClass("dropdownOpen")},_executeAction:function(f){var d=$(f.currentTarget);var e=d.data("url");if(e){window.location.href=e}var a=true;if(d.data("parameters").className&&d.data("parameters").actionName){if(d.data("parameters").actionName==="unmarkAll"||d.data("parameters").objectIDs){var c=d.data("internalData")["confirmMessage"];if(c){var b=d.data("internalData")["template"];if(b){b=$(b)}WCF.System.Confirmation.show(c,$.proxy(function(h){if(h==="confirm"){var g={};if(b&&b.length){$("#wcfSystemConfirmationContent").find("input, select, textarea").each(function(j,k){var i=$(k);g[i.prop("name")]=i.val()})}this._executeAJAXActions(d,g)}},this),"",b)}else{this._executeAJAXActions(d,{})}}}else{var c=d.data("internalData")["confirmMessage"];if(c){a=false;WCF.System.Confirmation.show(c,function(g){if(g==="confirm"){d.data("container").trigger("clipboardAction",[d.data("type"),d.data("actionName"),d.data("parameters")])}})}}if(a){d.data("container").trigger("clipboardAction",[d.data("type"),d.data("actionName"),d.data("parameters")])}},_executeAJAXActions:function(d,e){e=e||{};var a=[];if(d.data("parameters").actionName!=="unmarkAll"){$.each(d.data("parameters").objectIDs,function(g,h){a.push(parseInt(h))})}var b={data:e,containerData:this._containerData[d.data("type")]};var f=d.data("internalData")["parameters"];if(f!==undefined){for(var c in f){b[c]=f[c]}}new WCF.Action.Proxy({autoSend:true,data:{actionName:d.data("parameters").actionName,className:d.data("parameters").className,objectIDs:a,parameters:b},success:$.proxy(function(g){if(d.data("parameters").actionName!=="unmarkAll"){d.data("container").trigger("clipboardActionResponse",[g,d.data("type"),d.data("actionName"),d.data("parameters")])}this._loadMarkedItems()},this)});if(this._actionObjects[d.data("objectType")]&&this._actionObjects[d.data("objectType")][d.data("parameters").actionName]){this._actionObjects[d.data("objectType")][d.data("parameters").actionName].triggerEffect(a)}},sendRequest:function(b){var a=$(b);this._actionProxy.setOption("data",{parameters:a.data("parameters"),typeName:a.data("type")});this._actionProxy.sendRequest()}};WCF.PeriodicalExecuter=Class.extend({_callback:null,_delay:0,_intervalID:null,_isExecuting:false,init:function(b,a){if(!$.isFunction(b)){console.debug("[WCF.PeriodicalExecuter] Given callback is invalid, aborting.");return}this._callback=b;this._interval=a;this.resume()},_execute:function(){if(!this._isExecuting){try{this._isExecuting=true;this._callback(this);this._isExecuting=false}catch(a){this._isExecuting=false;throw a}}},stop:function(){if(!this._intervalID){return}clearInterval(this._intervalID)},resume:function(){this.restart()},restart:function(){if(this._intervalID){this.stop()}this._intervalID=setInterval($.proxy(this._execute,this),this._interval)},setInterval:function(a){this._interval=a;this.restart()}});WCF.LoadingOverlayHandler={_activeRequests:0,_loadingOverlay:null,_pending:null,show:function(){if(this._loadingOverlay===null){this._loadingOverlay=$('<div class="spinner"><span class="icon icon48 icon-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></div>").appendTo($("body"));var b=this._loadingOverlay.outerWidth();if(b<70){b=70}this._loadingOverlay.css({marginLeft:Math.ceil(-1*b/2),width:b}).hide()}this._activeRequests++;if(this._activeRequests==1){if(this._pending===null){var a=this;this._pending=new WCF.PeriodicalExecuter(function(c){if(a._activeRequests){a._loadingOverlay.stop(true,true).fadeIn(100)}c.stop();a._pending=null},250)}}},hide:function(){this._activeRequests--;if(this._activeRequests==0){if(this._pending!==null){this._pending.stop();this._pending=null}this._loadingOverlay.stop(true,true).fadeOut(100)}},updateIcon:function(b,c){var a=(c===undefined||c?"addClass":"removeClass");b.find(".icon")[a]("icon-spinner");if(b.hasClass("icon")){b[a]("icon-spinner")}}};WCF.Action={};WCF.Action.Proxy=Class.extend({_showLoadingOverlayOnce:false,_suppressErrors:false,_lastRequest:null,init:function(b){this.options=$.extend(true,{autoSend:false,data:{},dataType:"json",after:null,init:null,jsonp:"callback",async:true,failure:null,showLoadingOverlay:true,success:null,suppressErrors:false,type:"POST",url:"index.php/AJAXProxy/?t="+SECURITY_TOKEN+SID_ARG_2ND,aborted:null,autoAbortPrevious:false},b);this.options.url=WCF.convertLegacyURL(this.options.url);this.confirmationDialog=null;this.loading=null;this._showLoadingOverlayOnce=false;this._suppressErrors=(this.options.suppressErrors===true);if(this.options.autoSend){this.sendRequest()}var a=this;$(window).on("beforeunload",function(){a._suppressErrors=true})},sendRequest:function(a){this._init();if(a||this.options.autoAbortPrevious){this.abortPrevious()}this._lastRequest=$.ajax({data:this.options.data,dataType:this.options.dataType,jsonp:this.options.jsonp,async:this.options.async,type:this.options.type,url:this.options.url,success:$.proxy(this._success,this),error:$.proxy(this._failure,this)});return this._lastRequest},abortPrevious:function(){if(this._lastRequest!==null){this._lastRequest.abort();this._lastRequest=null;if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.hide()}}},showLoadingOverlayOnce:function(){this._showLoadingOverlayOnce=true},suppressErrors:function(){this._suppressErrors=true},_init:function(){if($.isFunction(this.options.init)){this.options.init(this)}if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.show()}},_failure:function(d,i,h){if(i=="abort"){if($.isFunction(this.options.aborted)){this.options.aborted(d)}return}try{var c=$.parseJSON(d.responseText);var f=true;if($.isFunction(this.options.failure)){f=this.options.failure(c,d,i,h)}if(!this._suppressErrors&&f!==false){var a="";if(c.stacktrace){a="<br /><p>Stacktrace:</p><p>"+c.stacktrace+"</p>"}else{if(c.exceptionID){a="<br /><p>Exception ID: <code>"+c.exceptionID+"</code></p>"}}$('<div class="ajaxDebugMessage"><p>'+c.message+"</p>"+a+"</div>").wcfDialog({title:WCF.Language.get("wcf.global.error.title")})}}catch(g){var f=true;if($.isFunction(this.options.failure)){f=this.options.failure(null,d,i,h)}if(!this._suppressErrors&&f!==false){var b=(i==="timeout")?WCF.Language.get("wcf.global.error.timeout"):d.responseText;if(b&&b!="undefined"){$('<div class="ajaxDebugMessage"><p>'+b+"</p></div>").wcfDialog({title:WCF.Language.get("wcf.global.error.title")})}}}this._after()},_success:function(b,c,a){if($.isFunction(this.options.success)){if(b&&b.returnValues&&b.returnValues.template!==undefined){b.returnValues.template=$.trim(b.returnValues.template)}this.options.success(b,c,a)}this._after()},_after:function(){this._lastRequest=null;if($.isFunction(this.options.after)){this.options.after()}if(this.options.showLoadingOverlay||this._showLoadingOverlayOnce){WCF.LoadingOverlayHandler.hide();if(this._showLoadingOverlayOnce){this._showLoadingOverlayOnce=false}}WCF.DOMNodeInsertedHandler.execute();$("a[href*=#]").each(function(c,e){var b=$(e);if(b.prop("href").indexOf("AJAXProxy")!=-1){var d=b.prop("href").substr(b.prop("href").indexOf("#"));var a=document.location.toString().replace(/#.*/,"");b.prop("href",a+d)}})},setOption:function(a,b){this.options[a]=b}});WCF.Action.SimpleProxy=Class.extend({init:function(a,b){this.options=$.extend(true,{action:"",className:"",elements:null,eventName:"click"},a);this.callbacks=$.extend(true,{after:null,failure:null,init:null,success:null},b);if(!this.options.elements){return}this.proxy=new WCF.Action.Proxy(this.callbacks);this.options.elements.each($.proxy(function(c,d){$(d).bind(this.options.eventName,$.proxy(this._handleEvent,this))},this))},_handleEvent:function(a){this.proxy.setOption("data",{actionName:this.options.action,className:this.options.className,objectIDs:[$(a.target).data("objectID")]});this.proxy.sendRequest()}});WCF.Action.Delete=Class.extend({_buttonSelector:"",_className:"",_containerSelector:"",_containers:[],init:function(c,a,b){this._containerSelector=a;this._className=c;this._buttonSelector=(b)?b:".jsDeleteButton";this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initElements();WCF.DOMNodeInsertedHandler.addCallback("WCF.Action.Delete"+this._className.hashCode(),$.proxy(this._initElements,this))},_initElements:function(){$(this._containerSelector).each((function(b,a){var d=$(a);var c=d.wcfIdentify();if(!WCF.inArray(c,this._containers)){var e=d.find(this._buttonSelector);if(e.length){this._containers.push(c);e.click($.proxy(this._click,this))}}}).bind(this))},_click:function(b){var a=$(b.currentTarget);b.preventDefault();if(a.data("confirmMessage")){WCF.System.Confirmation.show(a.data("confirmMessage"),$.proxy(this._execute,this),{target:a})}else{WCF.LoadingOverlayHandler.updateIcon(a);this._sendRequest(a)}},_didTriggerEffect:function(a){},_execute:function(b,a){if(b==="cancel"){return}WCF.LoadingOverlayHandler.updateIcon(a.target);this._sendRequest(a.target)},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"delete",className:this._className,interfaceName:"wcf\\data\\IDeleteAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){this.triggerEffect(b.objectIDs)},triggerEffect:function(d){for(var a in this._containers){var e=$("#"+this._containers[a]);var c=e.find(this._buttonSelector);if(WCF.inArray(c.data("objectID"),d)){var b=this;e.wcfBlindOut("up",function(){var f=$(this).remove();b._containers.splice(b._containers.indexOf(f.wcfIdentify()),1);b._didTriggerEffect(f);if(c.data("eventName")){WCF.System.Event.fireEvent("com.woltlab.wcf.action.delete",c.data("eventName"),{button:c,container:f})}})}}}});WCF.Action.NestedDelete=WCF.Action.Delete.extend({triggerEffect:function(c){for(var a in this._containers){var d=$("#"+this._containers[a]);if(WCF.inArray(d.find(this._buttonSelector).data("objectID"),c)){if(d.has("ol").has("li").length){if(d.is(":only-child")){d.parent().replaceWith(d.find("> ol"))}else{d.replaceWith(d.find("> ol > li"))}this._containers.splice(this._containers.indexOf(d.wcfIdentify()),1);this._didTriggerEffect(d)}else{var b=this;d.wcfBlindOut("up",function(){$(this).remove();b._containers.splice(b._containers.indexOf($(this).wcfIdentify()),1);b._didTriggerEffect($(this))})}}}}});WCF.Action.Toggle=Class.extend({_buttonSelector:".jsToggleButton",_className:"",_containerSelector:"",_containers:[],init:function(d,a,c){this._containerSelector=a;this._className=d;this._buttonSelector=(c)?c:".jsToggleButton";this._containers=[];var b={success:$.proxy(this._success,this)};this.proxy=new WCF.Action.Proxy(b);this._initElements();WCF.DOMNodeInsertedHandler.addCallback("WCF.Action.Toggle"+this._className.hashCode(),$.proxy(this._initElements,this))},_initElements:function(){$(this._containerSelector).each($.proxy(function(b,a){var d=$(a);var c=d.wcfIdentify();if(!WCF.inArray(c,this._containers)){this._containers.push(c);d.find(this._buttonSelector).click($.proxy(this._click,this))}},this))},_click:function(b){var a=$(b.currentTarget);b.preventDefault();if(a.data("confirmMessage")){WCF.System.Confirmation.show(a.data("confirmMessage"),$.proxy(this._execute,this),{target:a})}else{WCF.LoadingOverlayHandler.updateIcon(a);this._sendRequest(a)}},_execute:function(b,a){if(b==="cancel"){return}WCF.LoadingOverlayHandler.updateIcon(a.target);this._sendRequest(a.target)},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"toggle",className:this._className,interfaceName:"wcf\\data\\IToggleAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){this.triggerEffect(b.objectIDs)},triggerEffect:function(b){for(var a in this._containers){var d=$("#"+this._containers[a]);var c=d.find(this._buttonSelector);if(WCF.inArray(c.data("objectID"),b)){d.wcfHighlight();this._toggleButton(d,c)}}},_toggleButton:function(c,b){var a="";WCF.LoadingOverlayHandler.updateIcon(b,false);if(b.hasClass("icon-check-empty")){b.removeClass("icon-check-empty").addClass("icon-check");a=(b.data("disableTitle")?b.data("disableTitle"):WCF.Language.get("wcf.global.button.disable"));b.attr("title",a)}else{b.removeClass("icon-check").addClass("icon-check-empty");a=(b.data("enableTitle")?b.data("enableTitle"):WCF.Language.get("wcf.global.button.enable"));b.attr("title",a)}c.toggleClass("disabled")}});WCF.Action.Scroll=Class.extend({_callback:null,_reference:null,_target:null,_threshold:0,init:function(b,d,a,c){this._threshold=parseInt(b);if(this._threshold===0){console.debug("[WCF.Action.Scroll] Given threshold is invalid, aborting.");return}if($.isFunction(d)){this._callback=d}if(this._callback===null){console.debug("[WCF.Action.Scroll] Given callback is invalid, aborting.");return}this._reference=$((a)?a:window);this._target=$((c)?c:document);this.start();this._scroll()},_scroll:function(){var a=this._target.height();var b=this._reference.scrollTop();var c=this._reference.height();if((a-(c+b))<this._threshold){this._callback(this)}},start:function(){this._reference.on("scroll",$.proxy(this._scroll,this))},stop:function(){this._reference.off("scroll")}});WCF.Date={};WCF.Date.Picker={_dateFormat:"yy-mm-dd",_timeFormat:"g:ia",init:function(){var a=$.timepicker.log;$.timepicker.log=function(b){if(b.indexOf("Error parsing the date/time string: Unexpected literal at position")==-1&&b.indexOf("Error parsing the date/time string: Unknown name at position")==-1){a(b)}};this._convertDateFormat();this._initDatePicker();WCF.DOMNodeInsertedHandler.addCallback("WCF.Date.Picker",$.proxy(this._initDatePicker,this))},_convertDateFormat:function(){var a={a:"tt",A:"TT",g:"h",G:"H",h:"hh",H:"HH",i:"mm",s:"ss",u:"l",d:"dd",D:"D",j:"d",l:"DD",z:"o",S:"",F:"MM",m:"mm",M:"M",n:"m",o:"yy",Y:"yy",y:"y",U:"@"};this._dateFormat=WCF.Language.get("wcf.date.dateFormat").replace(/([^dDjlzSFmMnoYyU\\]*(?:\\.[^dDjlzSFmMnoYyU\\]*)*)([dDjlzSFmMnoYyU])/g,function(c,f,e,g,b){for(var d in a){if(e==d){e=a[d]}}return f+e});this._timeFormat=WCF.Language.get("wcf.date.timeFormat").replace(/([^aAgGhHisu\\]*(?:\\.[^aAgGhHisu\\]*)*)([aAgGhHisu])/g,function(c,f,e,g,b){for(var d in a){if(e==d){e=a[d]}}return f+e})},_initDatePicker:function(){$("input[type=date]:not(.jsDatePicker), input[type=datetime]:not(.jsDatePicker)").each($.proxy(function(g,j){var i=$(j);var d=i.prop("name");var m=i.val();var b=i.attr("type")=="datetime";i.prop("type","text").addClass("jsDatePicker");if(i.data("placeholder")){i.attr("placeholder",i.data("placeholder"))}i.removeAttr("name");i.before('<input type="hidden" id="'+i.wcfIdentify()+'DatePicker" name="'+d+'" value="'+m+'" />');var f=i.attr("max")?new Date(i.attr("max").replace(" ","T")):null;var n=i.attr("min")?new Date(i.attr("min").replace(" ","T")):null;var c={altField:"#"+i.wcfIdentify()+"DatePicker",altFormat:"yy-mm-dd",beforeShow:function(q,p){setTimeout(function(){p.dpDiv.position({my:"left top",at:"left bottom",collision:"none",of:q})},1)},changeMonth:true,changeYear:true,dateFormat:this._dateFormat,dayNames:WCF.Language.get("__days"),dayNamesMin:WCF.Language.get("__daysShort"),dayNamesShort:WCF.Language.get("__daysShort"),firstDay:parseInt(WCF.Language.get("wcf.date.firstDayOfTheWeek"))||0,isRTL:WCF.Language.get("wcf.global.pageDirection")=="rtl",maxDate:f,minDate:n,monthNames:WCF.Language.get("__months"),monthNamesShort:WCF.Language.get("__monthsShort"),showButtonPanel:false,onClose:function(q,p){if(q==""){$(p.settings.altField).val(q)}},showOtherMonths:true,yearRange:(i.hasClass("birthday")?"-100:+0":"1900:2038")};if(b){if(/[0-9]{2}:[0-9]{2}:[0-9]{2}$/.test(m)){m=m.replace(/:[0-9]{2}$/,"");i.val(m)}m=m.replace(" ","T");if(i.data("timeOnly")){var e=m.split(":");var a=new Date();a.setHours(e[0]);a.setMinutes(e[1]);a.setSeconds(0);m=a.toString()}if(i.data("ignoreTimezone")){var l=new Date(m).getTimezoneOffset();var o=(l>0)?"-":"+";l=Math.abs(l);var h=(Math.floor(l/60)).toString();var k=(l%60).toString();o+=(h.length==2)?h:"0"+h;o+=":";o+=(k.length==2)?k:"0"+k;m=m.replace(/[+-][0-9]{2}:[0-9]{2}$/,o)}c=$.extend(c,{altFieldTimeOnly:false,altTimeFormat:"HH:mm",controlType:"select",hourText:WCF.Language.get("wcf.date.hour"),minuteText:WCF.Language.get("wcf.date.minute"),showTime:false,timeFormat:this._timeFormat,timeOnly:i.data("timeOnly")?true:false,yearRange:(i.hasClass("birthday")?"-100:+0":"1900:2038")})}if(b){i.datetimepicker(c)}else{i.datepicker(c)}if(m){m=new Date(m);if(!b){m.setMinutes(m.getMinutes()+m.getTimezoneOffset())}i.datepicker("setDate",m)}i.datepicker("widget").hide();if(i.data("timeOnly")){i.datepicker("widget").addClass("timeOnlyPicker")}},this))}};WCF.Date.Util={gmdate:function(a){var b=(a)?a:new Date();return Math.round(Date.UTC(b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDay(),b.getUTCHours(),b.getUTCMinutes(),b.getUTCSeconds())/1000)},getTimezoneDate:function(b,c){var d=new Date(b);var a=d.getTimezoneOffset()*60000;return new Date((b+a+c))}};WCF.Date.Time=Class.extend({_date:0,_elements:null,_offset:null,_timestamp:0,init:function(){this._elements=$("time.datetime");this._offset=null;this._timestamp=0;this._refresh();new WCF.PeriodicalExecuter($.proxy(this._refresh,this),60000);WCF.DOMNodeInsertedHandler.addCallback("WCF.Date.Time",$.proxy(this._domNodeInserted,this))},_domNodeInserted:function(){this._elements=$("time.datetime");this._refresh()},_refresh:function(){this._date=new Date();this._timestamp=(this._date.getTime()-this._date.getMilliseconds())/1000;if(this._offset===null){this._offset=this._timestamp-TIME_NOW}this._elements.each($.proxy(this._refreshElement,this))},_refreshElement:function(i,f){var n=$(f);if(!n.attr("title")){n.attr("title",n.text())}var d=n.data("timestamp")+this._offset;var b=n.data("date");var c=n.data("time");var o=n.data("offset");if(n.data("isFutureDate")){return}if(d>=this._timestamp||this._timestamp<(d+60)){n.text(WCF.Language.get("wcf.date.relative.now"))}else{if(this._timestamp<(d+3540)){var m=Math.max(Math.round((this._timestamp-d)/60),1);n.text(WCF.Language.get("wcf.date.relative.minutes",{minutes:m}))}else{if(this._timestamp<(d+86400)){var k=Math.round((this._timestamp-d)/3600);n.text(WCF.Language.get("wcf.date.relative.hours",{hours:k}))}else{if(this._timestamp<(d+518400)){var j=new Date(this._date.getFullYear(),this._date.getMonth(),this._date.getDate());var l=Math.ceil((j/1000-d)/86400);var g=WCF.Date.Util.getTimezoneDate((d*1000),o*1000);var h=g.getDay();var e=WCF.Language.get("__days")[h];n.text(WCF.Language.get("wcf.date.relative.pastDays",{days:l,day:e,time:c}))}else{var a=WCF.Language.get("wcf.date.shortDateTimeFormat");n.text(a.replace(/\%date\%/,b).replace(/\%time\%/,c))}}}}}});WCF.Dictionary=Class.extend({_variables:{},init:function(){this._variables={}},add:function(a,b){this._variables[a]=b},addObject:function(a){for(var b in a){this.add(b,a[b])}},addDictionary:function(a){a.each($.proxy(function(b){this.add(b.key,b.value)},this))},get:function(a){if(this.isset(a)){return this._variables[a]}return null},isset:function(a){return this._variables.hasOwnProperty(a)},remove:function(a){delete this._variables[a]},each:function(d){if(!$.isFunction(d)){return}for(var c in this._variables){var a=this._variables[c];var b={key:c,value:a};d(b)}},count:function(){return $.getLength(this._variables)},isEmpty:function(){return !this.count()}});WCF.Language={_variables:new WCF.Dictionary(),add:function(a,b){this._variables.add(a,b)},addObject:function(a){this._variables.addObject(a)},get:function(a,b){if(b==null){var b={}}var c=this._variables.get(a);if(c===null){return a}else{if(typeof c==="string"){this.add(a,new WCF.Template(c));return this.get(a,b)}else{if(typeof c.fetch==="function"){c=c.fetch(b)}}}return c}};WCF.MultipleLanguageInput=Class.extend({_availableLanguages:{},_button:null,_didInit:false,_element:null,_insertedDataAfterInit:false,_isEnabled:false,_forceSelection:false,_languageID:0,_list:null,_values:null,init:function(c,b,d,f){this._button=null;this._element=$("#"+$.wcfEscapeID(c));this._forceSelection=b;this._values=d;this._availableLanguages=f;if($.getLength(this._values)){for(var e in this._values){this._values[e]=WCF.String.unescapeHTML(this._values[e])}}this._languageID=LANGUAGE_ID;if(this._element.length==0){console.debug("[WCF.MultipleLanguageInput] element id '"+c+"' is unknown");return}var a=($.getLength(this._values)>0)?true:false;this._insertedDataAfterInit=a;this._prepareElement(a);this._element.parents("form").submit($.proxy(this._submit,this));this._didInit=true},_prepareElement:function(a){this._element.wrap('<div class="dropdown preInput" />');var c=this._element.parent();this._button=$('<p class="button dropdownToggle"><span>'+WCF.Language.get("wcf.global.button.disabledI18n")+"</span></p>").prependTo(c);this._list=$('<ul class="dropdownMenu"></ul>').insertAfter(this._button);if(this._button.nextAll("textarea").length){this._button.addClass("dropdownCaptionTextarea")}else{this._button.addClass("dropdownCaption")}for(var b in this._availableLanguages){$("<li><span>"+this._availableLanguages[b]+"</span></li>").data("languageID",b).click($.proxy(this._changeLanguage,this)).appendTo(this._list)}if(!this._forceSelection){$('<li class="dropdownDivider" />').appendTo(this._list);$("<li><span>"+WCF.Language.get("wcf.global.button.disabledI18n")+"</span></li>").click($.proxy(this._disable,this)).appendTo(this._list)}WCF.Dropdown.initDropdown(this._button,a);if(a||this._forceSelection){this._isEnabled=true;this._list.children("li").each($.proxy(function(d,f){var e=$(f);if(e.data("languageID")==this._languageID){e.trigger("click")}},this))}WCF.Dropdown.registerCallback(c.wcfIdentify(),$.proxy(this._handleAction,this))},_handleAction:function(a,b){if(b==="open"){this._enable()}else{this._closeSelection()}},_enable:function(a){if(!this._isEnabled){var b=(this._button.is("p"))?this._button.children("span:eq(0)"):this._button;b.addClass("active");this._isEnabled=true}if(this._list.is(":visible")){this._showSelection()}},_showSelection:function(){if(this._isEnabled){this._list.children("li").each($.proxy(function(b,d){var c=$(d);var a=c.data("languageID");if(a){if(this._values[a]&&this._values[a]!=""){c.removeClass("missingValue")}else{c.addClass("missingValue")}}},this))}},_closeSelection:function(){this._disable()},_changeLanguage:function(a){var b=$(a.currentTarget);this._insertedDataAfterInit=true;if(this._didInit){this._values[this._languageID]=this._element.val()}this._languageID=b.data("languageID");if(this._values[this._languageID]){this._element.val(this._values[this._languageID])}else{this._element.val("")}this._list.children("li").removeClass("active");b.addClass("active");this._button.children("span").addClass("active").text(this._availableLanguages[this._languageID]);if(this._didInit){this._element.blur().focus()}},_disable:function(a){if(a===undefined&&this._insertedDataAfterInit){a=null}if(this._forceSelection||!this._list||a===null){return}this._button.children("span").removeClass("active").text(WCF.Language.get("wcf.global.button.disabledI18n"));if(this._values[LANGUAGE_ID]){this._element.val(this._values[LANGUAGE_ID])}else{this._element.val()}if(a){this._list.children("li").removeClass("active");$(a.currentTarget).addClass("active")}this._element.blur().focus();this._insertedDataAfterInit=false;this._isEnabled=false;this._values={}},_submit:function(){if(!this._isEnabled){return 3735928559}if(this._languageID){this._values[this._languageID]=this._element.val()}var b=$(this._element.parents("form")[0]);var c=this._element.wcfIdentify();for(var a in this._availableLanguages){if(this._values[a]===undefined){this._values[a]=""}$('<input type="hidden" name="'+c+"_i18n["+a+']" value="'+WCF.String.escapeHTML(this._values[a])+'" />').appendTo(b)}this._element.removeAttr("name")}});WCF.Number={round:function(b,a){a=Math.pow(10,(a||0));return Math.round(b*a)/a}};WCF.String={addThousandsSeparator:function(a){return String(a).replace(/(^-?\d{1,3}|\d{3})(?=(?:\d{3})+(?:$|\.))/g,"$1"+WCF.Language.get("wcf.global.thousandsSeparator"))},escapeHTML:function(a){return String(a).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")},escapeRegExp:function(a){return String(a).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},formatNumeric:function(b,a){b=String(WCF.Number.round(b,a||2));var c=b.split(".");b=this.addThousandsSeparator(c[0]);if(c.length>1){b+=WCF.Language.get("wcf.global.decimalPoint")+c[1]}b=b.replace("-","\u2212");return b},lcfirst:function(a){return String(a).substring(0,1).toLowerCase()+a.substring(1)},ucfirst:function(a){return String(a).substring(0,1).toUpperCase()+a.substring(1)},unescapeHTML:function(a){return String(a).replace(/&/g,"&").replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">")}};WCF.TabMenu={_containers:{},_didInit:false,init:function(){var d=$(".tabMenuContainer:not(.staticTabMenuContainer)");var c=this;d.each(function(f,e){var h=$(e);var g=h.wcfIdentify();if(c._containers[g]){return true}if(h.data("store")&&!$("#"+h.data("store")).length){$('<input type="hidden" name="'+h.data("store")+'" value="" id="'+h.data("store")+'" />').appendTo(h.parents("form").find(".formSubmit"))}c._containers[g]=h;h.wcfTabs({active:false,activate:function(j,i){var l=$(i.newPanel);var k=l.closest(".tabMenuContainer");var m=k;while(true){if(m.data("isParent")===undefined){break}if(m.data("isParent")){if(m.data("store")){$("#"+m.data("store")).val(l.attr("id"))}break}else{m=m.data("parent")}}if(WCF.TabMenu._didInit){if(l.data("inTabMenu")==undefined){l.data("inTabMenu",(l.parents(".dialogContainer").length))}if(!l.data("inTabMenu")){if(window.history){window.history.pushState(null,document.title,window.location.toString().replace(/#.+$/,"")+"#"+l.attr("id"))}else{location.hash="#"+l.attr("id")}}}}});h.data("isParent",(h.children(".tabMenuContainer, .tabMenuContent").length>0)).data("parent",false);if(!h.data("isParent")){if(h.parent().hasClass("tabMenuContainer")){h.data("parent",h.parent())}}});if(!this._didInit){this._selectActiveTab();$(window).bind("hashchange",$.proxy(this.selectTabs,this));if(!this._selectErroneousTab()){this.selectTabs()}if($.browser.mozilla&&location.hash){var a=$(location.hash);if(a.length&&a.hasClass("tabMenuContent")){var b=a.offset();window.scrollTo(b.left,b.top)}}}this._didInit=true},reload:function(){this._containers={};this.init()},_selectErroneousTab:function(){var d=false;for(var a in this._containers){var c=this._containers[a];if(c.find(".formError").length){d=true;if(!c.data("isParent")){while(true){if(c.data("parent")===false){break}c=c.data("parent").wcfTabs("selectTab",c.wcfIdentify())}return true}}}if(d){for(var a in this._containers){var c=this._containers[a];var b=c.find(".formError:eq(0)");if(b.length){c.wcfTabs("selectTab",b.parents(".tabMenuContent").wcfIdentify());while(true){if(c.data("parent")===false){break}c=c.data("parent").wcfTabs("selectTab",c.wcfIdentify())}return true}}}return false},_selectActiveTab:function(){for(var b in this._containers){var e=this._containers[b];if(e.data("active")){var a=e.data("active");var d=null;if(/-/.test(a)){var c=a.split("-");a=c[0];d=c[1]}e.find(".tabMenuContent").each(function(h,g){var f=$(g);if(f.wcfIdentify()==a){e.wcfTabs("select",h);if(d!==null){if(f.hasClass("tabMenuContainer")){f.wcfTabs("selectTab",e.data("active"))}else{e.wcfTabs("selectTab",e.data("active"))}}return false}})}}},selectTabs:function(){if(location.hash){var a=location.hash.substr(1);var b=$("#"+$.wcfEscapeID(a));if(b.length===1&&b.hasClass("ui-tabs-panel")){b=b.parent(".ui-tabs");if(b.length){b.wcfTabs("selectTab",a);if(b.hasClass("ui-tabs-panel")){a=b.wcfIdentify();b=b.parent(".ui-tabs");if(b.length){b.wcfTabs("selectTab",a)}}return true}}}return false}};WCF.Template=Class.extend({init:function(d){var f=new WCF.Dictionary();var a=0;d=d.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/(\r\n|\n|\r)/g,"\\n");d=d.replace(/\{literal\}(.*?)\{\/literal\}/g,$.proxy(function(e){var i="@@@@@@@@@@@"+Math.random()+"@@@@@@@@@@@";f.add(i,e.replace(/\{\/?literal\}/g,""));return i},this));d=d.replace(/\{\*.*?\*\}/g,"");var c=function(q){var l=q.split("");var i={};var k=true;var s="";var o="";var m=false;var n=false;var j=false;for(var p=0,e=l.length;p<e;p++){var r=l[p];if(k&&r!="="&&r!=" "){s+=r}else{if(k&&r=="="){k=false;n=false;m=false;j=false}else{if(!k&&!n&&!m&&r==" "){k=true;i[s]=o;o=s=""}else{if(!k&&n&&!j&&r=="'"){n=false;o+=r}else{if(!k&&!n&&!m&&r=="'"){n=true;o+=r}else{if(!k&&m&&!j&&r=='"'){m=false;o+=r}else{if(!k&&!n&&!m&&r=='"'){m=true;o+=r}else{if(!k&&(m||n)&&!j&&r=="\\"){j=true;o+=r}else{if(!k){j=false;o+=r}}}}}}}}}}i[s]=o;if(m||n||j){throw new Error('Syntax error in parameterList: "'+q+'"')}return i};var h=function(e){return e.replace(/\\n/g,"\n").replace(/\\\\/g,"\\").replace(/\\'/g,"'")};d=d.replace(/\{(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + WCF.String.escapeHTML("+i+") + '"}).replace(/\{#(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + WCF.String.formatNumeric("+i+") + '"}).replace(/\{@(\$[^\}]+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"' + "+i+" + '"}).replace(/\{lang\}(.+?)\{\/lang\}/g,function(e,i){return"' + WCF.Language.get('"+i+"', v) + '"}).replace(/\{include (.+?)\}/g,function(e,j){j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.file==="undefined"){throw new Error("Missing file attribute in include-tag")}i.file=i.file.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"' + "+i.file+".fetch(v) + '"}).replace(/\{if (.+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"';\nif ("+i+") {\n $output += '"}).replace(/\{else ?if (.+?)\}/g,function(e,i){i=h(i.replace(/\$([^.\[\(\)\]\s]+)/g,"(v['$1'])"));return"';\n}\nelse if ("+i+") {\n $output += '"}).replace(/\{implode (.+?)\}/g,function(e,j){a++;j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.from==="undefined"){throw new Error("Missing from attribute in implode-tag")}if(typeof i.item==="undefined"){throw new Error("Missing item attribute in implode-tag")}if(typeof i.glue==="undefined"){i.glue="', '"}i.from=i.from.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"';\nvar $implode_"+a+" = false;\nfor ($implodeKey_"+a+" in "+i.from+") {\n v["+i.item+"] = "+i.from+"[$implodeKey_"+a+"];\n"+(typeof i.key!=="undefined"?" v["+i.key+"] = $implodeKey_"+a+";\n":"")+" if ($implode_"+a+") $output += "+i.glue+";\n $implode_"+a+" = true;\n $output += '"}).replace(/\{foreach (.+?)\}/g,function(e,j){a++;j=j.replace(/\\\\/g,"\\").replace(/\\'/g,"'");var i=c(j);if(typeof i.from==="undefined"){throw new Error("Missing from attribute in foreach-tag")}if(typeof i.item==="undefined"){throw new Error("Missing item attribute in foreach-tag")}i.from=i.from.replace(/\$([^.\[\(\)\]\s]+)/g,"(v.$1)");return"';\n$foreach_"+a+" = false;\nfor ($foreachKey_"+a+" in "+i.from+") {\n $foreach_"+a+" = true;\n break;\n}\nif ($foreach_"+a+") {\n for ($foreachKey_"+a+" in "+i.from+") {\n v["+i.item+"] = "+i.from+"[$foreachKey_"+a+"];\n"+(typeof i.key!=="undefined"?" v["+i.key+"] = $foreachKey_"+a+";\n":"")+" $output += '"}).replace(/\{foreachelse\}/g,"';\n }\n}\nelse {\n {\n $output += '").replace(/\{\/foreach\}/g,"';\n }\n}\n$output += '").replace(/\{else\}/g,"';\n}\nelse {\n $output += '").replace(/\{\/(if|implode)\}/g,"';\n}\n$output += '");for(var b in WCF.Template.callbacks){d=WCF.Template.callbacks[b](d)}d=d.replace("{ldelim}","{").replace("{rdelim}","}");f.each(function(e){d=d.replace(e.key,e.value)});d="$output += '"+d+"';";try{this.fetch=new Function("v","v = window.$.extend({}, v, { __wcf: window.WCF, __window: window }); var $output = ''; "+d+" return $output;")}catch(g){console.debug("var $output = ''; "+d+" return $output;");throw g}},fetch:function(a){}});WCF.Template.callbacks=[];WCF.ToggleOptions=Class.extend({_element:null,_showItems:[],_hideItems:[],_callback:null,init:function(c,a,b,d){this._element=$("#"+c);this._showItems=a;this._hideItems=b;if(d!==undefined){this._callback=d}this._element.click($.proxy(this._toggle,this));this._toggle()},_toggle:function(){if(!this._element.prop("checked")){return}for(var c=0,b=this._showItems.length;c<b;c++){var a=this._showItems[c];$("#"+a).show()}for(var c=0,b=this._hideItems.length;c<b;c++){var a=this._hideItems[c];$("#"+a).hide()}if(this._callback!==null){this._callback()}}});WCF.Collapsible={};WCF.Collapsible.Simple={init:function(){$(".jsCollapsible").each($.proxy(function(a,b){this._initButton(b)},this))},_initButton:function(a){var c=$(a);var b=c.data("isOpen");if(!b){$("#"+c.data("collapsibleContainer")).hide()}c.click($.proxy(this._toggle,this))},_toggle:function(b){var d=$(b.currentTarget);var c=d.data("isOpen");var a=$("#"+$.wcfEscapeID(d.data("collapsibleContainer")));if(c){a.stop().wcfBlindOut("vertical",$.proxy(function(){this._toggleImage(d)},this));c=false}else{a.stop().wcfBlindIn("vertical",$.proxy(function(){this._toggleImage(d)},this));c=true}d.data("isOpen",c);b.stopPropagation();return false},_toggleImage:function(b){var a=b.find("span.icon");if(b.data("isOpen")){a.removeClass("icon-chevron-right").addClass("icon-chevron-down")}else{a.removeClass("icon-chevron-down").addClass("icon-chevron-right")}}};WCF.Collapsible.Remote=Class.extend({_className:"",_containers:{},_containerData:{},_proxy:null,init:function(a){this._className=a;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._init();WCF.DOMNodeInsertedHandler.addCallback("WCF.Collapsible.Remote",$.proxy(this._init,this))},_init:function(a){this._getContainers().each($.proxy(function(c,b){var e=$(b);var d=e.wcfIdentify();if(this._containers[d]===undefined){this._containers[d]=e;this._initContainer(d)}},this))},_initContainer:function(b){var a=this._getTarget(b);var c=this._getButtonContainer(b);var d=this._createButton(b,c);this._containerData[b]={button:d,buttonContainer:c,isOpen:this._containers[b].data("isOpen"),target:a};if(!this._containers[b].data("isOpen")){$("#"+b).addClass("jsCollapsed")}},_getContainers:function(){},_getTarget:function(a){},_getButtonContainer:function(a){},_createButton:function(a,b){var d=this._containers[a].data("isOpen");var c=$('<span class="collapsibleButton jsTooltip pointer icon icon16 icon-'+(d?"chevron-down":"chevron-right")+'" title="'+WCF.Language.get("wcf.global.button.collapsible")+'">').prependTo(b);c.data("containerID",a).click($.proxy(this._toggleContainer,this));return c},_toggleContainer:function(d){var f=$(d.currentTarget);var b=f.data("containerID");var e=this._containerData[b].isOpen;var a=(e)?"open":"close";var c=(e)?"close":"open";this._proxy.setOption("data",{actionName:"loadContainer",className:this._className,interfaceName:"wcf\\data\\ILoadableContainerAction",objectIDs:[this._getObjectID(b)],parameters:$.extend(true,{containerID:b,currentState:a,newState:c},this._getAdditionalParameters(b))});this._proxy.sendRequest();$("#"+b).toggleClass("jsCollapsed")},_exchangeIcon:function(b,a){a=a||"spinner";b.removeClass("icon-chevron-down icon-chevron-right icon-spinner").addClass("icon-"+a)},_getObjectID:function(a){return $("#"+a).data("objectID")},_getAdditionalParameters:function(a){return{}},_updateContent:function(a,b,c){this._containerData[a].target.html(b)},_success:function(d,e,c){if(!d.returnValues.containerID){return}var a=d.returnValues.containerID;if(!this._containers[a]){return}this._containerData[a].isOpen=(d.returnValues.isOpen)?true:false;var b=(d.returnValues.isOpen)?"open":"close";this._updateContent(a,$.trim(d.returnValues.content),b);this._exchangeIcon(this._containerData[a].button,(d.returnValues.isOpen?"chevron-down":"chevron-right"))}});WCF.Collapsible.SimpleRemote=WCF.Collapsible.Remote.extend({init:function(a){this._super(a);this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false})},_initContainer:function(a){this._super(a);if(!this._containerData[a].isOpen){this._containerData[a].target.hide();this._exchangeIcon(this._containerData[a].button,"chevron-right")}},_toggleContainer:function(d){var f=$(d.currentTarget);var b=f.data("containerID");var e=this._containerData[b].isOpen;var a=(e)?"open":"close";var c=(e)?"close":"open";this._proxy.setOption("data",{actionName:"toggleContainer",className:this._className,interfaceName:"wcf\\data\\IToggleContainerAction",objectIDs:[this._getObjectID(b)],parameters:$.extend(true,{containerID:b,currentState:a,newState:c},this._getAdditionalParameters(b))});this._proxy.sendRequest();this._exchangeIcon(this._containerData[b].button,(c==="open"?"chevron-down":"chevron-right"));if(c==="open"){this._containerData[b].target.show()}else{this._containerData[b].target.hide()}$("#"+b).toggleClass("jsCollapsed");this._containerData[b].isOpen=(c==="open"?true:false)}});WCF.Collapsible.Sidebar=Class.extend({_button:null,_buttonHeight:0,_isOpen:false,_mainContainer:null,_proxy:null,_sidebar:null,_sidebarHeight:0,_sidebarName:"",_sidebarOffset:0,_userPanelHeight:0,init:function(){this._sidebar=$(".sidebar:eq(0)");if(!this._sidebar.length){console.debug("[WCF.Collapsible.Sidebar] Could not find sidebar, aborting.");return}this._isOpen=(this._sidebar.data("isOpen"))?true:false;this._sidebarName=this._sidebar.data("sidebarName");this._mainContainer=$("#main");this._sidebarHeight=this._sidebar.height();this._sidebarOffset=this._sidebar.getOffsets("offset").top;this._userPanelHeight=$("#topMenu").outerHeight();this._button=$('<a class="collapsibleButton jsTooltip" title="'+WCF.Language.get("wcf.global.button.collapsible")+'" />').prependTo(this._sidebar);this._button.wrap("<span />");this._button.click($.proxy(this._click,this));this._buttonHeight=this._button.outerHeight();WCF.DOMNodeInsertedHandler.execute();this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,url:"index.php/AJAXInvoke/?t="+SECURITY_TOKEN+SID_ARG_2ND});$(document).scroll($.proxy(this._scroll,this)).resize($.proxy(this._scroll,this));this._renderSidebar();this._scroll();var a=$(window);this._sidebar.on("webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd",function(){a.trigger("resize")})},_click:function(){this._isOpen=(this._isOpen)?false:true;this._proxy.setOption("data",{actionName:"toggle",className:"wcf\\system\\user\\collapsible\\content\\UserCollapsibleSidebarHandler",isOpen:(this._isOpen?1:0),sidebarName:this._sidebarName});this._proxy.sendRequest();this._renderSidebar()},_scroll:function(){var e=$(window);var b=e.scrollTop();var a=Math.max(b-this._sidebarOffset,0);var c=Math.min(this._mainContainer.height(),(e.height()+b)-this._sidebarOffset);var f=0;if(c===a){f=this._sidebarOffset+this._sidebarHeight}else{f=a+((c-a)/2);var d=Math.max(Math.min(a-this._userPanelHeight,this._userPanelHeight),0);if(d>0){f+=(d/2)}}if((c-a-this._userPanelHeight)<this._buttonHeight){f=f-this._buttonHeight}else{f=Math.max(f-(this._buttonHeight/2),0)}this._button.css({top:f+"px"})},_renderSidebar:function(){if(this._isOpen){$(".sidebarOrientationLeft, .sidebarOrientationRight").removeClass("sidebarCollapsed")}else{$(".sidebarOrientationLeft, .sidebarOrientationRight").addClass("sidebarCollapsed")}this._scroll();if($.browser.msie&&$.browser.version.indexOf("9")===0){$(window).trigger("resize")}}});WCF.User={userID:0,username:"",init:function(a,b){this.userID=a;this.username=b}};WCF.Effect={};WCF.Effect.Scroll=Class.extend({scrollTo:function(c,a,b){if(!c.length){return true}var d=c.getOffsets("offset").top;var f=$(document).height();var e=$(window).height();if(d>f-e){d=f-e;if(d<0){d=0}}if(b===true){$("html,body").scrollTop(d)}else{$("html,body").animate({scrollTop:d},400,function(h,i,g,k,j){return -k*((i=i/j-1)*i*i*i-1)+g})}return false}});WCF.Effect.SmoothScroll=WCF.Effect.Scroll.extend({init:function(){var a=this;$(document).on("click","a[href$=#top],a[href$=#bottom]",function(){var b=$(this.hash);a.scrollTo(b,true);return false})}});WCF.Effect.BalloonTooltip=Class.extend({_didInit:false,_tooltip:null,_viewportDimensions:{},init:function(){if(jQuery.browser.mobile){return}if(!this._didInit){this._tooltip=$('<div id="balloonTooltip" class="balloonTooltip"><span id="balloonTooltipText"></span><span class="pointer"><span></span></span></div>').appendTo($("body")).hide();this._updateViewportDimensions();$(window).resize($.proxy(this._updateViewportDimensions,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.Effect.BalloonTooltip",$.proxy(this.init,this));this._didInit=true}$(".jsTooltip").each($.proxy(this._initTooltip,this))},_updateViewportDimensions:function(){this._viewportDimensions=$(document).getDimensions()},_initTooltip:function(b,c){var a=$(c);if(a.hasClass("jsTooltip")){a.removeClass("jsTooltip");var d=a.attr("title");if(d!==""){a.data("tooltip",d);a.removeAttr("title");a.hover($.proxy(this._mouseEnterHandler,this),$.proxy(this._mouseLeaveHandler,this));a.click($.proxy(this._mouseLeaveHandler,this))}}},_mouseEnterHandler:function(c){var e,d;var o=$(c.currentTarget);var k=o.attr("title");if(k&&k!==""){o.data("tooltip",k);o.removeAttr("title")}this._tooltip.css({top:"0px",left:"0px"});if(!o.data("tooltip")){this._tooltip.hide();return}this._tooltip.children("span:eq(0)").text(o.data("tooltip"));var m=this._tooltip.find(".pointer");this._tooltip.show();var b=m.outerWidth();this._tooltip.hide();var f=o.getOffsets("offset");var l=o.getDimensions("outer");var n=this._tooltip.getDimensions("outer");var a=this._tooltip.getDimensions("inner");var i=f.left+Math.ceil(l.width/2);var j=Math.ceil(n.width/2);var h="center";if((i-j)<5){h="left"}else{if((this._viewportDimensions.width-5)<(i+j)){h="right"}}if(f.top+l.height+n.height-$(document).scrollTop()<$(window).height()){e=f.top+l.height+7;this._tooltip.removeClass("inverse");m.css("top",-5)}else{e=f.top-n.height-7;this._tooltip.addClass("inverse");m.css("top",n.height)}var g=(WCF.Language.get("wcf.global.pageDirection")=="rtl"?"right":"left");switch(h){case"center":d=Math.round(f.left-j+(l.width/2));m.css(g,(a.width/2-b/2)+"px");break;case"left":d=f.left;if(g==="right"){m.css(g,(a.width-b-5)+"px")}else{m.css(g,"5px")}break;case"right":d=f.left+l.width-n.width;if(g==="right"){m.css(g,"5px")}else{m.css(g,(a.width-b-5)+"px")}break}this._tooltip.css({top:e+"px",left:d+"px"});this._tooltip.wcfFadeIn()},_mouseLeaveHandler:function(a){this._tooltip.stop().hide().css({opacity:1})}});WCF.CloseOverlayHandler={_callbacks:new WCF.Dictionary(),_isListening:false,addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.CloseOverlayHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},forceExecution:function(){this._executeCallbacks()},_bindListener:function(){if(this._isListening){return}$(document.body).click($.proxy(this._executeCallbacks,this));this._isListening=true},_executeCallbacks:function(a){this._callbacks.each(function(b){b.value()})}};WCF.DOMNodeInsertedHandler={_callbacks:[],_isExecuting:false,addCallback:function(a,b){this._callbacks.push(b)},_executeCallbacks:function(){if(this._isExecuting){return}this._isExecuting=true;for(var b=0,a=this._callbacks.length;b<a;b++){this._callbacks[b]()}this._isExecuting=false},execute:function(){this._executeCallbacks()}};WCF.DOMNodeRemovedHandler={_callbacks:new WCF.Dictionary(),_isExecuting:false,_isListening:false,addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.DOMNodeRemovedHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},_bindListener:function(){if(this._isListening){return}if(window.MutationObserver){var a=new MutationObserver((function(b){var c=false;b.forEach((function(d){if(d.removedNodes.length){c=true}}).bind(this));if(c){this._executeCallbacks({})}}).bind(this));a.observe(document.body,{childList:true,subtree:true})}else{$(document).bind("DOMNodeRemoved",$.proxy(this._executeCallbacks,this))}this._isListening=true},_executeCallbacks:function(a){if(this._isExecuting){return}this._isExecuting=true;this._callbacks.each(function(b){b.value(a)});this._isExecuting=false}};WCF.Option={};WCF.Option.Handler=Class.extend({init:function(){this._initOptions();WCF.DOMNodeInsertedHandler.addCallback("WCF.Option.Handler",$.proxy(this._initOptions,this))},_initOptions:function(){$(".jsEnablesOptions").each($.proxy(this._initOption,this))},_initOption:function(a,b){this._change(b);$(b).change($.proxy(this._handleChange,this))},_handleChange:function(a){this._change($(a.target))},_change:function(option){option=$(option);var $disableOptions=eval(option.data("disableOptions"));var $enableOptions=eval(option.data("enableOptions"));switch(option.getTagName()){case"input":switch(option.attr("type")){case"checkbox":this._execute(option.prop("checked"),$disableOptions,$enableOptions);break;case"radio":if(option.prop("checked")){this._execute(true,$disableOptions,$enableOptions)}break}break;case"select":var $value=option.val();var $disableOptions=$enableOptions=[];if(option.data("disableOptions").length>0){for(var $index in option.data("disableOptions")){var $item=option.data("disableOptions")[$index];if($item.value==$value){$disableOptions.push($item.option)}}}if(option.data("enableOptions").length>0){for(var $index in option.data("enableOptions")){var $item=option.data("enableOptions")[$index];if($item.value==$value){$enableOptions.push($item.option)}}}this._execute(true,$disableOptions,$enableOptions);break}},_execute:function(e,f,d){if(f.length>0){for(var g=0,b=f.length;g<b;g++){var a=f[g];if($.wcfIsset(a)){this._enableOption(a,!e)}else{var c=$("."+a+"Input");if(c.length){this._enableOptions(c.children("dd").find("input, select, textarea"),!e)}}}}if(d.length>0){for(var g=0,b=d.length;g<b;g++){var a=d[g];if($.wcfIsset(a)){this._enableOption(a,e)}else{var c=$("."+a+"Input");if(c.length){this._enableOptions(c.children("dd").find("input, select, textarea"),e)}}}}},_enableOption:function(b,a){this._enableOptionElement($("#"+$.wcfEscapeID(b)),a)},_enableOptionElement:function(c,b){c=$(c);var a=c.getTagName();if(a=="select"||(a=="input"&&(c.attr("type")=="checkbox"||c.attr("type")=="file"||c.attr("type")=="radio"))){if(b){c.enable()}else{c.disable()}}else{if(b){c.removeAttr("readonly")}else{c.attr("readonly",true)}}if(b){c.closest("dl").removeClass("disabled")}else{c.closest("dl").addClass("disabled")}},_enableOptions:function(a,b){for(var d=0,c=a.length;d<c;d++){this._enableOptionElement(a[d],b)}}});WCF.PageVisibilityHandler={_callbacks:new WCF.Dictionary(),_isListening:false,_hiddenFieldName:"",addCallback:function(a,b){this._bindListener();if(this._callbacks.isset(a)){console.debug("[WCF.PageVisibilityHandler] identifier '"+a+"' is already bound to a callback");return false}this._callbacks.add(a,b)},removeCallback:function(a){if(this._callbacks.isset(a)){this._callbacks.remove(a)}},_bindListener:function(){if(this._isListening){return}var a=null;if(typeof document.hidden!=="undefined"){this._hiddenFieldName="hidden";a="visibilitychange"}else{if(typeof document.mozHidden!=="undefined"){this._hiddenFieldName="mozHidden";a="mozvisibilitychange"}else{if(typeof document.msHidden!=="undefined"){this._hiddenFieldName="msHidden";a="msvisibilitychange"}else{if(typeof document.webkitHidden!=="undefined"){this._hiddenFieldName="webkitHidden";a="webkitvisibilitychange"}}}}if(a===null){console.debug("[WCF.PageVisibilityHandler] This browser does not support the page visibility API.")}else{$(document).on(a,$.proxy(this._executeCallbacks,this))}this._isListening=true},_executeCallbacks:function(b){if(this._isExecuting){return}this._isExecuting=true;var a=document[this._hiddenFieldName];this._callbacks.each(function(c){c.value(a)});this._isExecuting=false}};WCF.Table={};WCF.Table.EmptyTableHandler=Class.extend({_options:{},_rowClassName:"",init:function(b,c,a){this._rowClassName=c;this._tableContainer=b;this._options=$.extend(true,{emptyMessage:null,messageType:"info",refreshPage:false,updatePageNumber:false},a||{});WCF.DOMNodeRemovedHandler.addCallback("WCF.Table.EmptyTableHandler."+c,$.proxy(this._remove,this))},_getRowCount:function(){return this._tableContainer.find("table tr."+this._rowClassName).length},_handleEmptyTable:function(){if(this._options.emptyMessage){this._tableContainer.replaceWith($("<p />").addClass(this._options.messageType).text(this._options.emptyMessage))}else{if(this._options.refreshPage){if(this._options.updatePageNumber){var a=window.location.href.match(/(\?|&)pageNo=(\d+)/g);if(a){var b=a[a.length-1].match(/\d+/g);if(this._options.updatePageNumber>0){b++}else{b--}window.location=window.location.href.replace(a[a.length-1],a[a.length-1][0]+"pageNo="+b)}}else{window.location.reload()}}else{this._tableContainer.remove()}}},_remove:function(c){if($.getLength(c)){var b=$(c.target);if(b.hasClass(this._rowClassName)){var a=b.parents("tbody:eq(0)");if(a.children("tr").length==1){this._handleEmptyTable()}}}else{if(!this._getRowCount()){this._handleEmptyTable()}}}});WCF.Search={};WCF.Search.Base=Class.extend({_callback:null,_caretAt:-1,_className:"",_commaSeperated:false,_delay:0,_excludedSearchValues:[],_itemCount:0,_itemIndex:-1,_list:null,_oldSearchString:[],_proxy:null,_searchInput:null,_triggerLength:3,_timer:null,init:function(b,e,a,c,d){if(e!==null&&e!==undefined&&!$.isFunction(e)){console.debug("[WCF.Search.Base] The given callback is invalid, aborting.");return}this._callback=(e)?e:null;this._caretAt=-1;this._delay=0;this._excludedSearchValues=[];if(a){this._excludedSearchValues=a}this._searchInput=$(b);if(!this._searchInput.length){console.debug("[WCF.Search.Base] Selector '"+b+"' for search input is invalid, aborting.");return}this._searchInput.keydown($.proxy(this._keyDown,this)).keyup($.proxy(this._keyUp,this)).wrap('<span class="dropdown" />');if($.browser.mozilla&&$.browser.touch){this._searchInput.on("input",$.proxy(this._keyUp,this))}this._list=$('<ul class="dropdownMenu" />').insertAfter(this._searchInput);this._commaSeperated=(c)?true:false;this._oldSearchString=[];this._itemCount=0;this._itemIndex=-1;this._proxy=new WCF.Action.Proxy({showLoadingOverlay:(d!==true?false:true),success:$.proxy(this._success,this),autoAbortPrevious:true});if(this._searchInput.is("input")){this._searchInput.attr("autocomplete","off")}this._searchInput.blur($.proxy(this._blur,this));WCF.Dropdown.initDropdownFragment(this._searchInput.parent(),this._list)},_blur:function(){var a=this;new WCF.PeriodicalExecuter(function(b){if(a._list.is(":visible")){a._clearList(false)}b.stop()},250)},_keyDown:function(a){if(a.which===$.ui.keyCode.ENTER){var b=this._searchInput.parents(".dropdown");if(b.data("disableAutoFocus")){if(this._itemIndex!==-1){a.preventDefault()}}else{if(b.data("preventSubmit")||this._itemIndex!==-1){a.preventDefault()}}}},_keyUp:function(d){switch(d.which){case 37:case 39:return;break;case 38:this._selectPreviousItem();return;break;case 40:this._selectNextItem();return;break;case 13:return this._selectElement(d);break}var b=this._getSearchString(d);if(b===""){this._clearList(false)}else{if(b.length>=this._triggerLength){var c={data:{excludedSearchValues:this._excludedSearchValues,searchString:b}};if(this._delay){if(this._timer!==null){this._timer.stop()}var a=this;this._timer=new WCF.PeriodicalExecuter(function(){a._queryServer(c);a._timer.stop();a._timer=null},this._delay)}else{this._queryServer(c)}}else{this._clearList(false)}}},_queryServer:function(a){this._searchInput.parents(".searchBar").addClass("loading");this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters(a)});this._proxy.sendRequest()},setDelay:function(a){this._delay=a},_selectNextItem:function(){if(this._itemCount===0){return}this._itemIndex++;if(this._itemIndex===this._itemCount){this._itemIndex=0}this._highlightSelectedElement()},_selectPreviousItem:function(){if(this._itemCount===0){return}this._itemIndex--;if(this._itemIndex===-1){this._itemIndex=this._itemCount-1}this._highlightSelectedElement()},_highlightSelectedElement:function(){this._list.find("li").removeClass("dropdownNavigationItem");this._list.find("li:eq("+this._itemIndex+")").addClass("dropdownNavigationItem")},_selectElement:function(a){if(this._itemCount===0){return true}this._list.find("li.dropdownNavigationItem").trigger("click");return false},_getSearchString:function(d){var a=$.trim(this._searchInput.val());if(this._commaSeperated){var c=d.keyCode||d.which;if(c==$.ui.keyCode.COMMA){return""}var b=a.split(",");var e=b.length;for(var g=0;g<e;g++){b[g]=$.trim(b[g])}for(var g=0;g<e;g++){var f=b[g];if(this._oldSearchString[g]){if(f!=this._oldSearchString[g]){a=f;this._caretAt=g;break}}else{a=f;break}}this._oldSearchString=b}return a},_getParameters:function(a){return a},_success:function(d,f,c){this._clearList(false);this._searchInput.parents(".searchBar").removeClass("loading");if($.getLength(d.returnValues)){for(var e in d.returnValues){var a=d.returnValues[e];this._createListItem(a)}}else{if(!this._handleEmptyResult()){return}}WCF.CloseOverlayHandler.addCallback("WCF.Search.Base",$.proxy(function(){this._clearList()},this));var b=this._searchInput.parents(".dropdown").wcfIdentify();if(!WCF.Dropdown.getDropdownMenu(b).hasClass("dropdownOpen")){WCF.Dropdown.toggleDropdown(b)}this._itemIndex=-1;if(!WCF.Dropdown.getDropdown(b).data("disableAutoFocus")){this._selectNextItem()}},_handleEmptyResult:function(){return false},_createListItem:function(b){var a=$("<li><span>"+WCF.String.escapeHTML(b.label)+"</span></li>").appendTo(this._list);a.data("objectID",b.objectID).data("label",b.label).click($.proxy(this._executeCallback,this));this._itemCount++;return a},_executeCallback:function(d){var a=false;var c=$(d.currentTarget);if(this._commaSeperated){var b=c.data("label");this._oldSearchString[this._caretAt]=b;this._searchInput.val(this._oldSearchString.join(", "));if($.browser.webkit){this._searchInput.css({display:"block"})}var e=this._searchInput.val().toLowerCase().indexOf(b.toLowerCase())+b.length;this._searchInput.focus().setCaret(e)}else{if(this._callback===null){this._searchInput.val(c.data("label"))}else{a=(this._callback(c.data())===true)?true:false}}this._clearList(a)},_clearList:function(a){if(a&&!this._commaSeperated){this._searchInput.val("")}WCF.Dropdown.getDropdown(this._searchInput.parents(".dropdown").wcfIdentify()).removeClass("dropdownOpen");WCF.Dropdown.getDropdownMenu(this._searchInput.parents(".dropdown").wcfIdentify()).removeClass("dropdownOpen");this._list.end().empty();WCF.CloseOverlayHandler.removeCallback("WCF.Search.Base");this._itemCount=0;this._itemIndex=-1},addExcludedSearchValue:function(a){if(!WCF.inArray(a,this._excludedSearchValues)){this._excludedSearchValues.push(a)}},removeExcludedSearchValue:function(b){var a=$.inArray(b,this._excludedSearchValues);if(a!=-1){this._excludedSearchValues.splice(a,1)}}});WCF.Search.User=WCF.Search.Base.extend({_className:"wcf\\data\\user\\UserAction",_includeUserGroups:false,init:function(c,e,a,b,d){this._includeUserGroups=a;this._super(c,e,b,d)},_getParameters:function(a){a.data.includeUserGroups=this._includeUserGroups?1:0;return a},_createListItem:function(e){var d=this._super(e);var b=null;if(e.icon){b=$(e.icon)}else{if(this._includeUserGroups&&e.type==="group"){b=$('<span class="icon icon16 icon-group" />')}}if(b){var a=d.find("span").detach();var c=$("<div />").addClass("box16").appendTo(d);c.append(b);c.append($("<div />").append(a))}d.data("type",e.type);return d}});WCF.System={};WCF.System.Dependency={};WCF.System.Dependency.Manager={_callbacks:{},_loaded:[],_setupCallbacks:{},register:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Dependency.Manager] Callback for identifier '"+a+"' is invalid, aborting.");return}if(WCF.inArray(a,this._loaded)){setTimeout(function(){b()},1)}else{if(!this._callbacks[a]){this._callbacks[a]=[]}this._callbacks[a].push(b)}},setup:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Dependency.Manager] Setup callback for identifier '"+a+"' is invalid, aborting.");return}if(!this._setupCallbacks[a]){this._setupCallbacks[a]=[]}this._setupCallbacks[a].push(b)},invoke:function(a){if(this._setupCallbacks[a]){for(var c=0,b=this._setupCallbacks[a].length;c<b;c++){this._setupCallbacks[a][c]()}delete this._setupCallbacks[a]}this._loaded.push(a);if(this._callbacks[a]){for(var c=0,b=this._callbacks[a].length;c<b;c++){this._callbacks[a][c]()}delete this._callbacks[a]}}};WCF.System.FlexibleMenu={_containers:{},_containerIDs:[],_dropdowns:{},_dropdownMenus:{},_hasHiddenItems:{},_isWorking:false,_menuItems:{},init:function(){this.registerMenu("mainMenu");this.registerMenu($(".navigationHeader:eq(0)").wcfIdentify());this._registerTabMenus();$(window).resize($.proxy(this.rebuildAll,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.System.FlexibleMenu",$.proxy(this._registerTabMenus,this))},_registerTabMenus:function(){$(".tabMenuContainer:not(.jsFlexibleMenuEnabled), .messageTabMenu:not(.jsFlexibleMenuEnabled)").each(function(a,b){var c=$(b).addClass("jsFlexibleMenuEnabled").children("nav");if(c.length&&c.find("> ul:eq(0) > li").length){WCF.System.FlexibleMenu.registerMenu(c.wcfIdentify())}})},registerMenu:function(a){var b=$("#"+a);if(!b.length){console.debug("[WCF.System.FlexibleMenu] Unable to find container identified by '"+a+"', aborting.");return}this._containerIDs.push(a);this._containers[a]=b;this._menuItems[a]=b.find("> ul:eq(0) > li");this._dropdowns[a]=$('<li class="dropdown jsFlexibleMenuDropdown"><a class="icon icon16 icon-list" /></li>').data("containerID",a).click($.proxy(this._click,this));this._dropdownMenus[a]=$('<ul class="dropdownMenu" />').appendTo(this._dropdowns[a]);this._hasHiddenItems[a]=false;this.rebuild(a);WCF.Dropdown.initDropdown(this._dropdowns[a].children("a"))},rebuildAll:function(){if(this._isWorking){return}this._isWorking=true;for(var b=0,a=this._containerIDs.length;b<a;b++){this.rebuild(this._containerIDs[b])}this._isWorking=false},rebuild:function(j){if(!this._containers[j]){console.debug("[WCF.System.FlexibleMenu] Cannot rebuild unknown container identified by '"+j+"'");return}var l=this._containers[j];var f=this._menuItems[j].hide();var a=f.filter(".active, .ui-state-active").show();if(!this._hasHiddenItems[j]){this._dropdowns[j].appendTo(l.children("ul:eq(0)"))}var g=this._dropdowns[j].outerWidth(true);var e=l.parent();var b=e.innerWidth();b-=e.cssAsNumber("padding-left")+e.cssAsNumber("padding-right");b-=l.cssAsNumber("margin-left")+l.cssAsNumber("margin-right");b-=l.cssAsNumber("padding-left")+l.cssAsNumber("padding-right");b-=l.children("ul:eq(0)").cssAsNumber("padding-left")+l.children("ul:eq(0)").cssAsNumber("padding-right");b-=a.outerWidth(true);this._hasHiddenItems[j]=false;for(var i=0;i<f.length;i++){var h=$(f[i]);if(h.hasClass("active")||h.hasClass("ui-state-active")){continue}var c=h.outerWidth(true);if(b-c>0){b-=c;h.show()}else{if(b<g){var d=h.prev();if(d.hasClass("active")||d.hasClass("ui-state-active")){d.prev().hide()}else{d.hide()}}this._hasHiddenItems[j]=true;break}}if(this._hasHiddenItems[j]){this._dropdownMenus[j].empty();var k=this;f.each($.proxy(function(m,n){if($(n).is(":visible")){return true}$("<li>"+$(n).html()+"</li>").data("index",m).appendTo(this._dropdownMenus[j]).click(function(p){var o=$(f[$(p.currentTarget).data("index")]);if(o[0].tagName==="A"){o.trigger("click")}else{if(o[0].tagName==="LI"){o.find("a").trigger("click")}}if(o.parent().hasClass("ui-tabs-nav")){p.preventDefault()}setTimeout(function(){k.rebuild(j)},50)})},this))}else{this._dropdowns[j].detach()}}};WCF.System.Mobile={};WCF.System.Mobile.UX={_enabled:false,_main:null,_sidebar:null,init:function(){this._enabled=false;this._main=$("#main");this._sidebar=this._main.find("> div > div > .sidebar");if($.browser.touch){$("html").addClass("touch")}enquire.register("screen and (max-width: 800px)",{match:$.proxy(this._enable,this),unmatch:$.proxy(this._disable,this),setup:$.proxy(this._setup,this),deferSetup:true});if($.browser.msie&&this._sidebar.width()>305){this._sidebar.css("display","none").css("display","")}},_setup:function(){this._initSidebarToggleButtons();this._initSearchBar();this._initButtonGroupNavigation();WCF.CloseOverlayHandler.addCallback("WCF.System.Mobile.UX",$.proxy(this._closeMenus,this));WCF.DOMNodeInsertedHandler.addCallback("WCF.System.Mobile.UX",$.proxy(this._initButtonGroupNavigation,this))},_enable:function(){this._enabled=true;if($.browser.msie){this._sidebar.css("display","none").css("display","")}},_disable:function(){this._enabled=false;if($.browser.msie){this._sidebar.css("display","none").css("display","")}},_initSidebarToggleButtons:function(){var c=this._main.hasClass("sidebarOrientationLeft");var b=this._main.hasClass("sidebarOrientationRight");if(c||b){var d="wcf.global.sidebar.show"+(c?"Left":"Right")+"Sidebar";if(d===WCF.Language.get(d)||WCF.Language.get(d)===""){d='<span class="icon icon16 icon-double-angle-'+(c?"left":"right")+'" />'}var e="wcf.global.sidebar.hide"+(c?"Left":"Right")+"Sidebar";if(e===WCF.Language.get(e)||WCF.Language.get(e)===""){e='<span class="icon icon16 icon-double-angle-'+(c?"right":"left")+'" />'}var a=this;$('<span class="button small mobileSidebarToggleButton">'+d+"</span>").appendTo($(".content")).click(function(){a._main.addClass("mobileShowSidebar")});$('<span class="button small mobileSidebarToggleButton">'+e+"</span>").appendTo($(".sidebar")).click(function(){a._main.removeClass("mobileShowSidebar")})}},_initSearchBar:function(){var b=$(".searchBar:eq(0)");var a=this;b.click(function(){if(a._enabled){b.addClass("searchBarOpen")}});this._main.click(function(){b.removeClass("searchBarOpen")})},_initButtonGroupNavigation:function(){$(".buttonGroupNavigation:not(.jsMobileButtonGroupNavigation)").each(function(b,a){var d=$(a).addClass("jsMobileButtonGroupNavigation");var c=$('<a class="dropdownLabel"><span class="icon icon24 icon-list" /></a>').prependTo(d);c.click(function(){c.next().toggleClass("open");return false})})},_closeMenus:function(){$(".jsMobileButtonGroupNavigation > ul.open").removeClass("open")}};WCF.System.ObjectStore={_objects:{},add:function(a,b){if(this._objects[a]===undefined){this._objects[a]=[]}this._objects[a].push(b)},invoke:function(a,c){if(this._objects[a]){for(var b=0;b<this._objects[a].length;b++){c(this._objects[a][b])}}}};WCF.System.Captcha={_captchas:{},addCallback:function(a,b){if(!$.isFunction(b)){console.debug("[WCF.System.Captcha] Given callback is no function");return}this._captchas[a]=b},getData:function(a){if(this._captchas[a]===undefined){console.debug('[WCF.System.Captcha] Unknow captcha id "'+a+'"');return}return this._captchas[a]()},removeCallback:function(a){delete this._captchas[a]}};WCF.System.Page={};WCF.System.Page.Multiple=Class.extend({_cache:{},_options:{},_pageNo:1,_pages:0,_previousPageNo:0,init:function(a){this._options=$.extend({container:null,pagination:null,loadItems:null},a);this._cache={};this._pageNo=1;this._pages=0;this._previousPageNo=0;if(this._pagination.data("pages")){this._pagination.wcfPages({maxPage:this._pagination.data("pages")}).on("wcfpagesswitched",$.proxy(this._showPage,this))}},_showPage:function(a,b){if(b&&b.activePage){if(!b.template){this._previousPageNo=this._pageNo}this._pageNo=b.activePage}if(this._cache[this._pageNo]||(b&&b.template)){this._cache[this._previousPageNo]=this._list.children().detach();if(b&&b.template){this._list.html(b.template)}else{this._list.append(this._cache[this._pageNo])}}else{this._options.loadItems()}},showPage:function(a,b){this._showPage(null,{activePage:a,template:b})},getPageNo:function(){return this._pageNo}});WCF.System.Notification=Class.extend({_callback:null,_cssClassNames:"",_message:"",_overlay:null,_timer:null,init:function(a,b){this._cssClassNames=b||"success";this._message=a||WCF.Language.get("wcf.global.success");this._overlay=$("#systemNotification");this._timer=null;if(!this._overlay.length){this._overlay=$('<div id="systemNotification"><p></p></div>').hide().appendTo(document.body);this._overlay.children("p").click((function(){this._hide()}).bind(this))}},show:function(d,b,a,c){b=parseInt(b);if(!b){b=2000}if(d&&$.isFunction(d)){this._callback=d}this._overlay.children("p").html((a||this._message));this._overlay.children("p").removeClass().addClass((c||this._cssClassNames));this._timer=new WCF.PeriodicalExecuter($.proxy(this._hide,this),b);this._overlay.wcfFadeIn(undefined,300)},_hide:function(a){a=(a)?a:this._timer;if(this._callback!==null){this._callback()}this._overlay.wcfFadeOut(undefined,300);a.stop();a=null}});WCF.System.Confirmation={_callback:null,_dialog:null,_parameters:null,_visible:false,_confirmationButton:null,show:function(c,e,b,a){if(this._visible){console.debug("[WCF.System.Confirmation] Confirmation dialog is already open, refusing action.");return}if(!$.isFunction(e)){console.debug("[WCF.System.Confirmation] Given callback is invalid, aborting.");return}this._callback=e;this._parameters=b;var d=true;if(this._dialog===null){this._createDialog();d=false}this._dialog.find("#wcfSystemConfirmationContent").empty().hide();if(a&&a.length){a.appendTo(this._dialog.find("#wcfSystemConfirmationContent").show())}this._dialog.find("p").text(c);this._dialog.wcfDialog({onClose:$.proxy(this._close,this),onShow:$.proxy(this._show,this),title:WCF.Language.get("wcf.global.confirmation.title")});if(d){this._dialog.wcfDialog("render")}this._confirmationButton.focus();this._visible=true},_createDialog:function(){this._dialog=$('<div id="wcfSystemConfirmation" class="systemConfirmation"><p /><div id="wcfSystemConfirmationContent" /></div>').hide().appendTo(document.body);var a=$('<div class="formSubmit" />').appendTo(this._dialog);this._confirmationButton=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.confirmation.confirm")+"</button>").data("action","confirm").click($.proxy(this._click,this)).appendTo(a);$("<button>"+WCF.Language.get("wcf.global.confirmation.cancel")+"</button>").data("action","cancel").click($.proxy(this._click,this)).appendTo(a)},_click:function(a){this._notify($(a.currentTarget).data("action"))},_close:function(){if(this._visible){this._notify("cancel")}},_notify:function(a){this._visible=false;this._dialog.wcfDialog("close");this._confirmationButton.blur();this._callback(a,this._parameters)},_show:function(){this._dialog.find("button.buttonPrimary").blur().focus()}};WCF.System.DisableScrolling={_depth:0,_oldOverflow:null,disable:function(){if($.browser.touch){return}if(this._depth===0){this._oldOverflow=$(document.body).css("overflow");$(document.body).css("overflow","hidden")}this._depth++},enable:function(){if(this._depth===0){return}this._depth--;if(this._depth===0){$(document.body).css("overflow",this._oldOverflow)}}};WCF.System.DisableZoom={_depth:0,_oldViewportSettings:null,disable:function(){if(this._depth===0){var a=$("meta[name=viewport]");this._oldViewportSettings=a.attr("content");a.attr("content",this._oldViewportSettings+",maximum-scale=1")}this._depth++},enable:function(){if(this._depth===0){return}this._depth--;if(this._depth===0){$("meta[name=viewport]").attr("content",this._oldViewportSettings)}}};WCF.System.Fullscreen={enterFullscreen:function(a){if(a.requestFullscreen){a.requestFullscreen()}else{if(a.msRequestFullscreen){a.msRequestFullscreen()}else{if(a.mozRequestFullScreen){a.mozRequestFullScreen()}else{if(a.webkitRequestFullscreen){a.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT)}}}}},toggleFullscreen:function(a){if(this.getFullscreenElement()===null){this.enterFullscreen(a)}else{this.exitFullscreen()}},getFullscreenElement:function(){if(document.fullscreenElement){return document.fullscreenElement}else{if(document.mozFullScreenElement){return document.mozFullScreenElement}else{if(document.webkitFullscreenElement){return document.webkitFullscreenElement}else{if(document.msFullscreenElement){return document.msFullscreenElement}}}}return null},exitFullscreen:function(){if(document.exitFullscreen){document.exitFullscreen()}else{if(document.msExitFullscreen){document.msExitFullscreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitExitFullscreen){document.webkitExitFullscreen()}}}}},isSupported:function(){if(document.documentElement.requestFullscreen||document.documentElement.msRequestFullscreen||document.documentElement.mozRequestFullScreen||document.documentElement.webkitRequestFullscreen){return true}return false}};WCF.System.PageNavigation={_button:null,_description:null,_dialog:null,_elementID:"",_elements:{},_pageNo:null,init:function(a,c){var b=$(a);if(!b.length){return}c=c||null;if(c!==null&&!$.isFunction(c)){console.debug("[WCF.System.PageNavigation] Callback for selector '"+a+"' is invalid, aborting.");return}this._initElements(b,c)},_initElements:function(b,c){var a=this;b.each(function(e,f){var d=$(f);var g=d.wcfIdentify();if(a._elements[g]===undefined){a._elements[g]=d;d.find("li.jumpTo").data("elementID",g).click($.proxy(a._click,a))}}).data("callback",c)},_click:function(b){this._elementID=$(b.currentTarget).data("elementID");if(this._dialog===null){this._dialog=$('<div id="pageNavigationOverlay" />').hide().appendTo(document.body);var c=$("<fieldset><legend>"+WCF.Language.get("wcf.global.page.jumpTo")+"</legend></fieldset>").appendTo(this._dialog);$('<dl><dt><label for="jsPageNavigationPageNo">'+WCF.Language.get("wcf.global.page.jumpTo")+"</label></dt><dd></dd></dl>").appendTo(c);this._pageNo=$('<input type="number" id="jsPageNavigationPageNo" value="1" min="1" max="1" class="tiny" />').keyup($.proxy(this._keyUp,this)).appendTo(c.find("dd"));this._description=$("<small></small>").insertAfter(this._pageNo);var a=$('<div class="formSubmit" />').appendTo(this._dialog);this._button=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.button.submit")+"</button>").click($.proxy(this._submit,this)).appendTo(a)}this._button.enable();this._description.html(WCF.Language.get("wcf.global.page.jumpTo.description").replace(/#pages#/,this._elements[this._elementID].data("pages")));this._pageNo.val(this._elements[this._elementID].data("pages")).attr("max",this._elements[this._elementID].data("pages"));this._dialog.wcfDialog({title:WCF.Language.get("wcf.global.page.pageNavigation")})},_keyUp:function(b){if(b.which==$.ui.keyCode.ENTER&&!this._button.prop("disabled")){this._submit();return}var a=parseInt(this._pageNo.val())||0;if(a<1||a>this._pageNo.attr("max")){this._button.disable()}else{this._button.enable()}},_submit:function(){var b=this._elements[this._elementID];if(b.data("callback")===null){var a=b.data("link").replace(/pageNo=%d/,"pageNo="+this._pageNo.val());window.location=a}else{b.data("callback")(this._pageNo.val());this._dialog.wcfDialog("close")}}};WCF.System.KeepAlive=Class.extend({init:function(a){new WCF.PeriodicalExecuter(function(b){new WCF.Action.Proxy({autoSend:true,data:{actionName:"keepAlive",className:"wcf\\data\\session\\SessionAction"},failure:function(){b.stop()},showLoadingOverlay:false,success:function(c){WCF.System.PushNotification.executeCallbacks(c)},suppressErrors:true})},(a*1000))}});WCF.System.PushNotification={_callbacks:{},addCallback:function(a,b){if(this._callbacks[a]===undefined){this._callbacks[a]=[]}this._callbacks[a].push(b)},executeCallbacks:function(b){for(var a in b.returnValues){if(this._callbacks[a]!==undefined){for(var c=0;c<this._callbacks[a].length;c++){this._callbacks[a][c](b.returnValues[a])}}}}};WCF.System.Event={_listeners:{},addListener:function(b,d,c){if(typeof this._listeners[b]==="undefined"){this._listeners[b]={}}if(typeof this._listeners[b][d]==="undefined"){this._listeners[b][d]=[]}var a=WCF.getUUID();this._listeners[b][d].push({callback:c,uuid:a});return a},removeListener:function(a,c,b){if(this._listeners[a]&&this._listeners[a][c]){for(var d=0;d<this._listeners[a][c].length;d++){if(this._listeners[a][c][d].uuid==b){this._listeners[a][c].splice(d,1);return true}}}return false},removeAllListeners:function(a,b){if(this._listeners[a]&&this._listeners[a][b]){delete this._listeners[a][b];return true}return false},fireEvent:function(a,c,b){b=b||{};if(this._listeners[a]&&this._listeners[a][c]){for(var d=0;d<this._listeners[a][c].length;d++){this._listeners[a][c][d].callback(b)}}}};WCF.System.Worker=Class.extend({_aborted:false,_actionName:"",_callback:null,_className:"",_dialog:null,_proxy:null,_title:"",init:function(a,b,d,c,e){this._aborted=false;this._actionName=a;this._callback=e||null;this._className=b;this._dialog=null;this._proxy=new WCF.Action.Proxy({autoSend:true,data:{actionName:this._actionName,className:this._className,parameters:c||{}},showLoadingOverlay:false,success:$.proxy(this._success,this)});this._title=d},_success:function(c){if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.wcfDialog({closeConfirmMessage:WCF.Language.get("wcf.worker.abort.confirmMessage"),closeViaModal:false,onClose:$.proxy(function(){this._aborted=true;this._proxy.abortPrevious();window.location.reload()},this),title:this._title})}if(this._aborted){return}if(c.returnValues.template){this._dialog.html(c.returnValues.template)}this._dialog.find("progress").attr("value",c.returnValues.progress).text(c.returnValues.progress+"%").next("span").text(c.returnValues.progress+"%");if(c.returnValues.progress<100){var b=c.returnValues.parameters||{};b.loopCount=c.returnValues.loopCount;this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:b});this._proxy.sendRequest()}else{if(this._callback!==null){this._callback(this,c)}else{this._dialog.find(".fa-spinner").removeClass("fa-spinner").addClass("fa-check green");this._dialog.find(".boxHeadline h1").text(WCF.Language.get("wcf.global.worker.completed"));var a=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.global.button.next")+"</button>").appendTo(a).focus().click(function(){if(c.returnValues.redirectURL){window.location=c.returnValues.redirectURL}else{window.location.reload()}});this._dialog.wcfDialog("render")}}}});WCF.InlineEditor=Class.extend({_callbacks:[],_dropdowns:{},_elements:{},_notification:null,_options:[],_proxy:null,_triggerElements:{},_updateData:[],init:function(d){var c=$(d);if(!c.length){return}this._setOptions();var b="";for(var f=0,e=this._options.length;f<e;f++){if(this._options[f].isQuickOption){b=this._options[f].optionName;break}}var a=this;c.each(function(i,j){var h=$(j);var k=h.wcfIdentify();var g=a._getTriggerElement(h);if(g===null||g.length!==1){return}g.click($.proxy(a._show,a)).data("elementID",k);if(b){g.disableSelection().data("optionName",b).dblclick($.proxy(a._click,a))}a._elements[k]=h});this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});WCF.CloseOverlayHandler.addCallback("WCF.InlineEditor",$.proxy(this._closeAll,this));this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success"),"success")},_closeAll:function(){for(var a in this._elements){this._hide(a)}},_setOptions:function(){this._options=[]},registerCallback:function(a){if($.isFunction(a)){this._callbacks.push(a)}},_getTriggerElement:function(a){return null},_show:function(b){b.preventDefault();var g=$(b.currentTarget).data("elementID");var h=null;if(!this._dropdowns[g]){this._triggerElements[g]=h=this._getTriggerElement(this._elements[g]).addClass("dropdownToggle").wrap('<span class="dropdown" />');this._dropdowns[g]=$('<ul class="dropdownMenu" />').insertAfter(h)}this._dropdowns[g].empty();var c=false;var d="";for(var k=0,i=this._options.length;k<i;k++){var a=this._options[k];if(a.optionName==="divider"){if(d!==""&&d!=="divider"){$('<li class="dropdownDivider" />').appendTo(this._dropdowns[g]);d=a.optionName}}else{if(this._validate(g,a.optionName)||this._validateCallbacks(g,a.optionName)){var f=$("<li><span>"+a.label+"</span></li>").appendTo(this._dropdowns[g]);f.data("elementID",g).data("optionName",a.optionName).data("isQuickOption",(a.isQuickOption?true:false)).click($.proxy(this._click,this));c=true;d=a.optionName}}}if(c){var l=this._dropdowns[g].children().last();if(l.hasClass("dropdownDivider")){l.remove()}var j=null;var e=0;this._dropdowns[g].children().each(function(m,o){var n=$(o);if(!n.hasClass("dropdownDivider")){if(n.data("isQuickOption")){j=n}else{e++}}});if(!e){j.trigger("click");if(this._triggerElements[g]){WCF.Dropdown.close(this._triggerElements[g].parents(".dropdown").wcfIdentify())}return false}}if(h!==null){WCF.Dropdown.initDropdown(h,true)}return false},_validate:function(a,b){return false},_validateCallbacks:function(a,b){var c=this._callbacks.length;if(c){for(var d=0;d<c;d++){if(this._callbacks[d].validate(this._elements[a],b)){return true}}}return false},_success:function(b,d,a){var c=this._updateData.length;if(!c){return}this._updateState(b);this._updateData=[]},_updateState:function(a){},_click:function(c){var b=$(c.currentTarget);var d=b.data("elementID");var a=b.data("optionName");if(!this._execute(d,a)){this._executeCallback(d,a)}this._hide(d)},_execute:function(a,b){return false},_executeCallback:function(a,b){var c=this._callbacks.length;if(c){for(var d=0;d<c;d++){if(this._callbacks[d].execute(this._elements[a],b)){return true}}}return false},_hide:function(a){if(this._dropdowns[a]){this._dropdowns[a].empty().removeClass("dropdownOpen")}}});WCF.Upload=Class.extend({_name:"__files[]",_buttonSelector:null,_fileListSelector:null,_fileUpload:null,_className:"",_iframe:null,_internalFileID:0,_options:{},_uploadMatrix:[],_supportsAJAXUpload:true,_overlay:null,init:function(c,e,d,b){this._buttonSelector=c;this._fileListSelector=e;this._className=d;this._internalFileID=0;this._options=$.extend(true,{action:"upload",multiple:false,url:"index.php/AJAXUpload/?t="+SECURITY_TOKEN+SID_ARG_2ND},b||{});this._options.url=WCF.convertLegacyURL(this._options.url);var a=new XMLHttpRequest();this._supportsAJAXUpload=(a&&("upload" in a)&&("onprogress" in a.upload));this._createButton()},_createButton:function(){if(this._supportsAJAXUpload){this._fileUpload=$('<input type="file" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/>");this._fileUpload.change($.proxy(this._upload,this));var a=$('<p class="button uploadButton"><span>'+WCF.Language.get("wcf.global.button.upload")+"</span></p>");a.prepend(this._fileUpload)}else{var a=$('<p class="button uploadFallbackButton"><span>'+WCF.Language.get("wcf.global.button.upload")+"</span></p>");a.click($.proxy(this._showOverlay,this))}this._insertButton(a)},_insertButton:function(a){this._buttonSelector.prepend(a)},_removeButton:function(){var a=".uploadButton";if(!this._supportsAJAXUpload){a=".uploadFallbackButton"}this._buttonSelector.find(a).remove()},_upload:function(c,e,b){var j=null;var a=[];if(e){a.push(e)}else{if(b){var g="";switch(b.type){case"image/png":g=".png";break;case"image/jpeg":g=".jpg";break;case"image/gif":g=".gif";break}a.push({name:"pasted-from-clipboard"+g})}else{a=this._fileUpload.prop("files")}}if(a.length){var m=new FormData();j=this._createUploadMatrix(a);if(!this._uploadMatrix[j].length){return null}for(var i=0,f=a.length;i<f;i++){if(this._uploadMatrix[j][i]){var h=this._uploadMatrix[j][i].data("internalFileID");if(b){m.append("__files["+h+"]",b,a[i].name)}else{m.append("__files["+h+"]",a[i])}}}m.append("actionName",this._options.action);m.append("className",this._className);var d=this._getParameters();for(var l in d){m.append("parameters["+l+"]",d[l])}var k=this;$.ajax({type:"POST",url:this._options.url,enctype:"multipart/form-data",data:m,contentType:false,processData:false,success:function(o,p,n){k._success(j,o)},error:$.proxy(this._error,this),xhr:function(){var n=$.ajaxSettings.xhr();if(n){n.upload.addEventListener("progress",function(o){k._progress(j,o)},false)}return n}})}return j},_createUploadMatrix:function(b){if(b.length){var c=this._uploadMatrix.length;this._uploadMatrix[c]=[];for(var f=0,d=b.length;f<d;f++){var a=b[f];var e=this._initFile(a);if(!e.hasClass("uploadFailed")){e.data("filename",a.name).data("internalFileID",this._internalFileID++);this._uploadMatrix[c][f]=e}}return c}return null},_success:function(b,a){},_error:function(a,c,b){},_progress:function(c,a){var b=Math.round(a.loaded*100/a.total);for(var d in this._uploadMatrix[c]){this._uploadMatrix[c][d].find("progress").attr("value",b)}},_getParameters:function(){return{}},_initFile:function(a){return $("<li>"+a.name+" ("+a.size+')<progress max="100" /></li>').appendTo(this._fileListSelector)},_showOverlay:function(){if(this._iframe===null){this._iframe=$('<iframe name="__fileUploadIFrame" />').hide().appendTo(document.body)}if(!this._overlay){this._overlay=$('<div><form enctype="multipart/form-data" method="post" action="'+this._options.url+'" target="__fileUploadIFrame" /></div>').hide().appendTo(document.body);var a=this._overlay.find("form");$('<dl class="wide"><dd><input type="file" id="__fileUpload" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/></dd></dl>").appendTo(a);$('<div class="formSubmit"><input type="submit" value="Upload" accesskey="s" /></div></form>').appendTo(a);$('<input type="hidden" name="isFallback" value="1" />').appendTo(a);$('<input type="hidden" name="actionName" value="'+this._options.action+'" />').appendTo(a);$('<input type="hidden" name="className" value="'+this._className+'" />').appendTo(a);var b=this._getParameters();for(var c in b){$('<input type="hidden" name="'+c+'" value="'+b[c]+'" />').appendTo(a)}a.submit($.proxy(function(){var d={name:this._getFilename(),size:""};var f=this._createUploadMatrix([d]);var e=this;this._iframe.data("loading",true).off("load").load(function(){e._evaluateResponse(f)});this._overlay.wcfDialog("close")},this))}this._overlay.wcfDialog({title:WCF.Language.get("wcf.global.button.upload")})},_evaluateResponse:function(b){var a=$.parseJSON(this._iframe.contents().find("pre").html());this._success(b,a)},_getFilename:function(){return $("#__fileUpload").val().split("\\").pop()}});WCF.Upload.Parallel=WCF.Upload.extend({init:function(b,d,c,a){a=$.extend(true,a||{},{multiple:true});this._super(b,d,c,a)},_upload:function(){var b=this._fileUpload.prop("files");for(var h=0,e=b.length;h<e;h++){var a=b[h];var c=new FormData();var g=this._createUploadMatrix(a);if(!this._uploadMatrix[g].length){continue}c.append("__files["+g+"]",a);c.append("actionName",this._options.action);c.append("className",this._className);var d=this._getParameters();for(var f in d){c.append("parameters["+f+"]",d[f])}this._sendRequest(g,c)}},_sendRequest:function(c,b){var a=this;$.ajax({type:"POST",url:this._options.url,enctype:"multipart/form-data",data:b,contentType:false,processData:false,success:function(e,f,d){a._success(c,e)},error:$.proxy(this._error,this),xhr:function(){var d=$.ajaxSettings.xhr();if(d){d.upload.addEventListener("progress",function(e){a._progress(c,e)},false)}return d}})},_createUploadMatrix:function(a){var b=this._initFile(a);if(!b.hasClass("uploadFailed")){b.data("filename",a.name).data("internalFileID",this._internalFileID);this._uploadMatrix[this._internalFileID++]=b;return this._internalFileID-1}return null},_success:function(b,a){},_progress:function(b,a){var c=Math.round(a.loaded*100/a.total);this._uploadMatrix[b].find("progress").attr("value",c)},_showOverlay:function(){if(this._iframe===null){this._iframe=$('<iframe name="__fileUploadIFrame" />').hide().appendTo(document.body)}if(!this._overlay){this._overlay=$('<div><form enctype="multipart/form-data" method="post" action="'+this._options.url+'" target="__fileUploadIFrame" /></div>').hide().appendTo(document.body);var a=this._overlay.find("form");$('<dl class="wide"><dd><input type="file" id="__fileUpload" name="'+this._name+'" '+(this._options.multiple?'multiple="true" ':"")+"/></dd></dl>").appendTo(a);$('<div class="formSubmit"><input type="submit" value="Upload" accesskey="s" /></div></form>').appendTo(a);$('<input type="hidden" name="isFallback" value="1" />').appendTo(a);$('<input type="hidden" name="actionName" value="'+this._options.action+'" />').appendTo(a);$('<input type="hidden" name="className" value="'+this._className+'" />').appendTo(a);var b=this._getParameters();for(var c in b){$('<input type="hidden" name="'+c+'" value="'+b[c]+'" />').appendTo(a)}a.submit($.proxy(function(){var d={name:this._getFilename(),size:""};var f=this._createUploadMatrix(d);var e=this;this._iframe.data("loading",true).off("load").load(function(){e._evaluateResponse(f)});this._overlay.wcfDialog("close")},this))}this._overlay.wcfDialog({title:WCF.Language.get("wcf.global.button.upload")})},_evaluateResponse:function(b){var a=$.parseJSON(this._iframe.contents().find("pre").html());this._success(b,a)}});WCF.Sortable={};WCF.Sortable.List=Class.extend({_additionalParameters:{},_className:"",_containerID:"",_container:null,_notification:null,_offset:0,_options:{},_proxy:null,_structure:{},init:function(a,f,g,d,e,c){this._additionalParameters=c||{};this._containerID=$.wcfEscapeID(a);this._container=$("#"+this._containerID);this._className=f;this._offset=(g)?g:0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._structure={};this._options=$.extend(true,{axis:"y",connectWith:"#"+this._containerID+" .sortableList",disableNesting:"sortableNoNesting",doNotClear:true,errorClass:"sortableInvalidTarget",forcePlaceholderSize:true,helper:"clone",items:"li:not(.sortableNoSorting)",opacity:0.6,placeholder:"sortablePlaceholder",tolerance:"pointer",toleranceElement:"> span"},d||{});if(e){$("#"+this._containerID+" .sortableList").sortable(this._options)}else{$("#"+this._containerID+" > .sortableList").nestedSortable(this._options)}if(this._className){var b=this._container.find(".formSubmit");if(!b.length){b=this._container.next(".formSubmit");if(!b.length){console.debug("[WCF.Sortable.Simple] Unable to find form submit for saving, aborting.");return}}b.children('button[data-type="submit"]').click($.proxy(this._submit,this))}},_submit:function(){this._structure={};this._container.find(".sortableList").each($.proxy(function(c,e){var b=$(e);var d=b.data("objectID");if(d!==undefined){b.children(this._options.items).each($.proxy(function(f,h){var g=$(h).data("objectID");if(!this._structure[d]){this._structure[d]=[]}this._structure[d].push(g)},this))}},this));var a=$.extend(true,{data:{offset:this._offset,structure:this._structure}},this._additionalParameters);this._proxy.setOption("data",{actionName:"updatePosition",className:this._className,interfaceName:"wcf\\data\\ISortableAction",parameters:a});this._proxy.sendRequest()},_success:function(b,c,a){if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))}this._notification.show()}});WCF.Popover=Class.extend({_activeElementID:"",_cancelPopover:false,_data:{},_defaultDimensions:{height:150,width:450},_defaultOrientation:{x:"right",y:"top"},_delay:{show:800,hide:500},_hoverElement:false,_hoverElementID:"",_hoverPopover:false,_margin:20,_peOut:null,_peOverElement:null,_popover:null,_popoverContent:null,_popoverOffset:10,_selector:"",init:function(a){if($.browser.mobile){return}this._activeElementID="";this._cancelPopover=false;this._data={};this._defaultDimensions={height:150,width:450};this._defaultOrientation={x:(WCF.Language.get("wcf.global.pageDirection")==="rtl"?"left":"right"),y:"top"};this._delay={show:800,hide:500};this._hoverElement=false;this._hoverElementID="";this._hoverPopover=false;this._margin=20;this._peOut=null;this._peOverElement=null;this._popoverOffset=10;this._selector=a;this._popover=$('<div class="popover"><span class="icon icon48 icon-spinner"></span><div class="popoverContent"></div></div>').hide().appendTo(document.body);this._popoverContent=this._popover.children(".popoverContent:eq(0)");this._popover.hover($.proxy(this._overPopover,this),$.proxy(this._out,this));this._initContainers();WCF.DOMNodeInsertedHandler.addCallback("WCF.Popover."+a,$.proxy(this._initContainers,this));$(window).on("beforeunload",(function(){this._cancelPopover=true;this._hide(true)}).bind(this))},_initContainers:function(){if($.browser.mobile){return}var a=$(this._selector);if(!a.length){return}a.each($.proxy(function(c,d){var b=$(d);var e=b.wcfIdentify();if(!this._data[e]){this._data[e]={content:null,isLoading:false};b.hover($.proxy(this._overElement,this),$.proxy(this._out,this));if(b.is("a")&&b.attr("href")){b.click((function(){this._hide(true)}).bind(this))}}},this))},_overElement:function(a){if(this._cancelPopover){return}if(this._peOverElement!==null){this._peOverElement.stop()}var b=$(a.currentTarget).wcfIdentify();this._hoverElementID=b;this._peOverElement=new WCF.PeriodicalExecuter($.proxy(function(c){c.stop();if(this._hoverElementID===b){this._activeElementID=b;this._prepare()}},this),this._delay.show);this._hoverElement=true;this._hoverPopover=false},_prepare:function(){if(this._cancelPopover){return}if(this._peOut!==null){this._peOut.stop()}if(this._popover.is(":visible")){this._hide(true)}if(!this._data[this._activeElementID].loading&&this._data[this._activeElementID].content){this._popoverContent.html(this._data[this._activeElementID].content);WCF.DOMNodeInsertedHandler.execute()}else{this._data[this._activeElementID].loading=true}var a=this._popover.show().getDimensions();if(this._data[this._activeElementID].loading){a={height:Math.max(a.height,this._defaultDimensions.height),width:Math.max(a.width,this._defaultDimensions.width)}}else{a=this._fixElementDimensions(this._popover,a)}this._popover.hide();var b=this._getOrientation(a.height,a.width);this._popover.css(this._getCSS(b.x,b.y));this._popover.removeClass("bottom left right top").addClass(b.x).addClass(b.y);this._show()},_show:function(){if(this._cancelPopover){return}this._popover.stop().show().css({opacity:1}).wcfFadeIn();if(this._data[this._activeElementID].loading){this._popover.children("span").show();this._loadContent()}else{this._popover.children("span").hide();this._popoverContent.css({opacity:1})}},_loadContent:function(){},_insertContent:function(a,e,c){this._data[a]={content:e,loading:false};if(this._activeElementID===a){if(c){var d=this._popoverContent.getDimensions();this._popoverContent.css({height:"auto",width:"auto"});this._popoverContent.html(this._data[a].content);var f=this._popoverContent.getDimensions();this._popoverContent.html("").css({height:d.height+"px",width:d.width+"px"});var b=this;this._popoverContent.animate({height:f.height+"px",width:f.width+"px"},300,function(){b._popover.children("span").hide();b._popoverContent.html(b._data[a].content).css({opacity:0}).animate({opacity:1},200);WCF.DOMNodeInsertedHandler.execute()})}else{this._popover.children("span").hide();this._popoverContent.html(this._data[a].content);WCF.DOMNodeInsertedHandler.execute()}}},_hide:function(b){var a=this;this._popoverContent.stop();this._popover.stop();if(b){a._popover.css({opacity:0}).hide();a._popoverContent.empty().css({height:"auto",opacity:0,width:"auto"})}else{this._popover.wcfFadeOut(function(){a._popoverContent.empty().css({height:"auto",opacity:0,width:"auto"});a._popover.hide()})}},_overPopover:function(){if(this._peOut!==null){this._peOut.stop()}this._hoverElement=false;this._hoverPopover=true},_out:function(a){if(this._cancelPopover){return}this._hoverElementID="";this._hoverElement=false;this._hoverPopover=false;this._peOut=new WCF.PeriodicalExecuter($.proxy(function(b){b.stop();if(!this._hoverElement&&!this._hoverPopover){this._hide(false)}},this),this._delay.hide)},_getOrientation:function(i,a){var h=$("#"+this._activeElementID);var g=h.getOffsets("offset");var f=h.getDimensions();var b=$(document).getDimensions();var e=(this._defaultOrientation.x==="left")?"left":"right";var d=(this._defaultOrientation.y==="bottom")?"bottom":"top";var c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="left")?"right":"left";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="right")?"left":"right";d=(d==="bottom")?"top":"bottom";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(e==="left")?"right":"left";c=this._evaluateOrientation(e,d,g,f,b,i,a);if(c.flawed){e=(this._defaultOrientationX==="left")?"left":"right";d=(this._defaultOrientationY==="bottom")?"bottom":"top"}}}}return{x:e,y:d}},_evaluateOrientation:function(g,f,b,h,j,i,a){var d=0,e=0;switch(g){case"left":e=b.left-a;break;case"right":e=j.width-(b.left+a);break}switch(f){case"bottom":d=j.height-(b.top+h.height+this._popoverOffset+i);break;case"top":d=b.top-(i-this._popoverOffset);break}var c=false;if(d<this._margin||e<this._margin){c=true}return{flawed:c,x:e,y:d}},_getCSS:function(d,c){var g={bottom:"auto",left:"auto",right:"auto",top:"auto"};var b=$("#"+this._activeElementID);var e=b.getOffsets("offset");var f=this._fixElementDimensions(b,b.getDimensions());var a=$(window).getDimensions();switch(d){case"left":g.right=a.width-(e.left+f.width);break;case"right":g.left=e.left;break}switch(c){case"bottom":g.top=e.top+(f.height+this._popoverOffset);break;case"top":g.bottom=a.height-(e.top-this._popoverOffset);break}return g},_fixElementDimensions:function(a,b){var c=a.parent().getDimensions();if(c.height<b.height){b.height=c.height}if(c.width<b.width){b.width=c.width}return b}});WCF.EditableItemList=Class.extend({_allowCustomInput:false,_className:"",_data:{},_form:null,_itemList:null,_objectID:0,_objectTypeID:0,_search:null,_searchInput:null,init:function(c,a){this._itemList=$(c);this._searchInput=$(a);this._data={};if(!this._itemList.length||!this._searchInput.length){console.debug("[WCF.EditableItemList] Item list and/or search input do not exist, aborting.");return}this._objectID=this._getObjectID();this._objectTypeID=this._getObjectTypeID();this._itemList.find(".jsEditableItem").click($.proxy(this._click,this));if(!this._itemList.children("ul").length){$("<ul />").appendTo(this._itemList)}this._itemList=this._itemList.children("ul");this._form=this._itemList.parents("form").submit($.proxy(this._submit,this));if(this._allowCustomInput){var b=this;this._searchInput.keydown($.proxy(this._keyDown,this)).keypress($.proxy(this._keyPress,this)).on("paste",function(){setTimeout(function(){b._onPaste()},100)})}this._searchInput.parents(".dropdown").data("preventSubmit",true)},_keyDown:function(a){if(a===null){return this._keyPress(null)}return true},_keyPress:function(b){if(b===null||b.charCode===44||b.charCode===$.ui.keyCode.ENTER||($.browser.mozilla&&b.keyCode===$.ui.keyCode.ENTER)){if(b!==null&&b.charCode===$.ui.keyCode.ENTER&&this._search){if(this._search._itemIndex!==-1){return false}}var a=$.trim(this._searchInput.val());if(b&&b.charCode===44){a=a.substring(0,this._searchInput.getCaret())}if(a===""){return true}this.addItem({objectID:0,label:a});if(b&&b.charCode===44){this._searchInput.val($.trim(this._searchInput.val().substr(this._searchInput.getCaret())))}else{this._searchInput.val("")}if(b!==null){b.stopPropagation()}return false}return true},_onPaste:function(){var b=$.trim(this._searchInput.val());b=b.split(",");for(var d=0,c=b.length;d<c;d++){var a=$.trim(b[d]);if(a===""){continue}this.addItem({objectID:0,label:a})}this._searchInput.val("")},load:function(a){},_click:function(d){var b=$(d.currentTarget);var c=b.data("objectID");var a=b.data("label");if(this._search){this._search.removeExcludedSearchValue(a)}this._removeItem(c,a);b.remove();d.stopPropagation();return false},_getObjectID:function(){return 0},_getObjectTypeID:function(){return 0},addItem:function(b){if(this._data[b.objectID]){if(!(b.objectID===0&&this._allowCustomInput)){return true}}var a=$('<li class="badge">'+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},clearList:function(){this._itemList.children("li").each($.proxy(function(b,c){var a=$(c);if(this._search){this._search.removeExcludedSearchValue(a.data("label"))}a.remove();this._removeItem(a.data("objectID"),a.data("label"))},this))},_submit:function(){this._keyDown(null)},_addItem:function(b,a){this._data[b]=a},_removeItem:function(b,a){delete this._data[b]},getSearchInput:function(){return this._searchInput}});WCF.Sitemap=Class.extend({_cache:[],_dialog:null,_didInit:false,_proxy:null,init:function(){$("#sitemap").click($.proxy(this._click,this));this._cache=[];this._dialog=null;this._didInit=false;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_click:function(a){a.preventDefault();if(this._dialog===null){this._dialog=$('<div id="sitemapDialog" />').appendTo(document.body);this._proxy.setOption("data",{actionName:"getSitemap",className:"wcf\\data\\sitemap\\SitemapAction"});this._proxy.sendRequest()}else{this._dialog.wcfDialog("open");$(document).trigger("resize")}},_success:function(b,c,a){if(this._didInit){this._cache.push(b.returnValues.sitemapName);this._dialog.find("#sitemap_"+b.returnValues.sitemapName).html(b.returnValues.template);this._dialog.wcfDialog("render")}else{this._cache.push(b.returnValues.sitemapName);this._dialog.html(b.returnValues.template);this._dialog.find(".sitemapNavigation").click($.proxy(this._navigate,this));this._dialog.find(".tabMenuContainer").wcfTabs("select","sitemap_"+b.returnValues.sitemapName);this._dialog.wcfDialog({title:WCF.Language.get("wcf.page.sitemap")});this._didInit=true}$(document).trigger("resize")},_navigate:function(a){var b=$(a.currentTarget).data("sitemapName");if(WCF.inArray(b,this._cache)){this._dialog.find(".tabMenuContainer").wcfTabs("select","sitemap_"+b);this._dialog.wcfDialog("render")}else{this._proxy.setOption("data",{actionName:"getSitemap",className:"wcf\\data\\sitemap\\SitemapAction",parameters:{sitemapName:b}});this._proxy.sendRequest()}}});WCF.Language.Chooser=Class.extend({_callback:null,_dropdown:null,_input:null,init:function(m,h,g,b,l,f){var n=$("#"+m);if(n.length!=1){console.debug("[WCF.Language.Chooser] Invalid container id '"+m+"' given");return}this._input=$("#"+h);if(!this._input.length){this._input=$('<input type="hidden" name="'+h+'" value="'+g+'" />').appendTo(n)}if(l!==undefined){if(!$.isFunction(l)){console.debug("[WCF.Language.Chooser] Given callback is invalid");return}this._callback=l}this._dropdown=$('<div class="dropdown" id="'+m+'-languageChooser" />').appendTo(n);$('<div class="dropdownToggle boxFlag box24" data-toggle="'+m+'-languageChooser"></div>').appendTo(this._dropdown);var c=$('<ul class="dropdownMenu" />').appendTo(this._dropdown);for(var a in b){var j=b[a];var i=$('<li class="boxFlag"><a class="box24"><div class="framed"><img src="'+j.iconPath+'" alt="" class="iconFlag" /></div> <div><h3>'+j.languageName+"</h3></div></a></li>").appendTo(c);i.data("languageID",a).click($.proxy(this._click,this));if(a==g){var d=$(""+i.html());var k=d.children().detach();this._dropdown.children(".dropdownToggle").empty().append(k)}}if(f){$('<li class="dropdownDivider" />').appendTo(c);var i=$("<li><a>"+WCF.Language.get("wcf.global.language.noSelection")+"</a></li>").data("languageID",0).click($.proxy(this._click,this)).appendTo(c);if(g===0){this._dropdown.children(".dropdownToggle").empty().append(i.html())}}else{if(g===0){var e=$('<div><span class="icon icon24 fa-question" /></div> <div><h3>'+WCF.Language.get("wcf.global.language.noSelection")+"</h3></div>");this._dropdown.children(".dropdownToggle").empty().append(e)}}WCF.Dropdown.destroy(m+"-languageChooser");WCF.Dropdown.init()},_click:function(e){var d=$(e.currentTarget);var c=d.data("languageID");this._input.val(c);var b=$(""+d.html());var a=(c===0)?b:b.children().detach();this._dropdown.children(".dropdownToggle").empty().append(a);if(this._callback!==null){this._callback(d)}}});WCF.Style={};WCF.Style.Chooser=Class.extend({_dialog:null,_proxy:null,init:function(){$('<li class="styleChooser"><a href="#">'+WCF.Language.get("wcf.style.changeStyle")+"</a></li>").appendTo($("#footerNavigation > ul.navigationItems")).click($.proxy(this._showDialog,this));this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_showDialog:function(a){if(a!==null){a.preventDefault()}if(this._dialog===null){this._dialog=$('<div id="styleChooser" />').hide().appendTo(document.body);this._loadDialog()}else{this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.changeStyle")})}},_loadDialog:function(){this._proxy.setOption("data",{actionName:"getStyleChooser",className:"wcf\\data\\style\\StyleAction"});this._proxy.sendRequest()},_success:function(b,c,a){if(b.actionName==="changeStyle"){window.location.reload();return}this._dialog.html(b.returnValues.template);this._dialog.find("li").addClass("pointer").click($.proxy(this._click,this));this._showDialog(null)},_click:function(a){this._proxy.setOption("data",{actionName:"changeStyle",className:"wcf\\data\\style\\StyleAction",objectIDs:[$(a.currentTarget).data("styleID")]});this._proxy.sendRequest()}});WCF.UserPanel=Class.extend({_container:null,_didLoad:false,_link:null,_noItems:"",_revertOnEmpty:true,init:function(a){this._container=$("#"+a);this._didLoad=false;this._revertOnEmpty=true;if(this._container.length!=1){console.debug("[WCF.UserPanel] Unable to find container identfied by '"+a+"', aborting.");return}this._convert()},_convert:function(){this._container.addClass("dropdown");this._link=this._container.children("a").remove();var b=$('<a href="'+this._link.attr("href")+'" class="dropdownToggle">'+this._link.html()+"</a>").appendTo(this._container).click($.proxy(this._click,this));var a=$('<ul class="dropdownMenu" />').appendTo(this._container);$('<li class="jsDropdownPlaceholder"><span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(a);this._addDefaultItems(a);this._container.dblclick($.proxy(function(){window.location=this._link.attr("href");return false},this));WCF.Dropdown.initDropdown(b,false)},_addDefaultItems:function(a){},_addDivider:function(a){$('<li class="dropdownDivider" />').appendTo(a)},_click:function(a){a.preventDefault();if(this._didLoad){return}new WCF.Action.Proxy({autoSend:true,data:this._getParameters(),success:$.proxy(this._success,this)});this._didLoad=true},_getParameters:function(){return{}},_success:function(c,d,b){var a=WCF.Dropdown.getDropdownMenu(this._container.wcfIdentify());a.children(".jsDropdownPlaceholder").remove();if(c.returnValues&&c.returnValues.template){$(""+c.returnValues.template).prependTo(a);this._updateBadge(c.returnValues.totalCount);this._after(a)}else{$("<li><span>"+WCF.Language.get(this._noItems)+"</span></li>").prependTo(a);this._updateBadge(0)}},_updateBadge:function(a){a=parseInt(a)||0;if(a){var b=this._container.find(".badge");if(!b.length){b=$('<span class="badge badgeInverse" />').appendTo(this._container.children(".dropdownToggle"));b.before(" ")}b.html(a)}else{this._container.find(".badge").remove()}},_after:function(a){}});$.widget("ui.wcfDialog",{_closeButton:null,_container:null,_content:null,_overlay:null,_title:null,_titlebar:null,_isOpen:false,options:{autoOpen:true,closable:true,closeButtonLabel:null,closeConfirmMessage:null,closeViaModal:true,hideTitle:false,modal:true,title:"",zIndex:400,onClose:null,onShow:null},_createWidget:function(a,b){if($(b).getTagName()==="script"){console.debug("[ui.wcfDialog] Ignored script tag");this.element=false;return null}$.Widget.prototype._createWidget.apply(this,arguments)},_init:function(){if(this.options.autoOpen){this.open()}$(window).resize($.proxy(this._resize,this))},_create:function(){if(this.options.closeButtonLabel===null){this.options.closeButtonLabel=WCF.Language.get("wcf.global.button.close")}this._container=$('<div class="dialogContainer" />').hide().css({zIndex:this.options.zIndex}).appendTo(document.body);this._titlebar=$('<header class="dialogTitlebar" />').hide().appendTo(this._container);this._title=$('<span class="dialogTitle" />').hide().appendTo(this._titlebar);this._closeButton=$('<a class="dialogCloseButton jsTooltip" title="'+this.options.closeButtonLabel+'"><span /></a>').click($.proxy(this.close,this)).hide().appendTo(this._titlebar);this._content=$('<div class="dialogContent" />').appendTo(this._container);this._setOption("title",this.options.title);this._setOption("closable",this.options.closable);var a=this.element.detach();this._content.html(a);if(this.options.modal){this._overlay=$("#jsWcfDialogOverlay");if(!this._overlay.length){this._overlay=$('<div id="jsWcfDialogOverlay" class="dialogOverlay" />').css({height:"100%",zIndex:399}).hide().appendTo(document.body)}if(this.options.closable&&this.options.closeViaModal){this._overlay.click($.proxy(this.close,this));$(document).keyup($.proxy(function(b){if(b.keyCode&&b.keyCode===$.ui.keyCode.ESCAPE){this.close();b.preventDefault()}},this))}}WCF.DOMNodeInsertedHandler.execute()},_setOption:function(a,b){this.options[a]=b;if(a=="hideTitle"||a=="title"){if(!this.options.hideTitle&&this.options.title!=""){this._title.html(this.options.title).show()}else{this._title.html("")}}else{if(a=="closable"||a=="closeButtonLabel"){if(this.options.closable){this._closeButton.attr("title",this.options.closeButtonLabel).show().find("span").html(this.options.closeButtonLabel);WCF.DOMNodeInsertedHandler.execute()}else{this._closeButton.hide()}}}if((!this.options.hideTitle&&this.options.title!="")||this.options.closable){this._titlebar.show()}else{this._titlebar.hide()}return this},open:function(){if(this.element===false){return}if(this.isOpen()){return}if(this._overlay!==null){WCF.activeDialogs++;if(WCF.activeDialogs===1){this._overlay.show()}}this.render();this._isOpen=true;this._content.find(".jsDialogAutoFocus:visible:first").focus()},isOpen:function(){return this._isOpen},close:function(a){if(!this.isOpen()){return}if(this.options.closeConfirmMessage){WCF.System.Confirmation.show(this.options.closeConfirmMessage,$.proxy(function(b){if(b==="confirm"){this._close()}},this))}else{this._close()}if(a!==undefined){a.preventDefault()}},_close:function(){this._isOpen=false;this._container.wcfFadeOut();if(this._container.data("wcfDialogScrollOffset")){window.scrollTo(0,this._container.data("wcfDialogScrollOffset"))}if(this._overlay!==null){WCF.activeDialogs--;if(WCF.activeDialogs===0){this._overlay.hide()}}if(this.options.onClose!==null){this.options.onClose()}},_resize:function(){if(this.isOpen()){this.render()}},render:function(){if(!this._container.is(":visible")&&this._container.css("top")==="0px"){this._container.data("wcfDialogScrollOffset",$(window).scrollTop());window.scrollTo(0,0)}this._container.show();this._content.children().show();this._content.css({height:"auto",width:"auto"});this._container.stop();this._content.stop();this._container.show().css("opacity",1);var e=0;if(this._content.find(".formSubmit:visible").length){e=this._content.find(".formSubmit").outerHeight();this._content.addClass("dialogForm").css({marginBottom:e+"px"})}else{this._content.removeClass("dialogForm").css({marginBottom:"0px"})}var b=$(window).getDimensions();if(b.width*0.9>800){this._container.css("maxWidth","800px")}var h=this._container.getDimensions("outer");var d=this._content.getDimensions();var e=h.height-d.height;var g=b.height-e-120;this._content.css({maxHeight:g+"px"});this._determineOverflow();h=this._container.getDimensions("outer");var f=Math.round((b.width-h.width)/2);var a=Math.round((b.height-h.height)/2);var c=Math.round((b.height/100)*20);if(c<a){a=c}this._container.css({left:f+"px",top:a+"px"});this._content.css({height:"auto",width:"auto"});if(!this.isOpen()){this._container.hide();this._container.wcfFadeIn($.proxy(function(){if(this.options.onShow!==null){this.options.onShow()}},this))}},_determineOverflow:function(){var b=$(window).getDimensions();var c=this._content.css("maxHeight");this._content.css("maxHeight","none");var e=this._container.getDimensions("outer");var d="visible";if((b.height*0.8<e.height)||(b.width*0.8<e.width)){d="auto"}this._content.css("overflow",d);this._content.css("maxHeight",c);if(d==="visible"){var a=0;this._content.children().each(function(f,g){a+=$(g).outerHeight()});if(this._content.height()<a){d="auto";this._content.css("overflow","auto")}}if($.browser.mozilla&&!$.browser.mobile){if(d==="auto"){this._content.children("div").css("margin-bottom",this._content.css("padding-bottom"))}else{this._content.children("div").css("margin-bottom",false)}}},_getContentDimensions:function(a){var b=this._content.getDimensions();if(a&&b.height>a){b.height=a}return b}});$.widget("ui.wcfSlideshow",{_buttonList:null,_count:0,_index:0,_itemList:null,_items:null,_timer:null,_width:0,options:{cycle:true,cycleInterval:5,itemGap:50,},_create:function(){this._itemList=this.element.children("ul");this._items=this._itemList.children("li");this._count=this._items.length;this._index=0;if(this._count>1){this._initSlideshow()}},_initSlideshow:function(){var b=$(this._items.get(0)).outerHeight();this._items.addClass("slideshowItem");this._width=this.element.css("height",b).innerWidth();this._itemList.addClass("slideshowItemList").css("left",0);this._items.each($.proxy(function(d,e){$(e).show().css({height:b,left:((this._width+this.options.itemGap)*d),width:this._width})},this));this.element.css({height:b,width:this._width}).hover($.proxy(this._hoverIn,this),$.proxy(this._hoverOut,this));this._buttonList=$('<ul class="slideshowButtonList" />').appendTo(this.element);for(var c=0;c<this._count;c++){var a=$('<li><a><span class="icon icon16 icon-circle" /></a></li>').data("index",c).click($.proxy(this._click,this)).appendTo(this._buttonList);if(c==0){a.find(".icon").addClass("active")}}this._resetTimer();$(window).resize($.proxy(this._resize,this))},rebuildHeight:function(){var a=$(this._items.get(0)).css("height","auto");var b=a.outerHeight();this._items.css("height",b+"px");this.element.css("height",b+"px")},_resize:function(){this._width=this.element.css("width","auto").innerWidth();this._items.each($.proxy(function(a,b){$(b).css({left:((this._width+this.options.itemGap)*a),width:this._width})},this));this._index--;this.moveTo(null)},_hoverIn:function(){if(this._timer!==null){this._timer.stop()}},_hoverOut:function(){this._resetTimer()},_resetTimer:function(){if(!this.options.cycle){return}if(this._timer!==null){this._timer.stop()}var a=this;this._timer=new WCF.PeriodicalExecuter(function(){a.moveTo(null)},this.options.cycleInterval*1000)},_click:function(a){this.moveTo($(a.currentTarget).data("index"));this._resetTimer()},moveTo:function(a){this._index=(a===null)?this._index+1:a;if(this._index==this._count){this._index=0}$(this._buttonList.find(".icon").removeClass("active").get(this._index)).addClass("active");this._itemList.css("left",this._index*(this._width+this.options.itemGap)*-1);this._trigger("moveTo",null,{index:this._index})},getItem:function(a){if(this._items[a]){return this._items[a]}return null}});$.widget("ui.wcfTabs",$.ui.tabs,{_sanitizeSelector:function(a){return a.replace(/([:\.])/g,"\\$1")},select:function(a){if(!$.isNumeric(a)){this.panels.each(function(c,b){if($(b).wcfIdentify()===a){a=c;return false}});if(!$.isNumeric(a)){console.debug("[ui.wcfTabs] Unable to find panel identified by '"+a+"', aborting.");return}}this._setOption("active",a)},selectTab:function(a){a="#"+a;this.anchors.each(function(c,b){var d=$(b);if(d.prop("hash")===a){d.trigger("click");return false}})},getCurrentIndex:function(){return this.lis.index(this.lis.filter(".ui-tabs-selected"))},hasAnchor:function(b,a){var c=false;this.anchors.each(function(e,d){var g=$(d).attr("href");if(/#.+/.test(g)){var f=g.split("#",2);if(a){f=f[1].split("-",2)}if(f[1]===b){c=true;return false}}});return c},revertToDefault:function(){var a=this.element.data("active");if(!a||a===""){a=0}this.select(a)},_processTabs:function(){var a=this;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist");this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",tabIndex:-1});this.anchors=this.tabs.map(function(){return $("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1});this.panels=$();this.anchors.each(function(f,e){var b,c,d=$(e).uniqueId().attr("id"),g=$(e).closest("li"),h=g.attr("aria-controls");b=e.hash;c=a.element.find(a._sanitizeSelector(b));if(c.length){a.panels=a.panels.add(c)}if(h){g.data("ui-tabs-aria-controls",h)}g.attr({"aria-controls":b.substring(1),"aria-labelledby":d});c.attr("aria-labelledby",d)});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel")},load:function(a,b){return}});$.widget("ui.wcfPages",{SHOW_LINKS:11,SHOW_SUB_LINKS:20,options:{activePage:1,maxPage:1,nextPage:null,previousPage:null},_create:function(){if(this.options.nextPage===null){this.options.nextPage=WCF.Language.get("wcf.global.page.next")}if(this.options.previousPage===null){this.options.previousPage=WCF.Language.get("wcf.global.page.previous")}this.element.addClass("pageNavigation");this._render()},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);this.element.children().remove()},_render:function(){if(!this.options.disabled&&this.options.maxPage>1){var g=false;if(this.element.hasClass("hidden")){this.element.removeClass("hidden")}this.element.show();this.element.children().remove();var o=$("<ul />");this.element.append(o);var n=$('<li class="button skip" />');o.append(n);if(this.options.activePage>1){var d=$("<a"+((this.options.previousPage!=null)?(' title="'+this.options.previousPage+'"'):(""))+"></a>");n.append(d);this._bindSwitchPage(d,this.options.activePage-1);var l=$('<span class="icon icon16 icon-double-angle-left" />');d.append(l)}else{var l=$('<span class="icon icon16 icon-double-angle-left" />');n.append(l);n.addClass("disabled").removeClass("button");l.addClass("disabled")}o.append(this._renderLink(1));var a=this.SHOW_LINKS-4;var e=this.options.activePage-2;if(e<0){e=0}var i=this.options.maxPage-(this.options.activePage+1);if(i<0){i=0}if(this.options.activePage>1&&this.options.activePage<this.options.maxPage){a--}var k=a/2;var c=this.options.activePage;var j=this.options.activePage;if(c<1){c=1}if(j<1){j=1}if(j>this.options.maxPage-1){j=this.options.maxPage-1}if(e>=k){c-=k}else{c-=e;j+=k-e}if(i>=k){j+=k}else{j+=i;c-=k-i}j=Math.ceil(j);c=Math.ceil(c);if(c<1){c=1}if(j>this.options.maxPage){j=this.options.maxPage}if(c>1){if(c-1<2){o.append(this._renderLink(2))}else{$('<li class="button jumpTo"><a title="'+WCF.Language.get("wcf.global.page.jumpTo")+'" class="jsTooltip">...</a></li>').appendTo(o);g=true}}for(var m=c+1;m<j;m++){o.append(this._renderLink(m))}if(j<this.options.maxPage){if(this.options.maxPage-j<2){o.append(this._renderLink(this.options.maxPage-1))}else{$('<li class="button jumpTo"><a title="'+WCF.Language.get("wcf.global.page.jumpTo")+'" class="jsTooltip">...</a></li>').appendTo(o);g=true}}o.append(this._renderLink(this.options.maxPage));var h=$('<li class="button skip" />');o.append(h);if(this.options.activePage<this.options.maxPage){var f=$("<a"+((this.options.nextPage!=null)?(' title="'+this.options.nextPage+'"'):(""))+"></a>");h.append(f);this._bindSwitchPage(f,this.options.activePage+1);var b=$('<span class="icon icon16 icon-double-angle-right" />');f.append(b)}else{var b=$('<span class="icon icon16 icon-double-angle-right" />');h.append(b);h.addClass("disabled").removeClass("button");b.addClass("disabled")}if(g){o.data("pages",this.options.maxPage);WCF.System.PageNavigation.init("#"+o.wcfIdentify(),$.proxy(function(p){this.switchPage(p)},this))}}else{this.element.hide()}},_renderLink:function(d,a){var e=$('<li class="button"></li>');if(a!=undefined&&a){e.addClass("break")}if(d!=this.options.activePage){var b=$("<a>"+WCF.String.addThousandsSeparator(d)+"</a>");e.append(b);this._bindSwitchPage(b,d)}else{e.addClass("active");var c=$("<span>"+WCF.String.addThousandsSeparator(d)+'</span><span class="invisible">'+WCF.Language.get("wcf.page.pagePosition",{pageNo:d,pages:this.options.maxPage})+"</span>");e.append(c)}return e},_bindSwitchPage:function(a,b){var c=this;a.click(function(){c.switchPage(b)})},switchPage:function(a){this._setOption("activePage",a)},_setOption:function(b,c){if(b=="activePage"){if(c!=this.options[b]&&c>0&&c<=this.options.maxPage){var a=this._trigger("shouldSwitch",undefined,{nextPage:c});if(a||a!==undefined){this.options[b]=c;this._render();this._trigger("switched",undefined,{activePage:c})}else{this._trigger("notSwitched",undefined,{activePage:c})}}}else{this.options[b]=c;if(b=="disabled"){if(c){this.element.children().remove()}else{this._render()}}else{if(b=="maxPage"){this._render()}}}return this},_startInput:function(b){var a=$(b.currentTarget);if(!a.is("a")){a=a.parent("a")}a.hide();var c=a.parent("li").children("input").css("display","block").val("");c.focus()},_stopInput:function(b){var c=$(b.currentTarget);c.css("display","none");var a=c.parent("li");if(a!=undefined&&a!=null){a.children("a").show()}},_handleInput:function(b){var a=($.browser.msie&&$.browser.version=="7.0");if(b.type!="keyup"||a){if(!a||((b.which==13||b.which==27)&&b.type=="keyup")){if(b.which==13){this.switchPage(parseInt($(b.currentTarget).val()))}if(b.which==13||b.which==27){this._stopInput(b);b.stopPropagation()}}}}});WCF.Category={};WCF.Category.NestedList=Class.extend({_categories:{},init:function(){var a=this;$(".jsCategory").each(function(c,d){var b=$(d).data("parentCategoryID",null).change($.proxy(a._updateSelection,a));a._categories[b.val()]=b;var e=[];b.parents("li").find(".jsChildCategory").each(function(h,g){var f=$(g).data("parentCategoryID",b.val()).change($.proxy(a._updateSelection,a));a._categories[f.val()]=f;e.push(f.val());if(f.is(":checked")){b.prop("checked","checked")}});b.data("childCategoryIDs",e)})},_updateSelection:function(b){var a=$(b.currentTarget);var f=a.data("parentCategoryID");if(a.is(":checked")){if(f!==null){this._categories[f].prop("checked","checked")}}else{if(f===null){var e=a.data("childCategoryIDs");for(var d=0,c=e.length;d<c;d++){this._categories[e[d]].prop("checked",false)}}}}});WCF.Category.FlexibleCategoryList=Class.extend({_list:null,_categories:{},init:function(a){this._list=$("#"+a);this._buildStructure();this._list.find("input:checked").each(function(){$(this).trigger("change")});if(this._list.children("li").length<2){this._list.addClass("flexibleCategoryListDisabled");return}if($.browser.chrome){this._resize();$(window).resize(this._resize.bind(this))}},_buildStructure:function(){var a=this;this._list.find(".jsCategory").each(function(d,f){var c=$(f).change(a._updateSelection.bind(a));var e=parseInt(c.val());var b=[];c.parents("li:eq(0)").find(".jsChildCategory").each(function(h,k){var g=$(k);g.data("parentCategory",c).change(a._updateSelection.bind(a));var i=parseInt(g.val());b.push(g);var l=[];g.parents("li:eq(0)").find(".jsSubChildCategory").each(function(m,j){var n=$(j);n.data("parentCategory",g).change(a._updateSelection.bind(a));l.push(n)});a._categories[i]=l});a._categories[e]=b})},_resize:function(){var a=-1;var b=0;var c=this._list.children("li");c.each(function(g,h){if(a===-1||g+1===c.length||c[g+1].offsetLeft!=a){var e=$(h);var f=e.outerHeight(true);var d=e.position();b=Math.max(b,d.top+f);a=h.offsetLeft}});this._list.css("max-height",b+"px")},_updateSelection:function(a){var g=$(a.currentTarget);var e=parseInt(g.val());var d=g.data("parentCategory");if(g.is(":checked")){if(d){d.prop("checked","checked");d=d.data("parentCategory");if(d){d.prop("checked","checked")}}}else{if(this._categories[e]){for(var k=0,h=this._categories[e].length;k<h;k++){var i=this._categories[e][k];i.prop("checked",false);var f=parseInt(i.val());if(this._categories[f]){for(var j=0,b=this._categories[f].length;j<b;j++){this._categories[f][j].prop("checked",false)}}}}if(d){var c=parseInt(d.val());for(var k=0,h=this._categories[c].length;k<h;k++){if(this._categories[c][k].prop("checked")){return}}d=d.data("parentCategory");if(d){c=parseInt(d.val());for(var k=0,h=this._categories[c].length;k<h;k++){if(this._categories[c][k].prop("checked")){return}}}}}}});WCF.Condition={};WCF.Condition.PageControllerDependence=Class.extend({_pageControllerSelection:null,_supportedPageObjectTypeIDs:[],init:function(a,b){this._supportedPageObjectTypeIDs=b;this._pageControllerSelection=$("#pageControllers").change($.proxy(this._checkVisibility,this));this._pageControllerContainer=this._pageControllerSelection.parents("dl:eq(0)");this._fieldset=this._pageControllerContainer.parent("fieldset");this._nextFieldset=this._fieldset.next("fieldset");if(this._nextFieldset){this._nextFieldset.data("margin-top",this._nextFieldset.css("margin-top"))}this._input=$("#"+a);this._inputContainer=this._input.parents("dl:eq(0)");this._checkVisibility()},_checkVisibility:function(){var b=this._pageControllerSelection.val()||[];var a=true;if(b.length){for(var d=0,c=b.length;d<c;d++){if(this._supportedPageObjectTypeIDs.indexOf(parseInt(b[d]))==-1){a=false;break}}}else{a=false}if(a){this._inputContainer.show();this._input.enable();this._fieldset.show();if(this._nextFieldset){this._nextFieldset.css("margin-top",this._nextFieldset.data("margin-top"))}}else{this._inputContainer.hide();this._input.disable();if(!this._fieldset.children("dl:visible").length){this._fieldset.hide();if(this._nextFieldset){this._nextFieldset.css("margin-top",0)}}}}});WCF.Notice={};WCF.Notice.Dismiss=Class.extend({_notices:{},_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var a=$(".jsDismissNoticeButton").click($.proxy(this._click,this));a.each($.proxy(function(b,c){this._notices[$(c).data("objectID")]=$(c).parent()},this))},_click:function(a){this._proxy.setOption("data",{actionName:"dismiss",className:"wcf\\data\\notice\\NoticeAction",objectIDs:[$(a.currentTarget).data("objectID")]});this._proxy.sendRequest()},_success:function(b,c,a){this._notices[b.returnValues.noticeID].wcfFadeOut()}});function wcfEval(expression){return eval(expression)}; })(this);
// WCF.Like.js
(function (window, undefined) {"use strict";WCF.Like=Class.extend({_allowForOwnContent:false,_canLike:false,_containers:{},_containerData:{},_enableDislikes:true,_isBusy:false,_likeDetails:{},_proxy:null,_showSummary:true,init:function(a,c,f,e){this._canLike=a;this._enableDislikes=c;this._isBusy=false;this._likeDetails={};this._showSummary=f;this._allowForOwnContent=e;var d=this._getContainers();this._initContainers(d);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});var g=new Date();var b=g.toString().hashCode+g.getUTCMilliseconds();WCF.DOMNodeInsertedHandler.addCallback("WCF.Like"+b,$.proxy(this._domNodeInserted,this))},_domNodeInserted:function(){var a=this._getContainers();this._initContainers(a)},_initContainers:function(containers){var $createdWidgets=false;containers.each($.proxy(function(index,container){var $container=$(container);var $containerID=$container.wcfIdentify();if(!this._containers[$containerID]){this._containers[$containerID]=$container;this._containerData[$containerID]={likeButton:null,badge:null,dislikeButton:null,likes:$container.data("like-likes"),dislikes:$container.data("like-dislikes"),objectType:$container.data("objectType"),objectID:this._getObjectID($containerID),users:eval($container.data("like-users")),liked:$container.data("like-liked")};this._createWidget($containerID);$createdWidgets=true}},this));if($createdWidgets){new WCF.PeriodicalExecuter(function(pe){pe.stop();WCF.DOMNodeInsertedHandler.execute()},250)}},_getContainers:function(){},_getWidgetContainer:function(a){},_getObjectID:function(a){},_addWidget:function(a,b){var c=this._getWidgetContainer(a);b.appendTo(c)},_buildWidget:function(b,a,d,c,e){var f=$('<aside class="likesWidget"><ul></ul></aside>');if(this._canLike){a.appendTo(f.find("ul"));d.appendTo(f.find("ul"))}c.appendTo(f);this._addWidget(b,f)},_createWidget:function(b){var e=$('<li class="wcfLikeButton"><a href="#" title="'+WCF.Language.get("wcf.like.button.like")+'" class="jsTooltip"><span class="icon icon16 icon-thumbs-up-alt" /> <span class="invisible">'+WCF.Language.get("wcf.like.button.like")+"</span></a></li>");var c=$('<li class="wcfDislikeButton"><a href="#" title="'+WCF.Language.get("wcf.like.button.dislike")+'" class="jsTooltip"><span class="icon icon16 icon-thumbs-down-alt" /> <span class="invisible">'+WCF.Language.get("wcf.like.button.dislike")+"</span></a></li>");if(!this._enableDislikes){c.hide()}if(!this._allowForOwnContent&&(WCF.User.userID==this._containers[b].data("userID"))){e=$("");c=$("")}var d=$('<a class="badge jsTooltip likesBadge" />').data("containerID",b).click($.proxy(this._showLikeDetails,this));var a=null;if(this._showSummary){a=$('<p class="likesSummary"><span class="pointer" /></p>');a.children("span").data("containerID",b).click($.proxy(this._showLikeDetails,this))}this._buildWidget(b,e,c,d,a);this._containerData[b].likeButton=e;this._containerData[b].dislikeButton=c;this._containerData[b].badge=d;this._containerData[b].summary=a;e.data("containerID",b).data("type","like").click($.proxy(this._click,this));c.data("containerID",b).data("type","dislike").click($.proxy(this._click,this));this._setActiveState(e,c,this._containerData[b].liked);this._updateBadge(b);if(this._showSummary){this._updateSummary(b)}},_showLikeDetails:function(c,a){var b=(c===null)?a:$(c.currentTarget).data("containerID");if(this._likeDetails[b]===undefined){this._likeDetails[b]=new WCF.User.List("wcf\\data\\like\\LikeAction",WCF.Language.get("wcf.like.details"),{data:{containerID:b,objectID:this._containerData[b].objectID,objectType:this._containerData[b].objectType}})}this._likeDetails[b].open()},_click:function(a){a.preventDefault();var b=$(a.currentTarget);if(b===null){console.debug("[WCF.Like] Unable to find target button, aborting.");return}this._sendRequest(b.data("containerID"),b.data("type"))},_sendRequest:function(a,b){if(this._isBusy){return}this._isBusy=true;this._proxy.setOption("data",{actionName:b,className:"wcf\\data\\like\\LikeAction",parameters:{data:{containerID:a,objectID:this._containerData[a].objectID,objectType:this._containerData[a].objectType}}});this._proxy.sendRequest()},_success:function(d,g,b){var a=d.returnValues.containerID;if(!this._containers[a]){return}switch(d.actionName){case"dislike":case"like":this._containerData[a].likes=parseInt(d.returnValues.likes);this._containerData[a].dislikes=parseInt(d.returnValues.dislikes);this._containerData[a].users=d.returnValues.users;$.each(this._containerData[a].users,function(i,h){h.username=WCF.String.escapeHTML(h.username)});this._updateBadge(a);if(this._showSummary){this._updateSummary(a)}var f=this._containerData[a].likeButton;var e=this._containerData[a].dislikeButton;var c=0;if(d.returnValues.isLiked){c=1}else{if(d.returnValues.isDisliked){c=-1}}this._setActiveState(f,e,c);if(this._likeDetails[a]!==undefined){delete this._likeDetails[a]}this._isBusy=false;break}},_updateBadge:function(a){if(!this._containerData[a].likes&&!this._containerData[a].dislikes){this._containerData[a].badge.hide()}else{this._containerData[a].badge.show();var c=this._containerData[a].likes-this._containerData[a].dislikes;var d=this._containerData[a].badge;d.removeClass("green red");if(c>0){d.text("+"+WCF.String.formatNumeric(c));d.addClass("green")}else{if(c<0){d.text(WCF.String.formatNumeric(c));d.addClass("red")}else{d.text("\u00B10")}}var e=this._containerData[a].likes;var b=this._containerData[a].dislikes;d.data("tooltip",WCF.Language.get("wcf.like.tooltip",{likes:e,dislikes:b}))}},_updateSummary:function(a){if(!this._containerData[a].likes){this._containerData[a].summary.hide()}else{this._containerData[a].summary.show();var d=this._containerData[a].users;var c=[];for(var b in d){c.push(d[b].username)}var e=this._containerData[a].likes-c.length;this._containerData[a].summary.children("span").html(WCF.Language.get("wcf.like.summary",{users:c,others:e}))}},_setActiveState:function(a,b,c){a.removeClass("active");b.removeClass("active");if(c==1){a.addClass("active")}else{if(c==-1){b.addClass("active")}}}}); })(this);