// wbbcode.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode={init:function(){var c=this._createSmileyDropdown();this.buttonReplace("smiley","wsmiley","Smiley",$.proxy(function(h,f,d,g){this.dropdownShow(g,h)},this));this.buttonGet("wsmiley").data("dropdown",c);this.buttonAwesome("wsmiley","fa-smile-o");this.opts.initCallback=$.proxy(function(){if(this.$source.val().length){this.toggle();this.toggle()}},this);this.opts.pasteBeforeCallback=$.proxy(this._wPasteBeforeCallback,this);this.opts.pasteAfterCallback=$.proxy(this._wPasteAfterCallback,this);var b=this.syncClean;var a=this;this.syncClean=function(d){d=d.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return b.call(a,d)};if(this.getOption("wAutosaveOnce")){this._saveTextToStorage();delete this.opts.wAutosaveOnce}},_createSmileyDropdown:function(){var d=$('<div class="redactor_dropdown redactor_dropdown_box_wsmiley" style="display: none; width: 195px;" />');var c=$('<ul class="smileyList" />').appendTo(d);for(var a in __REDACTOR_SMILIES){var b=$('<li><img src="'+__REDACTOR_SMILIES[a]+'" class="smiley" /></li>').data("smileyCode",a);b.appendTo(c).click($.proxy(this._onSmileyPick,this))}$(this.$toolbar).append(d);return d},_onSmileyPick:function(b){var a=$(b.currentTarget).data("smileyCode");this.insertSmiley(a,__REDACTOR_SMILIES[a],false)},insertSmiley:function(a,b,c){if(c){this.registerSmiley(a,b)}if(this.opts.visual){this.bufferSet();this.$editor.focus();this.insertHtml(' <img src="'+b+'" class="smiley" alt="'+a+'" /> ');if(this.opts.air){this.$air.fadeOut(100)}this.sync()}else{this.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},toggle:function(a){if(this.opts.visual){this.toggleCode(a);this._convertFromHtml();this.buttonGet("html").children("i").removeClass("fa-square-o").addClass("fa-square")}else{this._convertToHtml();this.toggleVisual();this.buttonGet("html").children("i").removeClass("fa-square").addClass("fa-square-o")}},_convertFromHtml:function(){var m=this.$source.val();m=m.replace(/\r?\n/g,"");var f=m.split(/(<\/?p>)/);var g="";var x="";for(var a=0;a<f.length;a++){var y=f[a];if(y=="<p>"){continue}else{if(y=="</p>"){x=$.trim(x);if(x!="@@@wcf_empty_line@@@"){x+="\n"}g+=x;x=""}else{if(a==0){g+=y}else{x+=y}}}}m=g;m=m.replace(/@@@wcf_empty_line@@@/g,"\n");m=m.replace(/\n\n$/,"\n");m=m.replace(/<br>$/,"");m=m.replace(/<br>/g,"\n");m=m.replace(/<br>/g,"");m=m.replace(/ /gi," ");m=m.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");m=m.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(B,z,A,C){if(A==C){return"[url]"+A+"[/url]"}return"[url='"+A+"']"+C+"[/url]"});m=m.replace(/<(?:b|strong)>/gi,"[b]");m=m.replace(/<\/(?:b|strong)>/gi,"[/b]");m=m.replace(/<(?:i|em)>/gi,"[i]");m=m.replace(/<\/(?:i|em)>/gi,"[/i]");m=m.replace(/<u>/gi,"[u]");m=m.replace(/<\/u>/gi,"[/u]");m=m.replace(/<(?:s(trike)?|del)>/gi,"[s]");m=m.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");m=m.replace(/<sub>/gi,"[sub]");m=m.replace(/<\/sub>/gi,"[/sub]");m=m.replace(/<sup>/gi,"[sup]");m=m.replace(/<\/sup>/gi,"[/sup]");m=m.replace(/<img [^>]*?alt="([^"]+?)" class="smiley".*?>/gi,"$1");m=m.replace(/<img [^>]*?class="smiley" alt="([^"]+?)".*?>/gi,"$1");m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1 style="float: (left|right)[^"]*".*?>/gi,"[img='$2',$3][/img]");m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");var d=m.split(/(<\/?span[^>]*>)/);var x=[];var p=[];var q="";for(var a=0;a<d.length;a++){var h=d[a];if(h=="</span>"){var c=p.pop();var g=c.start+x.pop()+c.end;if(x.length){x[x.length-1]+=g}else{q+=g}}else{if(h.match(/^<span style="([^"]+)">/)){var k=RegExp.$1;var v;var n;if(k.match(/^color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?$/i)){var u=RegExp.$1;var b=RegExp.$2;var e=RegExp.$3;var s=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16))+""+("0123456789ABCDEF".charAt((e-e%16)/16)+""+"0123456789ABCDEF".charAt(e%16));v="[color=#"+s+"]";n="[/color]"}else{if(k.match(/^color: ?(.*?);?$/i)){v="[color="+RegExp.$1+"]";n="[/color]"}else{if(k.match(/^font-size: ?(\d+)pt;?$/i)){v="[size="+RegExp.$1+"]";n="[/size]"}else{if(k.match(/^font-family: ?(.*?);?$/)){v="[font="+RegExp.$1.replace(/'/g,"")+"]";n="[/font]"}else{v='<span style="'+k+'">';n="</span>"}}}}x[x.length]="";p[x.length]={start:v,end:n}}else{if(x.length){x[x.length-1]+=h}else{q+=h}}}}m=q;m=m.replace(/<div style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/div>/gi,"[align=$1]$2[/align]");m=m.replace(/<li>/gi,"[*]");m=m.replace(/<\/li>/gi,"");m=m.replace(/<ul>/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/<table[^>]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(z,A){return $.trim(A)});m=m.replace(/<tr><\/tr>/gi,"");m=m.replace(/<tr>/gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)*<td>/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var w={};m.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(z){var A=z.hashCode();w[A]=z.replace(/\$/g,"$$$$");return"@@"+A+"@@"});m=m.replace(/<[^>]+>/g,"");if($.getLength(w)){for(var j in w){var t=new RegExp("@@"+j+"@@","g");data=data.replace(t,w[j])}}m=m.replace(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");var r={};for(var a=0,i=__REDACTOR_SOURCE_BBCODES.length;a<i;a++){var o=__REDACTOR_SOURCE_BBCODES[a];var l=new RegExp("\\["+o+"([\\S\\s]+?)\\[\\/"+o+"\\]","gi");m=m.replace(l,function(z){var A=z.hashCode();r[A]=z.replace(/\$/g,"$$$$");return"@@"+A+"@@"})}var g=m.split("\n");for(var a=0,i=g.length;a<i;a++){g[a]=g[a].replace(/^\s*/,"")}m=g.join("\n");if($.getLength(r)){for(var j in r){var t=new RegExp("@@"+j+"@@","g");m=m.replace(t,r[j])}}this.$source.val(m)},_convertToHtml:function(){var e=this.$source.val();e=this.removeZeroWidthSpace(e);e=e.replace(/&/g,"&");e=e.replace(/</g,"<");e=e.replace(/>/g,">");var b={};for(var k=0,i=__REDACTOR_SOURCE_BBCODES.length;k<i;k++){var c=__REDACTOR_SOURCE_BBCODES[k];var d=new RegExp("\\["+c+"([\\S\\s]+?)\\[\\/"+c+"\\]","gi");e=e.replace(d,function(m){var n=m.hashCode();b[n]=m.replace(/\$/g,"$$$$");return"@@"+n+"@@"})}e=e.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>');e=e.replace(/\[url\='([^'"]+)'](.+?)\[\/url]/gi,'<a href="$1">$2</a>');e=e.replace(/\[url\=([^'"\]]+)](.+?)\[\/url]/gi,'<a href="$1">$2</a>');e=e.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>');e=e.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>');e=e.replace(/\[b\](.*?)\[\/b]/gi,"<b>$1</b>");e=e.replace(/\[i\](.*?)\[\/i]/gi,"<i>$1</i>");e=e.replace(/\[u\](.*?)\[\/u]/gi,"<u>$1</u>");e=e.replace(/\[s\](.*?)\[\/s]/gi,"<strike>$1</strike>");e=e.replace(/\[sub\](.*?)\[\/sub]/gi,"<sub>$1</sub>");e=e.replace(/\[sup\](.*?)\[\/sup]/gi,"<sup>$1</sup>");e=e.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');e=e.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2" />');e=e.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');e=e.replace(/\[size=(\d+)\](.*?)\[\/size\]/gi,'<span style="font-size: $1pt">$2</span>');e=e.replace(/\[color=([#a-z0-9]*?)\](.*?)\[\/color\]/gi,'<span style="color: $1">$2</span>');e=e.replace(/\[font='?([a-z,\- ]*?)'?\](.*?)\[\/font\]/gi,'<span style="font-family: $1">$2</span>');e=e.replace(/\[align=(left|right|center|justify)\](.*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');e=e.replace(/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");e=e.replace(/\[list\]/gi,"<ul>");e=e.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');e=e.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');e=e.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');e=e.replace(/\[\/list]/gi,"</ul>");e=e.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(m,n){return"[table]"+$.trim(n)+"[/table]"});e=e.replace(/\[table\]/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');e=e.replace(/\[\/table\]/gi,"</table>");e=e.replace(/\[tr\]/gi,"<tr>");e=e.replace(/\[\/tr\]/gi,"</tr>");e=e.replace(/\[td\]/gi,"<td>");e=e.replace(/\[\/td\]/gi,"</td>");e=e.replace(/<td>([\S\s]*?)<\/td>/gi,function(m,n){return"<td>"+$.trim(n)+"</td>"});for(var l in __REDACTOR_SMILIES){$smileyCode=l.replace(/</g,"<").replace(/>/g,">");var g=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp($smileyCode)+"(?=\\s|<|$)","gi");e=e.replace(g,'$1<img src="'+__REDACTOR_SMILIES[l]+'" class="smiley" alt="'+$smileyCode+'" />')}e=e.replace(/(javascript):/gi,"$1<span></span>:");e=e.replace(/(\r|\r\n)/,"\n");var a=e.split("\n");e="";for(var k=0,i=a.length;k<i;k++){var j=$.trim(a[k]);if(j.indexOf("<")===0){e+=j}else{if(!j){j="<br>"}e+="<p>"+j+"</p>"}}if($.getLength(b)){for(var f in b){var h=new RegExp("@@"+f+"@@","g");e=e.replace(h,b[f])}}e=e.replace(/\[code\][\S\s]*?\[\/code\]/,"<pre>$&</pre>");this.$source.val(e)},_wPasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/<h([1-6])[^>]+>/g,function(c,d){return"[size="+b[d]+"]"});a=a.replace(/<\/h[1-6]>/g,"[/size]");a=a.replace(/<(article|header)[^>]+>/g,"<div>");a=a.replace(/<\/(article|header)>/g,"</div>");a=a.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");a=a.replace(/<\/(div|p)><\/(div|p)>/g,"</p>@@@wcf_break@@@");return a},_wPasteAfterCallback:function(a){a=a.replace(/<p>([\s\S]*?)<\/p>/g,"<p>$1<br></p>");a=a.replace(/<header[^>]*>/g,"");a=a.replace(/<\/header>/g,"");a=a.replace(/<div>.*?<\/div>/g,"<p>$1</p>");a=a.replace(/<\/?div>/g,"");a=a.replace(/@@@wcf_break@@@/g,"<p><br></p>");a=a.replace(/<p><p>/g,"<p>");a=a.replace(/\[size=(\d+)\]/g,'<p><br></p><p><inline style="font-size: $1pt">');a=a.replace(/\[\/size\]/g,"</inline></p><p><br></p>");return a}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbbcode={init:function(){this.opts.initCallback=$.proxy(function(){if(this.$source.val().length){this.toggle();this.toggle()}},this);this.opts.pasteBeforeCallback=$.proxy(this._wPasteBeforeCallback,this);this.opts.pasteAfterCallback=$.proxy(this._wPasteAfterCallback,this);var b=this.syncClean;var a=this;this.syncClean=function(c){c=c.replace(/<p><br([^>]+)?><\/p>/g,"<p>@@@wcf_empty_line@@@</p>");return b.call(a,c)};if(this.getOption("wAutosaveOnce")){this._saveTextToStorage();delete this.opts.wAutosaveOnce}},_createSmileyDropdown:function(){var d=$('<div class="redactor_dropdown redactor_dropdown_box_wsmiley" style="display: none; width: 195px;" />');var c=$('<ul class="smileyList" />').appendTo(d);for(var a in __REDACTOR_SMILIES){var b=$('<li><img src="'+__REDACTOR_SMILIES[a]+'" class="smiley" /></li>').data("smileyCode",a);b.appendTo(c).click($.proxy(this._onSmileyPick,this))}$(this.$toolbar).append(d);return d},_onSmileyPick:function(b){var a=$(b.currentTarget).data("smileyCode");this.insertSmiley(a,__REDACTOR_SMILIES[a],false)},insertSmiley:function(a,b,c){if(c){this.registerSmiley(a,b)}if(this.opts.visual){this.bufferSet();this.$editor.focus();this.insertHtml(' <img src="'+b+'" class="smiley" alt="'+a+'" /> ');if(this.opts.air){this.$air.fadeOut(100)}this.sync()}else{this.insertAtCaret(" "+a+" ")}},registerSmiley:function(a,b){if(__REDACTOR_SMILIES[a]){return false}__REDACTOR_SMILIES[a]=b;return true},toggle:function(a){if(this.opts.visual){this.toggleCode(a);this._convertFromHtml();this.buttonGet("html").children("i").removeClass("fa-square-o").addClass("fa-square")}else{this._convertToHtml();this.toggleVisual();this.buttonGet("html").children("i").removeClass("fa-square").addClass("fa-square-o")}},_convertFromHtml:function(){var m=this.$source.val();m=m.replace(/\r?\n/g,"");var f=m.split(/(<\/?p>)/);var g="";var x="";for(var a=0;a<f.length;a++){var y=f[a];if(y=="<p>"){continue}else{if(y=="</p>"){x=$.trim(x);if(x!="@@@wcf_empty_line@@@"){x+="\n"}g+=x;x=""}else{if(a==0){g+=y}else{x+=y}}}}m=g;m=m.replace(/@@@wcf_empty_line@@@/g,"\n");m=m.replace(/\n\n$/,"\n");m=m.replace(/<br>$/,"");m=m.replace(/<br>/g,"\n");m=m.replace(/<br>/g,"");m=m.replace(/ /gi," ");m=m.replace(/<a [^>]*?href=(["'])mailto:(.+?)\1.*?>([\s\S]+?)<\/a>/gi,"[email=$2]$3[/email]");m=m.replace(/<a [^>]*?href=(["'])(.+?)\1.*?>([\s\S]+?)<\/a>/gi,function(B,z,A,C){if(A==C){return"[url]"+A+"[/url]"}return"[url='"+A+"']"+C+"[/url]"});m=m.replace(/<(?:b|strong)>/gi,"[b]");m=m.replace(/<\/(?:b|strong)>/gi,"[/b]");m=m.replace(/<(?:i|em)>/gi,"[i]");m=m.replace(/<\/(?:i|em)>/gi,"[/i]");m=m.replace(/<u>/gi,"[u]");m=m.replace(/<\/u>/gi,"[/u]");m=m.replace(/<(?:s(trike)?|del)>/gi,"[s]");m=m.replace(/<\/(?:s(trike)?|del)>/gi,"[/s]");m=m.replace(/<sub>/gi,"[sub]");m=m.replace(/<\/sub>/gi,"[/sub]");m=m.replace(/<sup>/gi,"[sup]");m=m.replace(/<\/sup>/gi,"[/sup]");m=m.replace(/<img [^>]*?alt="([^"]+?)" class="smiley".*?>/gi,"$1");m=m.replace(/<img [^>]*?class="smiley" alt="([^"]+?)".*?>/gi,"$1");m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1 style="float: (left|right)[^"]*".*?>/gi,"[img='$2',$3][/img]");m=m.replace(/<img [^>]*?src=(["'])([^"']+?)\1.*?>/gi,"[img]$2[/img]");var d=m.split(/(<\/?span[^>]*>)/);var x=[];var p=[];var q="";for(var a=0;a<d.length;a++){var h=d[a];if(h=="</span>"){var c=p.pop();var g=c.start+x.pop()+c.end;if(x.length){x[x.length-1]+=g}else{q+=g}}else{if(h.match(/^<span style="([^"]+)">/)){var k=RegExp.$1;var v;var n;if(k.match(/^color: ?rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\);?$/i)){var u=RegExp.$1;var b=RegExp.$2;var e=RegExp.$3;var s=("0123456789ABCDEF".charAt((u-u%16)/16)+""+"0123456789ABCDEF".charAt(u%16))+""+("0123456789ABCDEF".charAt((b-b%16)/16)+""+"0123456789ABCDEF".charAt(b%16))+""+("0123456789ABCDEF".charAt((e-e%16)/16)+""+"0123456789ABCDEF".charAt(e%16));v="[color=#"+s+"]";n="[/color]"}else{if(k.match(/^color: ?(.*?);?$/i)){v="[color="+RegExp.$1+"]";n="[/color]"}else{if(k.match(/^font-size: ?(\d+)pt;?$/i)){v="[size="+RegExp.$1+"]";n="[/size]"}else{if(k.match(/^font-family: ?(.*?);?$/)){v="[font="+RegExp.$1.replace(/'/g,"")+"]";n="[/font]"}else{v='<span style="'+k+'">';n="</span>"}}}}x[x.length]="";p[x.length]={start:v,end:n}}else{if(x.length){x[x.length-1]+=h}else{q+=h}}}}m=q;m=m.replace(/<div style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/div>/gi,"[align=$1]$2[/align]");m=m.replace(/<li>/gi,"[*]");m=m.replace(/<\/li>/gi,"");m=m.replace(/<ul>/gi,"[list]");m=m.replace(/<(ol|ul style="list-style-type: decimal")>/gi,"[list=1]");m=m.replace(/<ul style="list-style-type: (none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)">/gi,"[list=$1]");m=m.replace(/<\/(ul|ol)>/gi,"[/list]");m=m.replace(/<table[^>]*>/gi,"[table]\n");m=m.replace(/<\/table>/gi,"[/table]\n");m=m.replace(/<tbody>([\s\S]*?)<\/tbody>/,function(z,A){return $.trim(A)});m=m.replace(/<tr><\/tr>/gi,"");m=m.replace(/<tr>/gi,"[tr]\n");m=m.replace(/<\/tr>/gi,"[/tr]\n");m=m.replace(/<td style="text-align: ?(left|center|right|justify);? ?">([\s\S]*?)<\/td>/gi,"[td][align=$1]$2[/align][/td]");m=m.replace(/(\t)*<td>/gi,"[td]");m=m.replace(/(\t)*<\/td>/gi,"[/td]\n");var w={};m.replace(/<span id="selection-marker-\d+" class="redactor-selection-marker"><\/span>/,function(z){var A=z.hashCode();w[A]=z.replace(/\$/g,"$$$$");return"@@"+A+"@@"});m=m.replace(/<[^>]+>/g,"");if($.getLength(w)){for(var j in w){var t=new RegExp("@@"+j+"@@","g");data=data.replace(t,w[j])}}m=m.replace(/</g,"<");m=m.replace(/>/g,">");m=m.replace(/&/g,"&");m=m.replace(/%28/g,"(");m=m.replace(/%29/g,")");var r={};for(var a=0,i=__REDACTOR_SOURCE_BBCODES.length;a<i;a++){var o=__REDACTOR_SOURCE_BBCODES[a];var l=new RegExp("\\["+o+"([\\S\\s]+?)\\[\\/"+o+"\\]","gi");m=m.replace(l,function(z){var A=z.hashCode();r[A]=z.replace(/\$/g,"$$$$");return"@@"+A+"@@"})}var g=m.split("\n");for(var a=0,i=g.length;a<i;a++){g[a]=g[a].replace(/^\s*/,"")}m=g.join("\n");if($.getLength(r)){for(var j in r){var t=new RegExp("@@"+j+"@@","g");m=m.replace(t,r[j])}}this.$source.val(m)},_convertToHtml:function(){var e=this.$source.val();e=this.removeZeroWidthSpace(e);e=e.replace(/&/g,"&");e=e.replace(/</g,"<");e=e.replace(/>/g,">");var b={};for(var k=0,i=__REDACTOR_SOURCE_BBCODES.length;k<i;k++){var c=__REDACTOR_SOURCE_BBCODES[k];var d=new RegExp("\\["+c+"([\\S\\s]+?)\\[\\/"+c+"\\]","gi");e=e.replace(d,function(m){var n=m.hashCode();b[n]=m.replace(/\$/g,"$$$$");return"@@"+n+"@@"})}e=e.replace(/\[url\]([^"]+?)\[\/url]/gi,'<a href="$1">$1</a>');e=e.replace(/\[url\='([^'"]+)'](.+?)\[\/url]/gi,'<a href="$1">$2</a>');e=e.replace(/\[url\=([^'"\]]+)](.+?)\[\/url]/gi,'<a href="$1">$2</a>');e=e.replace(/\[email\]([^"]+?)\[\/email]/gi,'<a href="mailto:$1">$1</a>');e=e.replace(/\[email\=([^"\]]+)](.+?)\[\/email]/gi,'<a href="mailto:$1">$2</a>');e=e.replace(/\[b\](.*?)\[\/b]/gi,"<b>$1</b>");e=e.replace(/\[i\](.*?)\[\/i]/gi,"<i>$1</i>");e=e.replace(/\[u\](.*?)\[\/u]/gi,"<u>$1</u>");e=e.replace(/\[s\](.*?)\[\/s]/gi,"<strike>$1</strike>");e=e.replace(/\[sub\](.*?)\[\/sub]/gi,"<sub>$1</sub>");e=e.replace(/\[sup\](.*?)\[\/sup]/gi,"<sup>$1</sup>");e=e.replace(/\[img\]([^"]+?)\[\/img\]/gi,'<img src="$1" />');e=e.replace(/\[img='?([^"]*?)'?,'?(left|right)'?\]\[\/img\]/gi,'<img src="$1" style="float: $2" />');e=e.replace(/\[img='?([^"]*?)'?\]\[\/img\]/gi,'<img src="$1" />');e=e.replace(/\[size=(\d+)\](.*?)\[\/size\]/gi,'<span style="font-size: $1pt">$2</span>');e=e.replace(/\[color=([#a-z0-9]*?)\](.*?)\[\/color\]/gi,'<span style="color: $1">$2</span>');e=e.replace(/\[font='?([a-z,\- ]*?)'?\](.*?)\[\/font\]/gi,'<span style="font-family: $1">$2</span>');e=e.replace(/\[align=(left|right|center|justify)\](.*?)\[\/align\]/gi,'<div style="text-align: $1">$2</div>');e=e.replace(/\[\*\](.*?)(?=\[\*\]|\[\/list\])/gi,"<li>$1</li>");e=e.replace(/\[list\]/gi,"<ul>");e=e.replace(/\[list=1\]/gi,'<ul style="list-style-type: decimal">');e=e.replace(/\[list=a\]/gi,'<ul style="list-style-type: lower-latin">');e=e.replace(/\[list=(none|circle|square|disc|decimal|lower-roman|upper-roman|decimal-leading-zero|lower-greek|lower-latin|upper-latin|armenian|georgian)\]/gi,'<ul style="list-style-type: $1">');e=e.replace(/\[\/list]/gi,"</ul>");e=e.replace(/\[table\]([\S\s]*?)\[\/table\]/gi,function(m,n){return"[table]"+$.trim(n)+"[/table]"});e=e.replace(/\[table\]/gi,'<table border="1" cellspacing="1" cellpadding="1" style="width: 500px;">');e=e.replace(/\[\/table\]/gi,"</table>");e=e.replace(/\[tr\]/gi,"<tr>");e=e.replace(/\[\/tr\]/gi,"</tr>");e=e.replace(/\[td\]/gi,"<td>");e=e.replace(/\[\/td\]/gi,"</td>");e=e.replace(/<td>([\S\s]*?)<\/td>/gi,function(m,n){return"<td>"+$.trim(n)+"</td>"});for(var l in __REDACTOR_SMILIES){$smileyCode=l.replace(/</g,"<").replace(/>/g,">");var g=new RegExp("(\\s|>|^)"+WCF.String.escapeRegExp($smileyCode)+"(?=\\s|<|$)","gi");e=e.replace(g,'$1<img src="'+__REDACTOR_SMILIES[l]+'" class="smiley" alt="'+$smileyCode+'" />')}e=e.replace(/(javascript):/gi,"$1<span></span>:");e=e.replace(/(\r|\r\n)/,"\n");var a=e.split("\n");e="";for(var k=0,i=a.length;k<i;k++){var j=$.trim(a[k]);if(j.indexOf("<")===0){e+=j}else{if(!j){j="<br>"}e+="<p>"+j+"</p>"}}if($.getLength(b)){for(var f in b){var h=new RegExp("@@"+f+"@@","g");e=e.replace(h,b[f])}}e=e.replace(/\[code\][\S\s]*?\[\/code\]/,"<pre>$&</pre>");this.$source.val(e)},_wPasteBeforeCallback:function(a){var b={1:24,2:22,3:18,4:14,5:12,6:10};a=a.replace(/<h([1-6])[^>]+>/g,function(c,d){return"[size="+b[d]+"]"});a=a.replace(/<\/h[1-6]>/g,"[/size]");a=a.replace(/<(article|header)[^>]+>/g,"<div>");a=a.replace(/<\/(article|header)>/g,"</div>");a=a.replace(/<(div|p)([^>]+)?><(div|p)([^>]+)?>/g,"<p>");a=a.replace(/<\/(div|p)><\/(div|p)>/g,"</p>@@@wcf_break@@@");return a},_wPasteAfterCallback:function(a){a=a.replace(/<p>([\s\S]*?)<\/p>/g,"<p>$1<br></p>");a=a.replace(/<header[^>]*>/g,"");a=a.replace(/<\/header>/g,"");a=a.replace(/<div>.*?<\/div>/g,"<p>$1</p>");a=a.replace(/<\/?div>/g,"");a=a.replace(/@@@wcf_break@@@/g,"<p><br></p>");a=a.replace(/<p><p>/g,"<p>");a=a.replace(/\[size=(\d+)\]/g,'<p><br></p><p><inline style="font-size: $1pt">');a=a.replace(/\[\/size\]/g,"</inline></p><p><br></p>");return a}};
// wbutton.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wbutton={_bbcodes:{},init:function(){this._bbcodes={};for(var g=0,d=__REDACTOR_BUTTONS.length;g<d;g++){this._addBBCodeButton(__REDACTOR_BUTTONS[g])}var a={html:"fa-square-o",bold:"fa-bold",italic:"fa-italic",underline:"fa-underline",deleted:"fa-strikethrough",subscript:"fa-subscript",superscript:"fa-superscript",orderedlist:"fa-list-ol",unorderedlist:"fa-list-ul",outdent:"fa-outdent",indent:"fa-indent",link:"fa-link",alignment:"fa-align-left",table:"fa-table"};var b=this.getOption("buttons");var f="";for(var g=0,d=b.length;g<d;g++){var c=b[g];if(c=="separator"){this.buttonGet(f).parent().addClass("separator");continue}var e=this.buttonGet(c);if(e.length){if(a[c]){this.buttonAwesome(c,a[c])}}else{this._addCoreButton(c,(a[c]?a[c]:null),f)}f=c}},_addCoreButton:function(b,a,c){var d=this.buttonBuild(b,{title:b,exec:b},false);$("<li />").append(d).insertAfter(this.buttonGet(c).parent());if(a!==null){this.buttonAwesome(b,a)}},_addBBCodeButton:function(b){var c="__wcf_"+b.name;var a=this.buttonAdd(c,b.label,this._insertBBCode);this._bbcodes[c]=b.name;if(b.icon.match(/^fa\-[a-z\-]+$/)){this.buttonAwesome(c,b.icon)}else{a.css("background-image","url("+__REDACTOR_ICON_PATH+b.icon+")")}},_insertBBCode:function(a,f,b,e){var d=this._bbcodes[a];var c=this.getSelectionHtml();this.insertHtml("["+d+"]"+c+"[/"+d+"]");this.sync()}};
// wfontcolor.js
// wfontsize.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wfontsize={init:function(){var d=[8,10,12,14,18,24,36];var e={};var a=this;for(var g=0,f=d.length;g<f;g++){var b=d[g];e["fontSize"+g]={title:b,className:"wfontsize-"+b,fontSize:b,callback:function(i,j,h,k){a.inlineSetStyle("font-size",h.fontSize+"pt")}}}e.separator={name:"separator"};e.remove={title:"remove font size",callback:function(){this.inlineRemoveStyle("font-size")}};this.buttonReplace("fontsize","wfontsize","Change font size",false,e);this.buttonGet("wfontsize").addClass("re-fontsize");e=this.$toolbar.find(".redactor_dropdown_box_wfontsize");for(var g=0,f=d.length;g<f;g++){var b=d[g];var c=e.children("a.wfontsize-"+b).removeClass("wfontsize-"+d).css("font-size",b+"pt");if(b>18){c.css("line-height","1em")}}}};
// wmonkeypatch.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch={init:function(){var c=this;var b=this.indentingStart;this.indentingStart=function(h){if(c.mpIndentingStart(h)){b.call(c,h)}};var a=this.buildEventKeydown;this.buildEventKeydown=function(h){if(c.callback("wkeydown",h)!==false){a.call(c,h)}};var g=this.toggleCode;this.toggleCode=function(i){var h=c.normalize(c.$editor.css("height"));g.call(c,i);c.$source.height(h)};var e=this.modalInit;this.modalInit=function(j,i,h,k){c.mpModalInit();e.call(c,j,i,h,k)};var f=this.modalShowOnDesktop;this.modalShowOnDesktop=function(){f.call(c);$(document.body).css("overflow",false)};var d=this.buttonActiveObserver;this.buttonActiveObserver=function(h,i){c.mpButtonActiveObserver(h,i);d.call(c,h,i)};if(this.opts.activeButtons){this.$editor.off("mouseup.redactor keyup.redactor").on("mouseup.redactor keyup.redactor",$.proxy(this.buttonActiveObserver,this))}this.$toolbar.find("a.re-indent, a.re-outdent").addClass("redactor_button_disabled");this.setOption("modalOpenedCallback",$.proxy(this.modalOpenedCallback,this));this.modalTemplatesInit()},cleanRemoveSpaces:function(b,a){return b},mpButtonActiveObserver:function(b,c){var a=this.getParent();if(a!==false&&$(a).closest("ul",this.$editor.get()[0]).length!=0){this.$toolbar.find("a.re-indent, a.re-outdent").removeClass("redactor_button_disabled")}else{this.$toolbar.find("a.re-indent, a.re-outdent").addClass("redactor_button_disabled")}},inlineRemoveStyle:function(a){this.selectionSave();this.inlineEachNodes(function(b){$(b).css(a,"");this.removeEmptyAttr(b,"style")});this.$editor.find("inline").each(function(c,d){if(!d.attributes.length){var b=$(d);b.replaceWith(b.html())}});this.selectionRestore();this.sync()},mpIndentingStart:function(a){if(this.getBlock().tagName=="LI"){return true}return false},modalTemplatesInit:function(){this.setOption("modal_image",'<fieldset><dl><dt><label for="redactor_file_link">'+this.opts.curLang.image_web_link+'</label></dt><dd><input type="text" name="redactor_file_link" id="redactor_file_link" class="long" /></dd></dl><dl><dt><label for="redactor_form_image_align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor_form_image_align"><option value="none">'+this.opts.curLang.none+'</option><option value="left">'+this.opts.curLang.left+'</option><option value="right">'+this.opts.curLang.right+'</option></select></dd></dl></fieldset><div class="formSubmit"><button id="redactor_upload_btn">'+this.opts.curLang.insert+"</button></div>");this.setOption("modal_image_edit",this.getOption("modal_image").replace('<button id="redactor_upload_btn">'+this.opts.curLang.insert+"</button>",'<button id="redactorSaveBtn">'+this.opts.curLang.save+"</button>"));this.setOption("modal_link",'<fieldset><dl><dt><label for="redactor_link_url">URL</label></dt><dd><input type="text" id="redactor_link_url" class="long" /></dd></dl><dl><dt><label for="redactor_link_url_text">'+this.opts.curLang.text+'</label></dt><dd><input type="text" id="redactor_link_url_text" class="long" /></dd></dl></fieldset><div class="formSubmit"><button id="redactor_insert_link_btn">'+this.opts.curLang.insert+"</button></div>");this.setOption("modal_table",'<fieldset><dl><dt><label for="redactor_table_rows">'+this.opts.curLang.rows+'</label></dt><dd><input type="number" size="5" value="2" min="0" id="redactor_table_rows" class="tiny" /></dd></dl><dl><dt><label for="redactor_table_columns">'+this.opts.curLang.columns+'</label></dt><dd><input type="number" size="5" value="3" min="0" id="redactor_table_columns" class="tiny" /></dd></dl></fieldset><div class="formSubmit"><button id="redactor_insert_table_btn">'+this.opts.curLang.insert+"</button></div>");$.extend(this.opts,{modal_file:String()+'<section id="redactor-modal-file-insert"><div id="redactor-progress" class="redactor-progress-inline" style="display: none;"><span></span></div><form id="redactorUploadFileForm" method="post" action="" enctype="multipart/form-data"><label>'+this.opts.curLang.filename+'</label><input type="text" id="redactor_filename" class="redactor_input" /><div style="margin-top: 7px;"><input type="file" id="redactor_file" name="'+this.opts.fileUploadParam+'" /></div></form></section>',modal_video:String()+'<section id="redactor-modal-video-insert"><form id="redactorInsertVideoForm"><label>'+this.opts.curLang.video_html_code+'</label><textarea id="redactor_insert_video_area" style="width: 99%; height: 160px;"></textarea></form></section><footer><button class="redactor_modal_btn redactor_btn_modal_close">'+this.opts.curLang.cancel+'</button><button id="redactor_insert_video_btn" class="redactor_modal_btn redactor_modal_action_btn">'+this.opts.curLang.insert+"</button></footer>"})},mpModalInit:function(){if(!$("#redactor_modal_overlay").length){this.$overlay=$('<div id="redactor_modal_overlay" class="dialogOverlay" />').css({height:"100%",zIndex:50000}).hide().appendTo(document.body)}if(!$("#redactor_modal").length){this.$modal=$('<div id="redactor_modal" class="dialogContainer" />').css({display:"none",zIndex:50001}).appendTo(document.body);$('<header class="dialogTitlebar"><span id="redactor_modal_header" class="dialogTitle" /><a id="redactor_modal_close" class="dialogCloseButton" /></header>').appendTo(this.$modal);$('<div class="dialogContent"><div id="redactor_modal_inner" /></div>').appendTo(this.$modal)}this.$modal.children(".dialogContent").removeClass("dialogForm")},tableInsert:function(){this.bufferSet(false);var m=$("#redactor_table_rows").val(),b=$("#redactor_table_columns").val(),h=$("<div></div>"),a=Math.floor(Math.random()*99999),k=$('<table id="table'+a+'"><tbody></tbody></table>'),c,f,g,j;for(c=0;c<m;c++){f=$("<tr></tr>");for(g=0;g<b;g++){j=$("<td>"+this.opts.invisibleSpace+"</td>");if(c===0&&g===0){j.append('<span id="selection-marker-1">'+this.opts.invisibleSpace+"</span>")}$(f).append(j)}k.append(f)}h.append(k);var d=h.html();if(this.opts.linebreaks===false&&this.browser("mozilla")){d+="<p>"+this.opts.invisibleSpace+"</p>"}this.modalClose();this.selectionRestore();var e=this.getBlock()||this.getCurrent();if(e&&e.tagName!="BODY"){if(e.tagName=="TD"){$(e).append(d)}else{if(e.tagName=="LI"){var e=$(e).closest("ul, ol")}$(e).after(d)}}else{this.insertHtmlAdvanced(d,false)}this.selectionRestore();var l=this.$editor.find("#table"+a);this.buttonActiveObserver();l.find("span#selection-marker-1, inline#selection-marker-1").remove();l.removeAttr("id");this.sync()},modalOpenedCallback:function(){var a=0;if(this.$modal.find(".formSubmit").length){a=this.$modal.find(".formSubmit").outerHeight();this.$modal.children(".dialogContent").addClass("dialogForm").css({marginBottom:a+"px"})}else{this.$modal.children(".dialogContent").removeClass("dialogForm").css({marginBottom:"0px"})}var b=this.$modal.getDimensions("outer");this.$modal.css({marginLeft:-1*Math.round(b.width/2)+"px",marginTop:-1*Math.round(b.height/2)+"px"})},inlineEachNodes:function(e){var b=this.getRange(),c=this.getElement(),a=this.getNodes(),d;if(b.collapsed||b.startContainer===b.endContainer&&c){a=$(c);d=true}$.each(a,$.proxy(function(g,j){if(!d&&j.tagName!=="INLINE"){var f=this.getSelectionText();var k=$(j).parent().text();var h=this.removeZeroWidthSpace(f)==this.removeZeroWidthSpace(k);if(h&&j.parentNode.tagName==="INLINE"&&!$(j.parentNode).hasClass("redactor_editor")){j=j.parentNode}else{return}}e.call(this,j)},this))}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wmonkeypatch={init:function(){var c=this;var b=this.indentingStart;this.indentingStart=function(i){if(c.mpIndentingStart(i)){b.call(c,i)}};var a=this.buildEventKeydown;this.buildEventKeydown=function(i){if(c.callback("wkeydown",i)!==false){a.call(c,i)}};var h=this.toggleCode;this.toggleCode=function(j){var i=c.normalize(c.$editor.css("height"));h.call(c,j);c.$source.height(i)};var f=this.modalInit;this.modalInit=function(k,j,i,l){c.mpModalInit();f.call(c,k,j,i,l)};var g=this.modalShowOnDesktop;this.modalShowOnDesktop=function(){g.call(c);$(document.body).css("overflow",false)};var d=this.destroy;this.destroy=function(){c.callback("destroy",false,{});d.call(c)};var e=this.buttonActiveObserver;this.buttonActiveObserver=function(i,j){c.mpButtonActiveObserver(i,j);e.call(c,i,j)};if(this.opts.activeButtons){this.$editor.off("mouseup.redactor keyup.redactor").on("mouseup.redactor keyup.redactor",$.proxy(this.buttonActiveObserver,this))}this.$toolbar.find("a.re-indent, a.re-outdent").addClass("redactor_button_disabled");this.setOption("modalOpenedCallback",$.proxy(this.modalOpenedCallback,this));this.modalTemplatesInit()},cleanRemoveSpaces:function(b,a){return b},mpButtonActiveObserver:function(b,c){var a=this.getParent();if(a!==false&&$(a).closest("ul",this.$editor.get()[0]).length!=0){this.$toolbar.find("a.re-indent, a.re-outdent").removeClass("redactor_button_disabled")}else{this.$toolbar.find("a.re-indent, a.re-outdent").addClass("redactor_button_disabled")}},inlineRemoveStyle:function(a){this.selectionSave();this.inlineEachNodes(function(b){$(b).css(a,"");this.removeEmptyAttr(b,"style")});this.$editor.find("inline").each(function(c,d){if(!d.attributes.length){var b=$(d);b.replaceWith(b.html())}});this.selectionRestore();this.sync()},mpIndentingStart:function(a){if(this.getBlock().tagName=="LI"){return true}return false},modalTemplatesInit:function(){this.setOption("modal_image",'<fieldset><dl><dt><label for="redactor_file_link">'+this.opts.curLang.image_web_link+'</label></dt><dd><input type="text" name="redactor_file_link" id="redactor_file_link" class="long" /></dd></dl><dl><dt><label for="redactor_form_image_align">'+this.opts.curLang.image_position+'</label></dt><dd><select id="redactor_form_image_align"><option value="none">'+this.opts.curLang.none+'</option><option value="left">'+this.opts.curLang.left+'</option><option value="right">'+this.opts.curLang.right+'</option></select></dd></dl></fieldset><div class="formSubmit"><button id="redactor_upload_btn">'+this.opts.curLang.insert+"</button></div>");this.setOption("modal_image_edit",this.getOption("modal_image").replace('<button id="redactor_upload_btn">'+this.opts.curLang.insert+"</button>",'<button id="redactorSaveBtn">'+this.opts.curLang.save+"</button>"));this.setOption("modal_link",'<fieldset><dl><dt><label for="redactor_link_url">URL</label></dt><dd><input type="text" id="redactor_link_url" class="long" /></dd></dl><dl><dt><label for="redactor_link_url_text">'+this.opts.curLang.text+'</label></dt><dd><input type="text" id="redactor_link_url_text" class="long" /></dd></dl></fieldset><div class="formSubmit"><button id="redactor_insert_link_btn">'+this.opts.curLang.insert+"</button></div>");this.setOption("modal_table",'<fieldset><dl><dt><label for="redactor_table_rows">'+this.opts.curLang.rows+'</label></dt><dd><input type="number" size="5" value="2" min="0" id="redactor_table_rows" class="tiny" /></dd></dl><dl><dt><label for="redactor_table_columns">'+this.opts.curLang.columns+'</label></dt><dd><input type="number" size="5" value="3" min="0" id="redactor_table_columns" class="tiny" /></dd></dl></fieldset><div class="formSubmit"><button id="redactor_insert_table_btn">'+this.opts.curLang.insert+"</button></div>");$.extend(this.opts,{modal_file:String()+'<section id="redactor-modal-file-insert"><div id="redactor-progress" class="redactor-progress-inline" style="display: none;"><span></span></div><form id="redactorUploadFileForm" method="post" action="" enctype="multipart/form-data"><label>'+this.opts.curLang.filename+'</label><input type="text" id="redactor_filename" class="redactor_input" /><div style="margin-top: 7px;"><input type="file" id="redactor_file" name="'+this.opts.fileUploadParam+'" /></div></form></section>',modal_video:String()+'<section id="redactor-modal-video-insert"><form id="redactorInsertVideoForm"><label>'+this.opts.curLang.video_html_code+'</label><textarea id="redactor_insert_video_area" style="width: 99%; height: 160px;"></textarea></form></section><footer><button class="redactor_modal_btn redactor_btn_modal_close">'+this.opts.curLang.cancel+'</button><button id="redactor_insert_video_btn" class="redactor_modal_btn redactor_modal_action_btn">'+this.opts.curLang.insert+"</button></footer>"})},mpModalInit:function(){if(!$("#redactor_modal_overlay").length){this.$overlay=$('<div id="redactor_modal_overlay" class="dialogOverlay" />').css({height:"100%",zIndex:50000}).hide().appendTo(document.body)}if(!$("#redactor_modal").length){this.$modal=$('<div id="redactor_modal" class="dialogContainer" />').css({display:"none",zIndex:50001}).appendTo(document.body);$('<header class="dialogTitlebar"><span id="redactor_modal_header" class="dialogTitle" /><a id="redactor_modal_close" class="dialogCloseButton" /></header>').appendTo(this.$modal);$('<div class="dialogContent"><div id="redactor_modal_inner" /></div>').appendTo(this.$modal)}this.$modal.children(".dialogContent").removeClass("dialogForm")},tableInsert:function(){this.bufferSet(false);var m=$("#redactor_table_rows").val(),b=$("#redactor_table_columns").val(),h=$("<div></div>"),a=Math.floor(Math.random()*99999),k=$('<table id="table'+a+'"><tbody></tbody></table>'),c,f,g,j;for(c=0;c<m;c++){f=$("<tr></tr>");for(g=0;g<b;g++){j=$("<td>"+this.opts.invisibleSpace+"</td>");if(c===0&&g===0){j.append('<span id="selection-marker-1">'+this.opts.invisibleSpace+"</span>")}$(f).append(j)}k.append(f)}h.append(k);var d=h.html();if(this.opts.linebreaks===false&&this.browser("mozilla")){d+="<p>"+this.opts.invisibleSpace+"</p>"}this.modalClose();this.selectionRestore();var e=this.getBlock()||this.getCurrent();if(e&&e.tagName!="BODY"){if(e.tagName=="TD"){$(e).append(d)}else{if(e.tagName=="LI"){var e=$(e).closest("ul, ol")}$(e).after(d)}}else{this.insertHtmlAdvanced(d,false)}this.selectionRestore();var l=this.$editor.find("#table"+a);this.buttonActiveObserver();l.find("span#selection-marker-1, inline#selection-marker-1").remove();l.removeAttr("id");this.sync()},modalOpenedCallback:function(){var a=0;if(this.$modal.find(".formSubmit").length){a=this.$modal.find(".formSubmit").outerHeight();this.$modal.children(".dialogContent").addClass("dialogForm").css({marginBottom:a+"px"})}else{this.$modal.children(".dialogContent").removeClass("dialogForm").css({marginBottom:"0px"})}var b=this.$modal.getDimensions("outer");this.$modal.css({marginLeft:-1*Math.round(b.width/2)+"px",marginTop:-1*Math.round(b.height/2)+"px"})},inlineEachNodes:function(e){var b=this.getRange(),c=this.getElement(),a=this.getNodes(),d;if(b.collapsed||b.startContainer===b.endContainer&&c){a=$(c);d=true}$.each(a,$.proxy(function(g,j){if(!d&&j.tagName!=="INLINE"){var f=this.getSelectionText();var k=$(j).parent().text();var h=this.removeZeroWidthSpace(f)==this.removeZeroWidthSpace(k);if(h&&j.parentNode.tagName==="INLINE"&&!$(j.parentNode).hasClass("redactor_editor")){j=j.parentNode}else{return}}e.call(this,j)},this))}};
// woptions.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.woptions={_messageOptions:{},_messageOptionContainer:null,_messageOptionNavigation:null,init:function(){var a=this.getOption("wMessageOptions");if(!a.length){return}this._messageOptionContainer=$('<div id="redactorMessageOptions" class="redactorMessageOptions" />').appendTo(this.$box);this._messageOptionNavigation=$("<nav><ul /></nav>").appendTo(this._messageOptionContainer).children("ul");for(var f=0;f<a.length;f++){var e=a[f];var c=$("<li><a>"+e.title+"</a></li>").appendTo(this._messageOptionNavigation);c.data("containerID",e.containerID).click($.proxy(this._showMessageOptionContainer,this));var b=$('<div class="redactorMessageOptionContainer" id="redactorMessageOptions_'+e.containerID+'" />').hide().appendTo(this._messageOptionContainer);for(var d=0;d<e.items.length;d++){$(e.items[d]).appendTo(b)}this._messageOptions[e.containerID]={container:b,listItem:c}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","updateMessageOptions",this._messageOptions);WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._wOptionsListener,this))},_showMessageOptionContainer:function(c,a){var b=(c===null)?a:$(c.currentTarget).data("containerID");if(this._messageOptions[b].listItem.hasClass("active")){this._messageOptions[b].listItem.removeClass("active");this._messageOptions[b].container.hide();return}$.each(this._messageOptions,function(d,e){if(d==b){e.listItem.addClass("active");e.container.show()}else{e.listItem.removeClass("active");e.container.hide()}})},_wOptionsListener:function(a){$.each(this._messageOptions,function(b,c){c.listItem.removeClass("active");c.container.hide();c.container.find("input, select, textarea").each(function(e,f){var d=$(f);switch(d.getTagName()){case"input":d.prop("checked",false);break;default:d.val("");break}})});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","updateMessageOptions",this._messageOptions)}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.woptions={_messageOptions:{},_messageOptionContainer:{},_messageOptionNavigation:{},init:function(){var a=this.getOption("wMessageOptions");if(!a.length){return}var d=this.$source.wcfIdentify();this.$box.wrap('<div class="redactorContainer" />');this._messageOptionContainer[d]=$('<div id="redactorMessageOptions" class="redactorMessageOptions" />').insertAfter(this.$box);this._messageOptionNavigation[d]=$("<nav><ul /></nav>").appendTo(this._messageOptionContainer[d]).children("ul");this._messageOptions[d]={};for(var g=0;g<a.length;g++){var f=a[g];var c=$("<li><a>"+f.title+"</a></li>").appendTo(this._messageOptionNavigation[d]);c.data("containerID",f.containerID).click($.proxy(this._showMessageOptionContainer,this));var b=$('<div class="redactorMessageOptionContainer redactorMessageOptions_'+f.containerID+'" />').hide().appendTo(this._messageOptionContainer[d]);for(var e=0;e<f.items.length;e++){$(f.items[e]).appendTo(b)}this._messageOptions[d][f.containerID]={container:b,listItem:c}}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","updateMessageOptions",this._messageOptions);WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._wOptionsListener,this))},_showMessageOptionContainer:function(d,a){var c=(d===null)?a:$(d.currentTarget).data("containerID");var b=this.$source.wcfIdentify();if(this._messageOptions[b][c].listItem.hasClass("active")){this._messageOptions[b][c].listItem.removeClass("active");this._messageOptions[b][c].container.hide();return}$.each(this._messageOptions[b],function(e,f){if(e==c){f.listItem.addClass("active");f.container.show()}else{f.listItem.removeClass("active");f.container.hide()}})},_wOptionsListener:function(a){$.each(this._messageOptions,function(b,c){c.listItem.removeClass("active");c.container.hide();c.container.find("input, select, textarea").each(function(e,f){var d=$(f);switch(d.getTagName()){case"input":d.prop("checked",false);break;default:d.val("");break}})});WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","updateMessageOptions",this._messageOptions)}};
// wupload.js
-if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wupload={_attachmentsContainer:null,init:function(){var a=this;this.buttonReplace("upload","upload","Upload",function(){a._attachmentsContainer.toggle()});this.buttonAwesome("upload","fa-upload");this._initAttachments();WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._wUploadListener,this))},_initAttachments:function(){this._attachmentsContainer=$("#redactorMessageOptions_attachments");var f=$('<ul class="formAttachmentList clearfix" />').hide().appendTo(this._attachmentsContainer);$('<dl class="wide"><dt></dt><dd><div data-max-size="{@$attachmentHandler->getMaxSize()}"></div><small>'+WCF.String.unescapeHTML(WCF.Language.get("wcf.attachment.upload.limits"))+"</small></dd></dl>").appendTo(this._attachmentsContainer);var a=this.getOption("wattachment");if(a.attachments.length){for(var g=0;g<a.attachments.length;g++){var e=a.attachments[g];var d=$('<li class="box48" />').data("objectID",e.attachmentID);if(e.tinyThumbnailUrl){$('<img src="'+e.tinyThumbnailUrl+'" alt="" class="attachmentTinyThumbnail" />').appendTo(d)}else{$('<span class="icon icon48 icon-paper-clip" />').appendTo(d)}var b=$("<div />").appendTo(d);$('<div><p><a href="'+e.url+'"'+(e.isImage?' title="'+e.filename+'" class="jsImageViewer"':"")+">"+e.filename+"</a></p></div>").appendTo(b);var c=$("<ul />").appendTo(b);$('<li><span class="icon icon16 icon-remove pointer jsTooltip jsDeleteButton " title="'+WCF.Language.get("wcf.global.button.delete")+'" data-object-id="'+e.attachmentID+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'"></span></li>').appendTo(c);$('<li><span class="icon icon16 icon-paste pointer jsTooltip jsButtonInsertAttachment" title="'+WCF.Language.get("wcf.attachment.insert")+'" data-object-id="'+e.attachmentID+'"></span></li>').appendTo(c);d.appendTo(f);f.show()}this._showMessageOptionContainer(null,"attachments")}new WCF.Attachment.Upload(this._attachmentsContainer.find("> dl > dd > div"),this._attachmentsContainer.children("ul"),a.objectType,a.objectID,a.tmpHash,a.parentObjectID,a.maxCount,this.$source.wcfIdentify());new WCF.Action.Delete("wcf\\data\\attachment\\AttachmentAction",".formAttachmentList > li")},_wUploadListener:function(a){this._attachmentsContainer.children(".formAttachmentList").hide().empty();this._attachmentsContainer.find(".jsButtonAttachmentInsertAll").hide()}};
+if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wupload={_attachmentsContainer:null,init:function(){var a=this;this.buttonReplace("upload","upload","Upload",function(){a._attachmentsContainer.toggle()});this.buttonAwesome("upload","fa-upload");this._initAttachments();WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._wUploadListener,this))},_initAttachments:function(){this._attachmentsContainer=this._messageOptions[this.$source.wcfIdentify()].attachments.container;var f=$('<ul class="formAttachmentList clearfix" />').hide().appendTo(this._attachmentsContainer);$('<dl class="wide"><dt></dt><dd><div data-max-size="{@$attachmentHandler->getMaxSize()}"></div><small>'+WCF.String.unescapeHTML(WCF.Language.get("wcf.attachment.upload.limits"))+"</small></dd></dl>").appendTo(this._attachmentsContainer);var a=this.getOption("wattachment");if(a.attachments.length){for(var g=0;g<a.attachments.length;g++){var e=a.attachments[g];var d=$('<li class="box48" />').data("objectID",e.attachmentID);if(e.tinyThumbnailUrl){$('<img src="'+e.tinyThumbnailUrl+'" alt="" class="attachmentTinyThumbnail" />').appendTo(d)}else{$('<span class="icon icon48 icon-paper-clip" />').appendTo(d)}var b=$("<div />").appendTo(d);$('<div><p><a href="'+e.url+'"'+(e.isImage?' title="'+e.filename+'" class="jsImageViewer"':"")+">"+e.filename+"</a></p></div>").appendTo(b);var c=$("<ul />").appendTo(b);$('<li><span class="icon icon16 icon-remove pointer jsTooltip jsDeleteButton " title="'+WCF.Language.get("wcf.global.button.delete")+'" data-object-id="'+e.attachmentID+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'"></span></li>').appendTo(c);$('<li><span class="icon icon16 icon-paste pointer jsTooltip jsButtonInsertAttachment" title="'+WCF.Language.get("wcf.attachment.insert")+'" data-object-id="'+e.attachmentID+'"></span></li>').appendTo(c);d.appendTo(f);f.show()}this._showMessageOptionContainer(null,"attachments")}new WCF.Attachment.Upload(this._attachmentsContainer.find("> dl > dd > div"),this._attachmentsContainer.children("ul"),a.objectType,a.objectID,a.tmpHash,a.parentObjectID,a.maxCount,this.$source.wcfIdentify());new WCF.Action.Delete("wcf\\data\\attachment\\AttachmentAction",".formAttachmentList > li")},_wUploadListener:function(a){this._attachmentsContainer.children(".formAttachmentList").hide().empty();this._attachmentsContainer.find(".jsButtonAttachmentInsertAll").hide()}};
// wutil.js
if(!RedactorPlugins){var RedactorPlugins={}}RedactorPlugins.wutil={_autosaveWorker:null,init:function(){this.$source.parents("form").submit($.proxy(this.submit,this));if(this.getOption("wautosave").active){this.autosaveEnable();if(this.getOption("wautosave").saveOnInit||this.$source.data("saveOnInit")){this.setOption("wAutosaveOnce",true)}else{this.autosaveRestore()}}this.setOption("autosave",false);var b=this.destroy;var a=this;this.destroy=function(){a.autosaveDisable();b.call(a)}},insertAtCaret:function(b){if(this.opts.visual){console.debug("insertAtCaret() failed: Editor is in WYSIWYG-mode.");return false}this.$source.focus();var c=this.$source.getCaret();if(c==-1){console.debug("insertAtCaret() failed: Source is not input[type=text], input[type=password] or textarea.")}var a=this.$source.val();a=a.substr(0,c)+b+a.substr(c);this.$source.val(a);return true},insertDynamic:function(a,b){if(this.inWysiwygMode()){this.insertHtml(a)}else{if(b===undefined||b===null){b=a}this.insertAtCaret(b)}},setOption:function(a,b){this.opts[a]=b},getOption:function(a){if(this.opts[a]){return this.opts[a]}return null},inPlainMode:function(){return !this.opts.visual},inWysiwygMode:function(){return(this.opts.visual)},replaceRangesWith:function(a){getSelection().removeAllRanges();getSelection().addRange(a)},getText:function(){if(this.inWysiwygMode()){this.wSync()}return this.$source.val()},submit:function(){if(this.inWysiwygMode()){this.wSync()}this.autosavePurge()},reset:function(){if(this.inWysiwygMode()){this.$editor.empty();this.sync()}else{this.$source.val("")}WCF.System.Event.fireEvent("com.woltlab.wcf.redactor","reset")},autosaveEnable:function(a){if(!this.getOption("wautosave").active){this.setOption("wautosave",{active:true,key:a})}if(this._autosaveWorker===null){this._autosaveWorker=new WCF.PeriodicalExecuter($.proxy(this._saveTextToStorage,this),60*1000)}return true},_saveTextToStorage:function(){localStorage.setItem(this.getOption("wautosave").key,this.getText())},autosaveDisable:function(){if(!this.getOption("wautosave").active){return false}this._autosaveWorker.stop();this._autosaveWorker=null;this.setOption("wautosave",{active:false,key:""});return true},autosavePurge:function(){localStorage.removeItem(this.getOption("wautosave").key)},autosaveRestore:function(){var a=this.getOption("wautosave");var b=localStorage.getItem(a.key);if(b!==null){if(this.inWysiwygMode()){this.toggle(false);this.$source.val(b);this.toggle(false);this.focusEnd()}else{this.$source.val(b)}return true}return false},buttonReplace:function(d,b,e,g,f){var a=this.buttonGet(d);var c=this.buttonAddAfter(d,b,e,g,f);if(a.parent().hasClass("separator")){c.parent().addClass("separator")}a.parent().remove();return c},removeZeroWidthSpace:function(a){var b="";for(var e=0,d=a.length;e<d;e++){var c=a.charCodeAt(e).toString(16);if(c!="200b"){b+=a[e]}}return b},wSync:function(){this.$source.val(this.cleanHtml(this.$source.val()));this._convertFromHtml()}};
WCF.Location={};WCF.Location.Util={getLocation:function(b,a){if(navigator.geolocation){navigator.geolocation.getCurrentPosition(function(c){b(c.coords.latitude,c.coords.longitude)},function(){b(undefined,undefined)},{timeout:a||5000})}else{b(undefined,undefined)}}};WCF.Location.GoogleMaps={};WCF.Location.GoogleMaps.Settings={_settings:{},get:function(a){if(a===undefined){return this._settings}if(this._settings[a]!==undefined){return this._settings[a]}return null},set:function(b,c){if($.isPlainObject(b)){for(var a in b){this._settings[a]=b[a]}}else{this._settings[b]=c}}};WCF.Location.GoogleMaps.Map=Class.extend({_map:null,_markers:[],init:function(b,a){this._mapContainer=$("#"+b);this._mapOptions=$.extend(true,this._getDefaultMapOptions(),a);this._map=new google.maps.Map(this._mapContainer[0],this._mapOptions);this._markers=[];if(this._mapContainer.parents(".sidebar").length){enquire.register("screen and (max-width: 800px)",{setup:$.proxy(this._addSidebarMapListener,this),deferSetup:true})}this.refresh()},_addInfoWindowEventListener:function(a,b){google.maps.event.addListener(a,"click",$.proxy(function(){b.open(this._map,a)},this))},_addSidebarMapListener:function(){$(".content > .mobileSidebarToggleButton").click($.proxy(this.refresh,this))},_getDefaultMapOptions:function(){var a={};a.center=new google.maps.LatLng(WCF.Location.GoogleMaps.Settings.get("defaultLatitude"),WCF.Location.GoogleMaps.Settings.get("defaultLongitude"));a.disableDoubleClickZoom=WCF.Location.GoogleMaps.Settings.get("disableDoubleClickZoom");a.draggable=WCF.Location.GoogleMaps.Settings.get("draggable");switch(WCF.Location.GoogleMaps.Settings.get("mapType")){case"map":a.mapTypeId=google.maps.MapTypeId.ROADMAP;break;case"satellite":a.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"physical":a.mapTypeId=google.maps.MapTypeId.TERRAIN;break;case"hybrid":default:a.mapTypeId=google.maps.MapTypeId.HYBRID;break}a.mapTypeControl=WCF.Location.GoogleMaps.Settings.get("mapTypeControl")!="off";if(a.mapTypeControl){switch(WCF.Location.GoogleMaps.Settings.get("mapTypeControl")){case"dropdown":a.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.DROPDOWN_MENU};break;case"horizontalBar":a.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR};break;default:a.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.DEFAULT};break}}a.scaleControl=WCF.Location.GoogleMaps.Settings.get("scaleControl");a.scrollwheel=WCF.Location.GoogleMaps.Settings.get("scrollwheel");a.zoom=WCF.Location.GoogleMaps.Settings.get("zoom");return a},addDraggableMarker:function(c,b){var a=new google.maps.Marker({clickable:false,draggable:true,map:this._map,position:new google.maps.LatLng(c,b),zIndex:1});this._markers.push(a);return a},addMarker:function(g,e,f,d,c){var b=new google.maps.Marker({map:this._map,position:new google.maps.LatLng(g,e),title:f});if(d){b.setIcon(d)}if(c){var a=new google.maps.InfoWindow({content:c});this._addInfoWindowEventListener(b,a);b.infoWindow=a}this._markers.push(b);return b},getMarkers:function(){return this._markers},getMap:function(){return this._map},refresh:function(){var a=this._map.getCenter();google.maps.event.trigger(this._map,"resize");this._map.setCenter(a)},refreshBounds:function(){var f=null;var c=null;var d=null;var g=null;for(var a in this._markers){var e=this._markers[a];var h=e.getPosition().lat();var b=e.getPosition().lng();if(f===null){f=c=h;d=g=b}else{if(f>h){f=h}else{if(c<h){c=h}}if(d>h){d=h}else{if(g<b){g=b}}}}this._map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(f,d),new google.maps.LatLng(c,g)))},removeMarkers:function(){for(var a in this._markers){this._markers[a].setMap(null)}this._markers=[]},setCenter:function(b,a){this._map.setCenter(new google.maps.LatLng(b,a))}});WCF.Location.GoogleMaps.LargeMap=WCF.Location.GoogleMaps.Map.extend({_actionClassName:null,_locationSearch:null,_locationSearchInputSelector:null,_markerClusterer:null,_objectIDs:[],_previousNorthEast:null,_previousSouthWest:null,init:function(d,a,c,b){this._super(d,a);this._actionClassName=c;this._locationSearchInputSelector=b||"";this._objectIDs=[];if(this._locationSearchInputSelector){this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(b,$.proxy(this._centerMap,this))}this._markerClusterer=new MarkerClusterer(this._map,this._markers,{maxZoom:17});this._markerSpiderfier=new OverlappingMarkerSpiderfier(this._map,{keepSpiderfied:true,markersWontHide:true,markersWontMove:true});this._markerSpiderfier.addListener("click",$.proxy(function(e){if(e.infoWindow){e.infoWindow.open(this._map,e)}},this));this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this)});this._previousNorthEast=null;this._previousSouthWest=null;google.maps.event.addListener(this._map,"idle",$.proxy(this._loadMarkers,this))},_addInfoWindowEventListener:function(a,b){},_centerMap:function(a){this.setCenter(a.location.lat(),a.location.lng());$(this._locationSearchInputSelector).val(a.label)},_loadMarkers:function(){var a=this._map.getBounds().getNorthEast();var b=this._map.getBounds().getSouthWest();if(this._previousNorthEast&&this._previousNorthEast.lat()>=a.lat()&&this._previousNorthEast.lng()>=a.lng()&&this._previousSouthWest.lat()<=b.lat()&&this._previousSouthWest.lng()<=b.lng()){return}this._previousNorthEast=a;this._previousSouthWest=b;this._proxy.setOption("data",{actionName:"getMapMarkers",className:this._actionClassName,parameters:{excludedObjectIDs:this._objectIDs,eastLongitude:a.lng(),northLatitude:a.lat(),southLatitude:b.lat(),westLongitude:b.lng()}});this._proxy.sendRequest()},_success:function(d,e,c){if(d.returnValues&&d.returnValues.markers){for(var a in d.returnValues.markers){var b=d.returnValues.markers[a];this.addMarker(b.latitude,b.longitude,b.title,null,b.infoWindow);if(b.objectID){this._objectIDs.push(b.objectID)}else{if(b.objectIDs){this._objectIDs=this._objectIDs.concat(b.objectIDs)}}}}},addMarker:function(f,d,e,c,b){var a=this._super(f,d,e,c,b);this._markerClusterer.addMarker(a);this._markerSpiderfier.addMarker(a);return a}});WCF.Location.GoogleMaps.LocationSearch=WCF.Search.Base.extend({_geocoder:null,init:function(b,e,a,c,d){this._super(b,e,a,c,d);this._geocoder=new google.maps.Geocoder()},_createListItem:function(b){var a=$("<li><span>"+WCF.String.escapeHTML(b.formatted_address)+"</span></li>").appendTo(this._list);a.data("location",b.geometry.location).data("label",b.formatted_address).click($.proxy(this._executeCallback,this));this._itemCount++;return a},_keyUp:function(b){switch(b.which){case $.ui.keyCode.LEFT:case $.ui.keyCode.RIGHT:return;break;case $.ui.keyCode.UP:this._selectPreviousItem();return;break;case $.ui.keyCode.DOWN:this._selectNextItem();return;break;case $.ui.keyCode.ENTER:return this._selectElement(b);break}var a=this._getSearchString(b);if(a===""){this._clearList(true)}else{if(a.length>=this._triggerLength){this._clearList(false);this._geocoder.geocode({address:a},$.proxy(this._success,this))}else{this._clearList(false)}}},_success:function(d,b){if(b!=google.maps.GeocoderStatus.OK){return}if($.getLength(d)){var c=0;for(var a in d){this._createListItem(d[a]);if(++c==10){break}}}else{if(!this._handleEmptyResult()){return}}WCF.CloseOverlayHandler.addCallback("WCF.Search.Base",$.proxy(function(){this._clearList()},this));var e=this._searchInput.parents(".dropdown").wcfIdentify();if(!WCF.Dropdown.getDropdownMenu(e).hasClass("dropdownOpen")){WCF.Dropdown.toggleDropdown(e)}this._itemIndex=-1;if(!WCF.Dropdown.getDropdown(e).data("disableAutoFocus")){this._selectNextItem()}}});WCF.Location.GoogleMaps.LocationInput=Class.extend({_locationSearch:null,_map:null,_marker:null,init:function(d,b,a,e,c){this._searchInput=a;this._map=new WCF.Location.GoogleMaps.Map(d,b);this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(a,$.proxy(this._setMarkerByLocation,this));if(e&&c){this._marker=this._map.addDraggableMarker(e,c)}else{this._marker=this._map.addDraggableMarker(0,0);WCF.Location.Util.getLocation($.proxy(function(g,f){if(g!==undefined&&f!==undefined){WCF.Location.GoogleMaps.Util.moveMarker(this._marker,g,f);WCF.Location.GoogleMaps.Util.focusMarker(this._marker)}},this))}this._marker.addListener("dragend",$.proxy(this._updateLocation,this))},getMap:function(){return this._map},getMarker:function(){return this._marker},_updateLocation:function(){WCF.Location.GoogleMaps.Util.reverseGeocoding($.proxy(function(a){if(a!==null){$(this._searchInput).val(a)}},this),this._marker)},_setMarkerByLocation:function(a){this._marker.setPosition(a.location);WCF.Location.GoogleMaps.Util.focusMarker(this._marker);$(this._searchInput).val(a.label)}});WCF.Location.GoogleMaps.Util={_geocoder:null,focusMarker:function(a){a.getMap().setCenter(a.getPosition())},getMarkerPosition:function(a){return{latitude:a.getPosition().lat(),longitude:a.getPosition().lng()}},moveMarker:function(a,d,b,c){a.setPosition(new google.maps.LatLng(d,b));if(c){google.maps.event.trigger(a,"dragend")}},reverseGeocoding:function(f,a,e,c,b){if(a){e=a.getPosition().lat();c=a.getPosition().lng()}if(this._geocoder===null){this._geocoder=new google.maps.Geocoder()}var d=new google.maps.LatLng(e,c);this._geocoder.geocode({latLng:d},function(h,g){if(g==google.maps.GeocoderStatus.OK){f((b?h:h[0].formatted_address))}else{f(null)}})}};
// WCF.Message.js
-WCF.Message={};WCF.Message.BBCode={};WCF.Message.BBCode.CodeViewer=Class.extend({_dialog:null,init:function(){this._dialog=null;this._initCodeBoxes();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.BBCode.CodeViewer",$.proxy(this._initCodeBoxes,this));WCF.DOMNodeInsertedHandler.execute()},_initCodeBoxes:function(){$(".codeBox:not(.jsCodeViewer)").each($.proxy(function(a,c){var b=$(c).addClass("jsCodeViewer");$('<span class="icon icon16 icon-copy pointer jsTooltip" title="'+WCF.Language.get("wcf.message.bbcode.code.copy")+'" />').appendTo(b.find("div > h3")).click($.proxy(this._click,this))},this))},_click:function(b){var a="";$(b.currentTarget).parents("div").next("ol").children("li").each(function(c,d){if(a){a+="\n"}a+=$(d).text().replace(/\n+$/,"")});if(this._dialog===null){this._dialog=$('<div><textarea cols="60" rows="12" readonly="readonly" /></div>').hide().appendTo(document.body);this._dialog.children("textarea").val(a);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.bbcode.code.copy")})}else{this._dialog.children("textarea").val(a);this._dialog.wcfDialog("open")}this._dialog.children("textarea").select()}});WCF.Message.FormGuard=Class.extend({init:function(){var a=$("form.jsFormGuard").removeClass("jsFormGuard").submit(function(){$(this).find(".formSubmit input[type=submit]").disable()});$(window).unload(function(){a.find(".formSubmit input[type=submit]").enable()})}});WCF.Message.Preview=Class.extend({_className:"",_messageFieldID:"",_messageField:null,_proxy:null,_previewButton:null,_previewButtonLabel:"",init:function(b,a,c){this._className=b;this._messageFieldID=$.wcfEscapeID(a);this._messageField=$("#"+this._messageFieldID);if(!this._messageField.length){console.debug("[WCF.Message.Preview] Unable to find message field identified by '"+this._messageFieldID+"'");return}c=$.wcfEscapeID(c);this._previewButton=$("#"+c);if(!this._previewButton.length){console.debug("[WCF.Message.Preview] Unable to find preview button identified by '"+c+"'");return}this._previewButton.click($.proxy(this._click,this));this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)})},_click:function(b){var a=this._getMessage();if(a===null){console.debug("[WCF.Message.Preview] Unable to access Redactor instance of '"+this._messageFieldID+"'");return}this._proxy.setOption("data",{actionName:"getMessagePreview",className:this._className,parameters:this._getParameters(a)});this._proxy.sendRequest();this._previewButtonLabel=this._previewButton.html();this._previewButton.html(WCF.Language.get("wcf.global.loading")).disable();b.stopPropagation();return false},_getParameters:function(b){var a={};$("#settings").find("input[type=checkbox]").each(function(c,e){var d=$(e);if(d.is(":checked")){a[d.prop("name")]=d.prop("value")}});return{data:{message:b},options:a}},_getMessage:function(){if(!$.browser.redactor){return this._messageField.val()}else{if(this._messageField.data("redactor")){return this._messageField.redactor("getText")}}return null},_success:function(b,c,a){this._previewButton.html(this._previewButtonLabel).enable();this._messageField.parent().children("small.innerError").remove();this._handleResponse(b)},_handleResponse:function(a){},_failure:function(a){if(a===null||a.returnValues===undefined||a.returnValues.errorType===undefined){return true}this._previewButton.html(this._previewButtonLabel).enable();var b=this._messageField.next("small.innerError").empty();if(!b.length){b=$('<small class="innerError" />').appendTo(this._messageField.parent())}b.html(a.returnValues.errorType);return false}});WCF.Message.DefaultPreview=WCF.Message.Preview.extend({_attachmentObjectType:null,_attachmentObjectID:null,_tmpHash:null,init:function(b,a,c){this._super("wcf\\data\\bbcode\\MessagePreviewAction","text","previewButton");this._attachmentObjectType=b||null;this._attachmentObjectID=a||null;this._tmpHash=c||null},_handleResponse:function(b){var a=$("#previewContainer");if(!a.length){a=$('<div class="container containerPadding marginTop" id="previewContainer"><fieldset><legend>'+WCF.Language.get("wcf.global.preview")+"</legend><div></div></fieldset>").prependTo($("#messageContainer")).wcfFadeIn()}a.find("div:eq(0)").html(b.returnValues.message);new WCF.Effect.Scroll().scrollTo(a)},_getParameters:function(b){var a=this._super(b);if(this._attachmentObjectType!=null){a.attachmentObjectType=this._attachmentObjectType;a.attachmentObjectID=this._attachmentObjectID;a.tmpHash=this._tmpHash}return a}});WCF.Message.Multilingualism=Class.extend({_availableLanguages:{},_languageID:0,_languageInput:null,init:function(c,d,a){this._availableLanguages=d;this._languageID=c||0;this._languageInput=$("#languageID");this._updateLabel();this._languageInput.find(".dropdownMenu > li").click($.proxy(this._click,this));if(!a){var b=this._languageInput.find(".dropdownMenu");$('<li class="dropdownDivider" />').appendTo(b);$('<li><span><span class="badge">'+this._availableLanguages[0]+"</span></span></li>").click($.proxy(this._disable,this)).appendTo(b)}this._languageInput.parents("form").submit($.proxy(this._submit,this))},_click:function(a){this._languageID=$(a.currentTarget).data("languageID");this._updateLabel()},_disable:function(){this._languageID=0;this._updateLabel()},_updateLabel:function(){this._languageInput.find(".dropdownToggle > span").text(this._availableLanguages[this._languageID])},_submit:function(){this._languageInput.next("input[name=languageID]").prop("value",this._languageID)}});WCF.Message.SmileyCategories=Class.extend({_cache:[],_proxy:null,init:function(){this._cache=[];this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$("#smilies").on("wcftabsbeforeactivate",$.proxy(this._click,this));var a=this;new WCF.PeriodicalExecuter(function(b){b.stop();a._click({},{newTab:$("#smilies > .menu li.ui-state-active")})},100)},_click:function(b,c){var a=parseInt($(c.newTab).children("a").data("smileyCategoryID"));if(a&&!WCF.inArray(a,this._cache)){this._proxy.setOption("data",{actionName:"getSmilies",className:"wcf\\data\\smiley\\category\\SmileyCategoryAction",objectIDs:[a]});this._proxy.sendRequest()}},_success:function(c,d,b){var a=parseInt(c.returnValues.smileyCategoryID);this._cache.push(a);$("#smilies-"+a).html(c.returnValues.template)}});WCF.Message.Smilies=Class.extend({_redactor:null,_wysiwygSelector:"",init:function(a){this._wysiwygSelector=a;WCF.System.Dependency.Manager.register("Redactor_"+this._wysiwygSelector,$.proxy(function(){this._redactor=$("#"+this._wysiwygSelector).redactor("getObject");$(document).on("click",".jsSmiley",$.proxy(this._smileyClick,this))},this))},_smileyClick:function(d){var b=$(d.currentTarget);var a=b.data("smileyCode");var c=b.data("smileyPath");this._redactor.insertSmiley(a,c,true)}});WCF.Message.QuickReply=Class.extend({_container:null,_messageField:null,_notification:null,_pendingSave:false,_proxy:null,_quickReplyButtons:null,_quoteManager:null,_scrollHandler:null,_successMessageNonVisible:"",init:function(c,b){this._container=$("#messageQuickReply");this._container.children(".message").addClass("jsInvalidQuoteTarget");this._messageField=$("#text");this._pendingSave=false;if(!this._container||!this._messageField){return}var a=this._container.find(".formSubmit");a.find("button[data-type=save]").click($.proxy(this._save,this));if(c){a.find("button[data-type=extended]").click($.proxy(this._prepareExtended,this))}a.find("button[data-type=cancel]").click($.proxy(this._cancel,this));if(b){this._quoteManager=b}this._quickReplyButtons=$(".jsQuickReply").data("__api",this).click($.proxy(this.click,this));this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),showLoadingOverlay:false,success:$.proxy(this._success,this)});this._scroll=new WCF.Effect.Scroll();this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.add"));this._successMessageNonVisible=""},click:function(b){this._container.toggle();if(this._container.is(":visible")){this._quickReplyButtons.hide();this._scroll.scrollTo(this._container,true);WCF.Message.Submit.registerButton("text",this._container.find(".formSubmit button[data-type=save]"));if(this._quoteManager){var a=true;if($.browser.redactor){if(this._messageField.data("redactor")){a=(!$.trim(this._messageField.redactor("getText")));this._editorCallback(a)}}else{a=(!this._messageField.val().length);this._editorCallback(a)}}}if(b!==null){b.stopPropagation();return false}},_editorCallback:function(a){if(a){this._quoteManager.insertQuotes(this._getClassName(),this._getObjectID(),$.proxy(this._insertQuotes,this))}if($.browser.redactor){this._messageField.redactor("focus")}else{this._messageField.focus()}},getContainer:function(){return this._container},_insertQuotes:function(a){if(!a.returnValues.template){return}if($.browser.redactor){this._messageField.redactor("insertDynamic",a.returnValues.template)}else{this._messageField.val(a.returnValues.template)}},_save:function(){if(this._pendingSave){return}var a="";if($.browser.redactor){a=this._messageField.redactor("getText")}else{a=$.trim(this._messageField.val())}var c=this._messageField.parent().find("small.innerError");if(a===""||a==="0"){if(!c.length){c=$('<small class="innerError" />').appendTo(this._messageField.parent())}c.html(WCF.Language.get("wcf.global.form.error.empty"));return}else{c.remove()}this._pendingSave=true;this._proxy.setOption("data",{actionName:"quickReply",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageQuickReplyAction",parameters:this._getParameters(a)});this._proxy.sendRequest();var b=this._container.find(".messageQuickReplyContent .messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(b);b.children(".redactor_box").hide().end().next().hide()},_getParameters:function(b){var a={objectID:this._getObjectID(),data:{message:b},lastPostTime:this._container.data("lastPostTime"),pageNo:this._container.data("pageNo"),removeQuoteIDs:(this._quoteManager===null?[]:this._quoteManager.getQuotesMarkedForRemoval()),tmpHash:this._container.data("tmpHash")||""};if(this._container.data("anchor")){a.anchor=this._container.data("anchor")}var c=$("#redactorMessageOptions_settings");if(c.length){a.settings={};c.find("input, textarea, select").each(function(e,f){var d=$(f);switch(d.getTagName()){case"input":switch(d.prop("type")){case"checkbox":case"radio":if(d.is(":checked")){a.settings[d.prop("name")]=d.val()}else{if(d.data("submitEmpty")){a.settings[d.prop("name")]=0}}break;default:a.settings[d.prop("name")]=d.val();break}break;default:a.settings[d.prop("name")]=d.val();break}})}return a},_cancel:function(){this._revertQuickReply(true);if($.browser.redactor){this._messageField.redactor("reset")}else{this._messageField.val("")}},_revertQuickReply:function(b){var a=this._container.find(".messageQuickReplyContent .messageBody");if(b){this._container.hide();a.children("small.innerError").remove()}a.children(".icon-spinner").remove();a.children(".redactor_box").show();a.next().show();this._quickReplyButtons.show()},_prepareExtended:function(){this._pendingSave=true;if(this._quoteManager!==null){this._quoteManager.markQuotesForRemoval()}var a="";if($.browser.redactor){a=this._messageField.redactor("getText")}else{a=this._messageField.val()}new WCF.Action.Proxy({autoSend:true,data:{actionName:"jumpToExtended",className:this._getClassName(),interfaceName:"wcf\\data\\IExtendedMessageQuickReplyAction",parameters:{containerID:this._getObjectID(),message:a}},success:function(c,d,b){window.location=c.returnValues.url}})},_success:function(c,d,b){if($.browser.redactor){this._messageField.redactor("autosavePurge")}if(c.returnValues.url){window.location=c.returnValues.url}else{if(c.returnValues.template){var a=$(""+c.returnValues.template);if(this._container.data("sortOrder")=="DESC"){a.insertAfter(this._container)}else{a.insertBefore(this._container)}this._container.data("lastPostTime",c.returnValues.lastPostTime);this._notification.show(undefined,undefined,WCF.Language.get("wcf.global.success.add"));this._updateHistory(a.wcfIdentify())}else{var a=(this._successMessageNonVisible)?this._successMessageNonVisible:"wcf.global.success.add";this._notification.show(undefined,5000,WCF.Language.get(a))}if($.browser.redactor){this._messageField.redactor("reset")}else{this._messageField.val("")}this._revertQuickReply(true);if(this._quoteManager!==null){this._quoteManager.countQuotes()}this._pendingSave=false}},_failure:function(b){this._pendingSave=false;this._revertQuickReply(false);if(b===null||b.returnValues===undefined||b.returnValues.errorType===undefined){return true}var a=this._container.find(".messageQuickReplyContent .messageBody");var c=a.children("small.innerError").empty();if(!c.length){c=$('<small class="innerError" />').appendTo(a)}c.html(b.returnValues.errorType);return false},_getClassName:function(){return""},_getObjectID:function(){return 0},_updateHistory:function(a){window.location.hash=a}});WCF.Message.InlineEditor=Class.extend({_activeElementID:"",_container:{},_containerID:0,_dropdowns:{},_messageContainerSelector:".jsMessage",_messageEditorIDPrefix:"messageEditor",_notification:null,_proxy:null,_quoteManager:null,_supportExtendedForm:false,init:function(a,c,b){this._activeElementID="";this._container={};this._containerID=parseInt(a);this._dropdowns={};this._quoteManager=b||null;this._supportExtendedForm=(c)?true:false;this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),showLoadingOverlay:false,success:$.proxy(this._success,this)});this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"));this.initContainers();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.InlineEditor",$.proxy(this.initContainers,this))},initContainers:function(){$(this._messageContainerSelector).each($.proxy(function(b,a){var e=$(a);var c=e.wcfIdentify();if(!this._container[c]){this._container[c]=e;if(e.data("canEditInline")){var d=e.find(".jsMessageEditButton:eq(0)").data("containerID",c).click($.proxy(this._clickInline,this));if(e.data("canEdit")){d.dblclick($.proxy(this._click,this))}}else{if(e.data("canEdit")){e.find(".jsMessageEditButton:eq(0)").data("containerID",c).click($.proxy(this._click,this))}}}},this))},_click:function(c,a){var b=(c===null)?a:$(c.currentTarget).data("containerID");if(this._activeElementID===""){this._activeElementID=b;this._prepare();this._proxy.setOption("data",{actionName:"beginEdit",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters:{containerID:this._containerID,objectID:this._container[b].data("objectID")}});this._proxy.setOption("failure",$.proxy(function(){this._cancel()},this));this._proxy.sendRequest()}else{var d=new WCF.System.Notification(WCF.Language.get("wcf.message.error.editorAlreadyInUse"),"warning");d.show()}if(this._dropdowns[this._container[b].data("objectID")]){this._dropdowns[this._container[b].data("objectID")].removeClass("dropdownOpen")}if(c!==null){c.stopPropagation();return false}},_clickInline:function(c){var d=$(c.currentTarget);if(!d.hasClass("dropdownToggle")){var b=d.data("containerID");d.addClass("dropdownToggle").parent().addClass("dropdown");var a=$('<ul class="dropdownMenu" />').insertAfter(d);this._initDropdownMenu(b,a);WCF.DOMNodeInsertedHandler.execute();this._dropdowns[this._container[b].data("objectID")]=a;WCF.Dropdown.registerCallback(d.parent().wcfIdentify(),$.proxy(this._toggleDropdown,this));d.trigger("click")}c.stopPropagation();return false},_failure:function(b){this._revertEditor();if(b===null||b.returnValues===undefined||b.returnValues.errorType===undefined){return true}var a=this._container[this._activeElementID].find(".messageBody .messageInlineEditor");var c=a.children("small.innerError").empty();if(!c.length){c=$('<small class="innerError" />').insertBefore(a.children(".formSubmit"))}c.html(b.returnValues.errorType);return false},_toggleDropdown:function(a,b){WCF.Dropdown.getDropdown(a).parents(".messageOptions").toggleClass("forceOpen")},_initDropdownMenu:function(a,b){},_prepare:function(){var b=this._container[this._activeElementID].find(".messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(b);var a=b.find(".messageText").hide();a.parent().children(".jsInlineEditorHideContent").hide();b.children(".attachmentThumbnailList, .attachmentFileList").hide()},_cancel:function(){var b=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget");this._destroyEditor();var a=b.find(".messageBody");a.children(".icon-spinner").remove();a.find(".messageText").show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();this._container[this._activeElementID].find(".messageOptions").removeClass("forceHidden");this._activeElementID="";if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_success:function(b,c,a){switch(b.returnValues.actionName){case"beginEdit":this._showEditor(b);break;case"save":this._showMessage(b);break}},_showEditor:function(f){this._proxy.setOption("failure",$.proxy(this._failure,this));var d=this._container[this._activeElementID].addClass("jsInvalidQuoteTarget").find(".messageBody");d.children(".icon-spinner").remove();var c=d.children("div:eq(0)");$(""+f.returnValues.template).appendTo(c);var b=c.find(".formSubmit");var e=b.find("button[data-type=save]").click($.proxy(this._save,this));if(this._supportExtendedForm){b.find("button[data-type=extended]").click($.proxy(this._prepareExtended,this))}b.find("button[data-type=cancel]").click($.proxy(this._cancel,this));WCF.Message.Submit.registerButton(this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID"),e);this._container[this._activeElementID].find(".messageOptions").addClass("forceHidden");var a=$("#"+this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID"));if($.browser.redactor){new WCF.PeriodicalExecuter($.proxy(function(g){g.stop();if(this._quoteManager){this._quoteManager.setAlternativeEditor(a)}},this),250)}else{a.focus()}},_revertEditor:function(){var a=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget").find(".messageBody");a.children("span.icon-spinner").remove();a.children("div:eq(0)").children().show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_save:function(){var c=this._container[this._activeElementID];var b=c.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+b).redactor("getText")}else{a=$("#"+this._messageEditorIDPrefix+b).val()}this._proxy.setOption("data",{actionName:"save",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters:{containerID:this._containerID,data:{message:a},objectID:b}});this._proxy.sendRequest();this._hideEditor()},_prepareExtended:function(){var c=this._container[this._activeElementID];var b=c.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+b).redactor("getText")}else{a=$("#"+this._messageEditorIDPrefix+b).val()}new WCF.Action.Proxy({autoSend:true,data:{actionName:"jumpToExtended",className:this._getClassName(),parameters:{containerID:this._containerID,message:a,messageID:b}},success:function(e,f,d){window.location=e.returnValues.url}})},_hideEditor:function(){var a=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget").find(".messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(a);a.children("div:eq(0)").children().hide();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_showMessage:function(c){var d=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget");var b=d.find(".messageBody");b.children(".icon-spinner").remove();var a=b.children("div:eq(0)");a.parent().children(".jsInlineEditorHideContent").show();this._container[this._activeElementID].find(".messageOptions").removeClass("forceHidden");this._destroyEditor();a.children(".messageText").html(c.returnValues.message).show();if(c.returnValues.attachmentList==undefined){b.children(".attachmentThumbnailList, .attachmentFileList").show()}else{b.children(".attachmentThumbnailList, .attachmentFileList").remove();if(c.returnValues.attachmentList){$(c.returnValues.attachmentList).insertAfter(b.children("div:eq(0)"))}}this._activeElementID="";this._updateHistory(this._getHash(d.data("objectID")));this._notification.show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_destroyEditor:function(){var b=this._container[this._activeElementID];if($.browser.redactor){var a=$("#"+this._messageEditorIDPrefix+b.data("objectID"));a.redactor("autosavePurge");a.redactor("destroy")}b.find(".messageBody > div > .messageInlineEditor").remove()},_getClassName:function(){return""},_getHash:function(a){return"#message"+a},_updateHistory:function(a){window.location.hash=a}});WCF.Message.Submit={_buttons:{},registerButton:function(b,a){if(!WCF.Browser.isChrome()){return}this._buttons[b]=$(a)},execute:function(a){if(!this._buttons[a]){return}this._buttons[a].trigger("click")}};WCF.Message.Quote={};WCF.Message.Quote.Handler=Class.extend({_activeContainerID:"",_className:"",_containers:{},_containerSelector:"",_copyQuote:null,_message:"",_messageBodySelector:"",_objectID:0,_objectType:"",_proxy:null,_quoteManager:null,init:function(e,d,b,a,c,f){this._className=d;if(this._className==""){console.debug("[WCF.Message.QuoteManager] Empty class name given, aborting.");return}this._objectType=b;if(this._objectType==""){console.debug("[WCF.Message.QuoteManager] Empty object type name given, aborting.");return}this._containerSelector=a;this._message="";this._messageBodySelector=c;this._messageContentSelector=f;this._objectID=0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initContainers();this._initCopyQuote();$(document).mouseup($.proxy(this._mouseUp,this));this._quoteManager=e;this._quoteManager.register(this._objectType,this);WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Quote.Handler"+b.hashCode(),$.proxy(this._initContainers,this))},_initContainers:function(){var a=this;$(this._containerSelector).each(function(c,b){var e=$(b);var d=e.wcfIdentify();if(!a._containers[d]){a._containers[d]=e;if(e.hasClass("jsInvalidQuoteTarget")){return true}if(a._messageBodySelector!==null){e=e.find(a._messageBodySelector).data("containerID",d)}e.mousedown($.proxy(a._mouseDown,a));a._containers[d].find(".jsQuoteMessage").click($.proxy(a._saveFullQuote,a))}})},_mouseDown:function(a){this._copyQuote.hide();var b=$(a.currentTarget);if(this._messageBodySelector){b=this._containers[b.data("containerID")]}if(b.hasClass("jsInvalidQuoteTarget")){this._activeContainerID="";return}this._activeContainerID=b.wcfIdentify();if($.browser.mozilla){b.find("img").each(function(){var c=$(this);c.data("__alt",c.attr("alt")).removeAttr("alt")})}},_getNodeText:function(d){var c="";for(var b=0;b<d.childNodes.length;b++){if(d.childNodes[b].nodeType==3){c+=d.childNodes[b].nodeValue}else{if(!d.childNodes[b].tagName){continue}var a=d.childNodes[b].tagName.toLowerCase();if(a==="li"){c+="\r\n"}else{if(a==="td"&&!$.browser.msie){c+="\r\n"}}c+=this._getNodeText(d.childNodes[b]);if(a==="ul"){c+="\n"}}}return c},_mouseUp:function(a){if(this._activeContainerID==""){this._copyQuote.hide();return}var i=this._containers[this._activeContainerID];var c=this._getSelectedText();var f=$.trim(c);if(f==""){this._copyQuote.hide();return}var d=null;if(this._messageBodySelector){d=this._getNodeText(i.find(this._messageContentSelector).get(0))}else{d=this._getNodeText(i.get(0))}if(this._normalize(d).indexOf(this._normalize(f))===-1){return}this._copyQuote.show();var g=this._getBoundingRectangle(i,c);var e=this._copyQuote.getDimensions("outer");var b=(g.right-g.left)/2-(e.width/2)+g.left;this._copyQuote.css({top:g.top-e.height-7+"px",left:b+"px"});this._copyQuote.hide();this._activeContainerID="";var h=this;new WCF.PeriodicalExecuter(function(j){j.stop();var k=$.trim(h._getSelectedText());if(k!=""){h._copyQuote.show();h._message=k;h._objectID=i.data("objectID");if($.browser.mozilla){i.find("img").each(function(){var l=$(this);l.attr("alt",l.data("__alt"))})}}},10)},_normalize:function(a){return a.replace(/\r?\n|\r/g,"\n").replace(/\s/g," ").replace(/\s{2,}/g," ")},_getOffset:function(c,d){c.collapse(d);var f=WCF.getRandomID();var a=document.createElement("span");a.innerHTML='<span id="'+f+'"></span>';var g=document.createDocumentFragment(),b;while(b=a.firstChild){g.appendChild(b)}c.insertNode(g);a=$("#"+f);var e=a.offset();e.top=e.top-$(window).scrollTop();a.remove();return e},_getBoundingRectangle:function(b,e){var d=null;if(document.createRange&&typeof document.createRange().getBoundingClientRect!="undefined"){if(e.rangeCount>0){var h=e.getRangeAt(0).getClientRects();var c=e.getRangeAt(0).getBoundingClientRect();var f=$(document);var a=f.scrollTop();d={left:c.left,right:c.right,top:c.top+a}}}else{if(document.selection&&document.selection.type!="Control"){var g=document.selection.createRange();d={left:g.boundingLeft,right:g.boundingRight,top:g.boundingTop}}}return d},_saveSelection:function(d){if(window.getSelection&&document.createRange){var c=window.getSelection().getRangeAt(0);var b=c.cloneRange();b.selectNodeContents(d);b.setEnd(c.startContainer,c.startOffset);var f=b.toString().length;return{start:f,end:f+c.toString().length}}else{var a=document.selection.createRange();var e=document.body.createTextRange();e.moveToElementText(d);e.setEndPoint("EndToStart",a);var f=e.text.length;return{start:f,end:f+a.text.length}}},_restoreSelection:function(j,k){if(window.getSelection&&document.createRange){var a=0,g=document.createRange();g.setStart(j,0);g.collapse(true);var f=[j],c,d=false,l=false;while(!l&&(c=f.pop())){if(c.nodeType==3){var h=a+c.length;if(!d&&k.start>=a&&k.start<=h){g.setStart(c,k.start-a);d=true}if(d&&k.end>=a&&k.end<=h){g.setEnd(c,k.end-a);l=true}a=h}else{var e=c.childNodes.length;while(e--){f.push(c.childNodes[e])}}}var b=window.getSelection();b.removeAllRanges();b.addRange(g)}else{var m=document.body.createTextRange();m.moveToElementText(j);m.collapse(true);m.moveEnd("character",k.end);m.moveStart("character",k.start);m.select()}},_initCopyQuote:function(){this._copyQuote=$("#quoteManagerCopy");if(!this._copyQuote.length){this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip"><span>'+WCF.Language.get("wcf.message.quote.quoteSelected")+'</span><span class="pointer"><span></span></span></div>').hide().appendTo(document.body);this._copyQuote.click($.proxy(this._saveQuote,this))}},_getSelectedText:function(){if(window.getSelection){return window.getSelection()}else{if(document.getSelection){return document.getSelection()}else{if(document.selection){return document.selection.createRange().text}}}return""},_saveFullQuote:function(b){var a=$(b.currentTarget);this._proxy.setOption("data",{actionName:"saveFullQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[a.data("objectID")]});this._proxy.sendRequest();if(a.data("isQuoted")){a.data("isQuoted",false).children("a").removeClass("active")}else{a.data("isQuoted",true).children("a").addClass("active")}b.stopPropagation();return false},_saveQuote:function(){this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message}});this._proxy.sendRequest()},_success:function(c,d,b){if(c.returnValues.count!==undefined){var a=(c.fullQuoteObjectIDs!==undefined)?c.fullQuoteObjectIDs:{};this._quoteManager.updateCount(c.returnValues.count,a)}},updateFullQuoteObjectIDs:function(b){for(var a in this._containers){this._containers[a].find(".jsQuoteMessage").each(function(c,d){var e=$(d).data("isQuoted",0);e.children("a").removeClass("active");if(WCF.inArray(e.data("objectID"),b)){e.data("isQuoted",1).children("a").addClass("active")}})}}});WCF.Message.Quote.Manager=Class.extend({_buttons:{},_count:0,_dialog:null,_editorElement:null,_editorElementAlternative:null,_form:null,_handlers:{},_hasTemplate:false,_insertQuotes:true,_proxy:null,_removeOnSubmit:[],_showQuotes:null,_supportPaste:false,init:function(c,a,b,d){this._buttons={insert:null,remove:null};this._count=parseInt(c)||0;this._dialog=null;this._editorElement=null;this._editorElementAlternative=null;this._form=null;this._handlers={};this._hasTemplate=false;this._insertQuotes=true;this._removeOnSubmit=[];this._showQuotes=null;this._supportPaste=false;if(a){this._editorElement=$("#"+a);if(this._editorElement.length){this._supportPaste=true;this._form=this._editorElement.parents("form:eq(0)");if(this._form.length){this._form.submit($.proxy(this._submit,this));this._removeOnSubmit=d||[]}else{this._form=null;this._supportPaste=(b===true)?true:false}}}this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this),url:"index.php/MessageQuote/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._toggleShowQuotes()},setAlternativeEditor:function(a){this._editorElementAlternative=a},clearAlternativeEditor:function(){this._editorElementAlternative=null},register:function(a,b){this._handlers[a]=b},updateCount:function(c,b){this._count=parseInt(c)||0;this._toggleShowQuotes();for(var a in this._handlers){if(b[a]){this._handlers[a].updateFullQuoteObjectIDs(b[a])}}},insertQuotes:function(a,b,c){if(!this._insertQuotes){this._insertQuotes=true;return}new WCF.Action.Proxy({autoSend:true,data:{actionName:"getRenderedQuotes",className:a,interfaceName:"wcf\\data\\IMessageQuoteAction",parameters:{parentObjectID:b}},success:c})},_toggleShowQuotes:function(){if(!this._count){if(this._showQuotes!==null){this._showQuotes.hide()}}else{if(this._showQuotes===null){this._showQuotes=$("#showQuotes");if(!this._showQuotes.length){this._showQuotes=$('<div id="showQuotes" class="balloonTooltip" />').click($.proxy(this._click,this)).appendTo(document.body)}}var a=WCF.Language.get("wcf.message.quote.showQuotes").replace(/#count#/,this._count);this._showQuotes.text(a).show()}this._hasTemplate=false},_click:function(){if(this._hasTemplate){this._dialog.wcfDialog("open")}else{this._proxy.showLoadingOverlayOnce();this._proxy.setOption("data",{actionName:"getQuotes",supportPaste:this._supportPaste});this._proxy.sendRequest()}},renderDialog:function(c){if(this._dialog===null){this._dialog=$("#messageQuoteList");if(!this._dialog.length){this._dialog=$('<div id="messageQuoteList" />').hide().appendTo(document.body)}}this._dialog.html(c);var a=$('<div class="formSubmit" />').appendTo(this._dialog);if(this._supportPaste){this._buttons.insert=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.message.quote.insertAllQuotes")+"</button>").click($.proxy(this._insertSelected,this)).appendTo(a)}this._buttons.remove=$("<button>"+WCF.Language.get("wcf.message.quote.removeAllQuotes")+"</button>").click($.proxy(this._removeSelected,this)).appendTo(a);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.quote.manageQuotes")});this._dialog.wcfDialog("render");this._hasTemplate=true;var d=this._dialog.find(".jsInsertQuote");if(this._supportPaste){d.click($.proxy(this._insertQuote,this))}else{d.hide()}this._dialog.find("input.jsCheckbox").change($.proxy(this._changeButtons,this));if(this._removeOnSubmit.length){var b=this;this._dialog.find("input.jsRemoveQuote").each(function(f,e){var g=$(e).change($.proxy(this._change,this));if(WCF.inArray(g.parent("li").attr("data-quote-id"),b._removeOnSubmit)){g.attr("checked","checked")}})}},_changeButtons:function(){if(this._dialog.find("input.jsCheckbox:checked").length){if(this._supportPaste){this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertSelectedQuotes"))}this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeSelectedQuotes"))}else{if(this._supportPaste){this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertAllQuotes"))}this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeAllQuotes"))}},_change:function(c){var d=$(c.currentTarget);var b=d.parent("li").attr("data-quote-id");if(d.prop("checked")){this._removeOnSubmit.push(b)}else{for(var a in this._removeOnSubmit){if(this._removeOnSubmit[a]==b){delete this._removeOnSubmit[a];break}}}},_insertSelected:function(){if(this._editorElementAlternative===null){var a=$(".jsQuickReply:eq(0)").data("__api");if(a&&!a.getContainer().is(":visible")){this._insertQuotes=false;a.click(null)}}if(!this._dialog.find("input.jsCheckbox:checked").length){this._dialog.find("input.jsCheckbox").prop("checked","checked")}this._dialog.find("input.jsCheckbox:checked").each($.proxy(function(c,b){this._insertQuote(null,b)},this));this._dialog.wcfDialog("close")},_insertQuote:function(a,h){if(a!==null&&this._editorElementAlternative===null){var c=$(".jsQuickReply:eq(0)").data("__api");if(c&&!c.getContainer().is(":visible")){this._insertQuotes=false;c.click(null)}}var f=(a===null)?$(h).parents("li"):$(a.currentTarget).parents("li");var i=$.trim(f.children("div.jsFullQuote").text());var e=f.parents("article.message");i="[quote='"+e.attr("data-username")+"','"+e.data("link")+"']"+i+"[/quote]";if($.browser.redactor){if(this._editorElementAlternative===null){this._editorElement.redactor("insertDynamic",i)}else{this._editorElementAlternative.redactor("insertDynamic",i)}}else{var d=(this._editorElementAlternative===null)?this._editorElement:this._editorElementAlternative;var g=d.val();i+="\n\n";if(g.length==0){d.val(i)}else{var b=d.getCaret();d.val(g.substr(0,b)+i+g.substr(b))}}this._removeOnSubmit.push(f.attr("data-quote-id"));if(a!==null){this._dialog.wcfDialog("close")}},_removeSelected:function(){if(!this._dialog.find("input.jsCheckbox:checked").length){this._dialog.find("input.jsCheckbox").prop("checked","checked")}var b=[];this._dialog.find("input.jsCheckbox:checked").each(function(e,d){b.push($(d).parents("li").attr("data-quote-id"))});if(b.length){var c=[];for(var a in this._handlers){c.push(a)}this._proxy.setOption("data",{actionName:"remove",getFullQuoteObjectIDs:this._handlers.length>0,objectTypes:c,quoteIDs:b});this._proxy.sendRequest();this._dialog.wcfDialog("close")}},_submit:function(){if(this._supportPaste&&this._removeOnSubmit.length>0){var a=this._form.find(".formSubmit");for(var b in this._removeOnSubmit){$('<input type="hidden" name="__removeQuoteIDs[]" value="'+this._removeOnSubmit[b]+'" />').appendTo(a)}}},getQuotesMarkedForRemoval:function(){return this._removeOnSubmit},markQuotesForRemoval:function(){if(this._removeOnSubmit.length){this._proxy.setOption("data",{actionName:"markForRemoval",quoteIDs:this._removeOnSubmit});this._proxy.suppressErrors();this._proxy.sendRequest()}},removeMarkedQuotes:function(){if(this._removeOnSubmit.length){this._proxy.setOption("data",{actionName:"removeMarkedQuotes",getFullQuoteObjectIDs:this._handlers.length>0});this._proxy.sendRequest()}},countQuotes:function(){var b=[];for(var a in this._handlers){b.push(a)}this._proxy.setOption("data",{actionName:"count",getFullQuoteObjectIDs:this._handlers.length>0,objectTypes:b});this._proxy.sendRequest()},_success:function(c,d,b){if(c===null){return}if(c.count!==undefined){var a=(c.fullQuoteObjectIDs!==undefined)?c.fullQuoteObjectIDs:{};this.updateCount(c.count,a)}if(c.template!==undefined){if($.trim(c.template)==""){this.updateCount(0,{})}else{this.renderDialog(c.template)}}}});WCF.Message.Share={};WCF.Message.Share.Content=Class.extend({_cache:{},_dialog:null,init:function(){this._cache={};this._dialog=null;this._initLinks();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Share.Content",$.proxy(this._initLinks,this))},_initLinks:function(){$("a.jsButtonShare").removeClass("jsButtonShare").click($.proxy(this._click,this))},_click:function(e){e.preventDefault();var a=$(e.currentTarget);var b=a.prop("href");var d=(a.data("linkTitle")?a.data("linkTitle"):b);var c=b.hashCode();if(this._cache[c]===undefined){var g=false;if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);g=true}else{this._dialog.empty()}var f=$('<fieldset><legend><label for="__sharePermalink">'+WCF.Language.get("wcf.message.share.permalink")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalink" class="long" readonly="readonly" />').attr("value",b).appendTo(f);var f=$('<fieldset><legend><label for="__sharePermalinkBBCode">'+WCF.Language.get("wcf.message.share.permalink.bbcode")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalinkBBCode" class="long" readonly="readonly" />').attr("value","[url='"+b+"']"+d+"[/url]").appendTo(f);var f=$('<fieldset><legend><label for="__sharePermalinkHTML">'+WCF.Language.get("wcf.message.share.permalink.html")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalinkHTML" class="long" readonly="readonly" />').attr("value",'<a href="'+b+'">'+WCF.String.escapeHTML(d)+"</a>").appendTo(f);this._cache[c]=this._dialog.html();if(g){this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share")})}else{this._dialog.wcfDialog("open")}}else{this._dialog.html(this._cache[c]).wcfDialog("open")}this._enableSelection()},_enableSelection:function(){var a=this._dialog.find("input").click(function(){$(this).select()});if(navigator.userAgent.match(/iP(ad|hone|od)/)){a.keydown(function(){return false}).removeAttr("readonly").click(function(){this.setSelectionRange(0,9999)})}}});WCF.Message.Share.Page=Class.extend({_ui:{},_pageDescription:"",_pageURL:"",init:function(a){this._pageDescription=encodeURIComponent($('meta[property="og:title"]').prop("content"));this._pageURL=encodeURIComponent($('meta[property="og:url"]').prop("content"));var b=$(".messageShareButtons");this._ui={facebook:b.find(".jsShareFacebook"),google:b.find(".jsShareGoogle"),reddit:b.find(".jsShareReddit"),twitter:b.find(".jsShareTwitter")};this._ui.facebook.children("a").click($.proxy(this._shareFacebook,this));this._ui.google.children("a").click($.proxy(this._shareGoogle,this));this._ui.reddit.children("a").click($.proxy(this._shareReddit,this));this._ui.twitter.children("a").click($.proxy(this._shareTwitter,this));if(a===true){this._fetchFacebook();this._fetchTwitter();this._fetchReddit()}},_share:function(c,a,b){window.open(a.replace(/{pageURL}/,this._pageURL).replace(/{text}/,this._pageDescription+(b?" "+this._pageURL:"")),"height=600,width=600")},_shareFacebook:function(){this._share("facebook","https://www.facebook.com/sharer.php?u={pageURL}&t={text}",true)},_shareGoogle:function(){this._share("google","https://plus.google.com/share?url={pageURL}",true)},_shareReddit:function(){this._share("reddit","https://ssl.reddit.com/submit?url={pageURL}",true)},_shareTwitter:function(){this._share("twitter","https://twitter.com/share?url={pageURL}&text={text}",false)},_fetchCount:function(b,d,c){var a={autoSend:true,dataType:"jsonp",showLoadingOverlay:false,success:d,suppressErrors:true,type:"GET",url:b.replace(/{pageURL}/,this._pageURL)};if(c){a.jsonp=c}new WCF.Action.Proxy(a)},_fetchFacebook:function(){this._fetchCount("https://graph.facebook.com/?id={pageURL}",$.proxy(function(a){if(a.shares){this._ui.facebook.children("span.badge").show().text(a.shares)}},this))},_fetchTwitter:function(){if(window.location.protocol.match(/^https/)){return}this._fetchCount("http://urls.api.twitter.com/1/urls/count.json?url={pageURL}",$.proxy(function(a){if(a.count){this._ui.twitter.children("span.badge").show().text(a.count)}},this))},_fetchReddit:function(){if(window.location.protocol.match(/^https/)){return}this._fetchCount("http://www.reddit.com/api/info.json?url={pageURL}",$.proxy(function(a){if(a.data.children.length){this._ui.reddit.children("span.badge").show().text(a.data.children[0].data.score)}},this),"jsonp")}});WCF.Message.UserMention=Class.extend({_caretPosition:null,_className:"wcf\\data\\user\\UserAction",_dropdown:null,_dropdownMenu:null,_itemIndex:-1,_lineHeight:null,_mentionStart:"",_redactor:null,init:function(a){this._textarea=$("#"+a);this._redactor=this._textarea.redactor("getObject");this._redactor.setOption("keyupCallback",$.proxy(this._keyup,this));this._redactor.setOption("wkeydownCallback",$.proxy(this._keydown,this));this._dropdown=this._textarea.redactor("getEditor");this._dropdownMenu=$('<ul class="dropdownMenu userSuggestionList" />').appendTo(this._textarea.parent());WCF.Dropdown.initDropdownFragment(this._dropdown,this._dropdownMenu);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_clearList:function(){this._hideList();this._dropdownMenu.empty()},_click:function(a){this._redactor.replaceRangesWith(this._caretPosition);this._setUsername($(a.currentTarget).data("username"))},_createListItem:function(c){var b=$("<li />").data("username",c.label).click($.proxy(this._click,this)).appendTo(this._dropdownMenu);var a=$("<div />").addClass("box16").appendTo(b);a.append($(c.icon).addClass("framed"));a.append($("<div />").append($("<span />").text(c.label)))},_getDropdownMenuPosition:function(){var e=getSelection().getRangeAt(0).cloneRange();var a=document.createRange();a.setStart(e.startContainer,e.startOffset-(this._mentionStart.length+1));a.setEnd(e.startContainer,e.startOffset);this._redactor.replaceRangesWith(a);var f=getSelection().getRangeAt(0);var b=f.getBoundingClientRect();var d=$(window);var c={top:Math.round(b.bottom)+d.scrollTop(),left:Math.round(b.left)+d.scrollLeft()};if(this._lineHeight===null){this._lineHeight=Math.round(b.bottom-b.top)}this._redactor.replaceRangesWith(e);this._caretPosition=e;return c},_setUsername:function(e){var c=getSelection().getRangeAt(0).cloneRange();this._redactor.bufferSet();var a=document.createRange();a.setStart(c.startContainer,c.startOffset-(this._mentionStart.length+1));a.setEnd(c.startContainer,c.startOffset);this._redactor.replaceRangesWith(a);var d=getSelection().getRangeAt(0);d.deleteContents();d.collapse(true);if(e.indexOf("'")!==-1){e=e.replace(/'/g,"''");e="'"+e+"'"}else{if(e.indexOf(" ")!==-1){e="'"+e+"'"}}var b=document.createTextNode("@"+e);d.insertNode(b);var a=document.createRange();a.setStart(b,e.length+1);a.setEnd(b,e.length+1);this._redactor.replaceRangesWith(a);this._hideList()},_getParameters:function(){return{data:{includeUserGroups:false,searchString:this._mentionStart}}},_getTextLineInFrontOfCaret:function(){if(this._redactor.getSelectionHtml().length){return""}var e=this._redactor.getSelection().getRangeAt(0);var b=e.startContainer.textContent.substr(0,e.startOffset);var a=b;b="";for(var d=0;d<a.length;d++){var c=a.charCodeAt(d).toString(16);if(c!="200b"&&!/\s/.test(a[d])){if(a[d]==="@"&&d&&/\s/.test(a[d-1])){b=""}b+=a[d]}else{b=""}}return b},_hideList:function(){this._dropdown.removeClass("dropdownOpen");this._dropdownMenu.removeClass("dropdownOpen");this._itemIndex=-1},_keydown:function(a){if(this._redactor.inPlainMode()){return true}if(this._dropdownMenu.is(":visible")){switch(a.which){case $.ui.keyCode.ENTER:a.preventDefault();this._dropdownMenu.children("li").eq(this._itemIndex).trigger("click");return false;break;case $.ui.keyCode.UP:a.preventDefault();this._selectItem(this._itemIndex-1);return false;break;case $.ui.keyCode.DOWN:a.preventDefault();this._selectItem(this._itemIndex+1);return false;break}}return true},_keyup:function(c){if(this._redactor.inPlainMode()){return true}if(c.which===$.ui.keyCode.ENTER){return}if(this._dropdownMenu.is(":visible")&&c.which in {13:1,38:1,40:1}){return}var b=this._getTextLineInFrontOfCaret();if(b){var a=b.match(/@([^,]{3,})$/);if(a){if(!a.index||b[a.index-1].match(/\s/)){this._mentionStart=a[1];this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters()});this._proxy.sendRequest()}}else{this._hideList()}}else{this._hideList()}},_selectItem:function(a){var b=this._dropdownMenu.children("li");if(a<0){a=b.length-1}else{if(a+1>b.length){a=0}}b.removeClass("dropdownNavigationItem");b.eq(a).addClass("dropdownNavigationItem");this._itemIndex=a},_showList:function(){this._dropdown.addClass("dropdownOpen");this._dropdownMenu.addClass("dropdownOpen")},_success:function(c,e,b){this._clearList(false);if($.getLength(c.returnValues)){for(var d in c.returnValues){var a=c.returnValues[d];this._createListItem(a)}this._updateSuggestionListPosition();this._showList()}},_updateSuggestionListPosition:function(){try{var b=this._getDropdownMenuPosition();b.top+=5;this._dropdownMenu.css(b);this._selectItem(0);if(b.top+this._dropdownMenu.outerHeight()+10>$(window).height()+$(document).scrollTop()){this._dropdownMenu.addClass("dropdownArrowBottom");this._dropdownMenu.css({top:b.top-this._dropdownMenu.outerHeight()-2*this._lineHeight+5})}else{this._dropdownMenu.removeClass("dropdownArrowBottom")}}catch(a){}}});
+WCF.Message={};WCF.Message.BBCode={};WCF.Message.BBCode.CodeViewer=Class.extend({_dialog:null,init:function(){this._dialog=null;this._initCodeBoxes();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.BBCode.CodeViewer",$.proxy(this._initCodeBoxes,this));WCF.DOMNodeInsertedHandler.execute()},_initCodeBoxes:function(){$(".codeBox:not(.jsCodeViewer)").each($.proxy(function(a,c){var b=$(c).addClass("jsCodeViewer");$('<span class="icon icon16 icon-copy pointer jsTooltip" title="'+WCF.Language.get("wcf.message.bbcode.code.copy")+'" />').appendTo(b.find("div > h3")).click($.proxy(this._click,this))},this))},_click:function(b){var a="";$(b.currentTarget).parents("div").next("ol").children("li").each(function(c,d){if(a){a+="\n"}a+=$(d).text().replace(/\n+$/,"")});if(this._dialog===null){this._dialog=$('<div><textarea cols="60" rows="12" readonly="readonly" /></div>').hide().appendTo(document.body);this._dialog.children("textarea").val(a);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.bbcode.code.copy")})}else{this._dialog.children("textarea").val(a);this._dialog.wcfDialog("open")}this._dialog.children("textarea").select()}});WCF.Message.FormGuard=Class.extend({init:function(){var a=$("form.jsFormGuard").removeClass("jsFormGuard").submit(function(){$(this).find(".formSubmit input[type=submit]").disable()});$(window).unload(function(){a.find(".formSubmit input[type=submit]").enable()})}});WCF.Message.Preview=Class.extend({_className:"",_messageFieldID:"",_messageField:null,_proxy:null,_previewButton:null,_previewButtonLabel:"",init:function(b,a,c){this._className=b;this._messageFieldID=$.wcfEscapeID(a);this._messageField=$("#"+this._messageFieldID);if(!this._messageField.length){console.debug("[WCF.Message.Preview] Unable to find message field identified by '"+this._messageFieldID+"'");return}c=$.wcfEscapeID(c);this._previewButton=$("#"+c);if(!this._previewButton.length){console.debug("[WCF.Message.Preview] Unable to find preview button identified by '"+c+"'");return}this._previewButton.click($.proxy(this._click,this));this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)})},_click:function(b){var a=this._getMessage();if(a===null){console.debug("[WCF.Message.Preview] Unable to access Redactor instance of '"+this._messageFieldID+"'");return}this._proxy.setOption("data",{actionName:"getMessagePreview",className:this._className,parameters:this._getParameters(a)});this._proxy.sendRequest();this._previewButtonLabel=this._previewButton.html();this._previewButton.html(WCF.Language.get("wcf.global.loading")).disable();b.stopPropagation();return false},_getParameters:function(b){var a={};$("#settings").find("input[type=checkbox]").each(function(c,e){var d=$(e);if(d.is(":checked")){a[d.prop("name")]=d.prop("value")}});return{data:{message:b},options:a}},_getMessage:function(){if(!$.browser.redactor){return this._messageField.val()}else{if(this._messageField.data("redactor")){return this._messageField.redactor("getText")}}return null},_success:function(b,c,a){this._previewButton.html(this._previewButtonLabel).enable();this._messageField.parent().children("small.innerError").remove();this._handleResponse(b)},_handleResponse:function(a){},_failure:function(a){if(a===null||a.returnValues===undefined||a.returnValues.errorType===undefined){return true}this._previewButton.html(this._previewButtonLabel).enable();var b=this._messageField.next("small.innerError").empty();if(!b.length){b=$('<small class="innerError" />').appendTo(this._messageField.parent())}b.html(a.returnValues.errorType);return false}});WCF.Message.DefaultPreview=WCF.Message.Preview.extend({_attachmentObjectType:null,_attachmentObjectID:null,_tmpHash:null,init:function(b,a,c){this._super("wcf\\data\\bbcode\\MessagePreviewAction","text","previewButton");this._attachmentObjectType=b||null;this._attachmentObjectID=a||null;this._tmpHash=c||null},_handleResponse:function(b){var a=$("#previewContainer");if(!a.length){a=$('<div class="container containerPadding marginTop" id="previewContainer"><fieldset><legend>'+WCF.Language.get("wcf.global.preview")+"</legend><div></div></fieldset>").prependTo($("#messageContainer")).wcfFadeIn()}a.find("div:eq(0)").html(b.returnValues.message);new WCF.Effect.Scroll().scrollTo(a)},_getParameters:function(b){var a=this._super(b);if(this._attachmentObjectType!=null){a.attachmentObjectType=this._attachmentObjectType;a.attachmentObjectID=this._attachmentObjectID;a.tmpHash=this._tmpHash}return a}});WCF.Message.Multilingualism=Class.extend({_availableLanguages:{},_languageID:0,_languageInput:null,init:function(c,d,a){this._availableLanguages=d;this._languageID=c||0;this._languageInput=$("#languageID");this._updateLabel();this._languageInput.find(".dropdownMenu > li").click($.proxy(this._click,this));if(!a){var b=this._languageInput.find(".dropdownMenu");$('<li class="dropdownDivider" />').appendTo(b);$('<li><span><span class="badge">'+this._availableLanguages[0]+"</span></span></li>").click($.proxy(this._disable,this)).appendTo(b)}this._languageInput.parents("form").submit($.proxy(this._submit,this))},_click:function(a){this._languageID=$(a.currentTarget).data("languageID");this._updateLabel()},_disable:function(){this._languageID=0;this._updateLabel()},_updateLabel:function(){this._languageInput.find(".dropdownToggle > span").text(this._availableLanguages[this._languageID])},_submit:function(){this._languageInput.next("input[name=languageID]").prop("value",this._languageID)}});WCF.Message.SmileyCategories=Class.extend({_cache:[],_proxy:null,_wysiwygSelector:"",init:function(a){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._wysiwygSelector=a;$("#smilies-"+this._wysiwygSelector).on("messagetabmenushow",$.proxy(this._click,this))},_click:function(b,d,e){var a=parseInt(d.activeTab.tab.data("smileyCategoryID"));if(!a){return}if(d.activeTab.container.children("ul.smileyList").length){return}if(this._cache[a]!==undefined){d.activeTab.container.html(this._cache[a])}this._proxy.setOption("data",{actionName:"getSmilies",className:"wcf\\data\\smiley\\category\\SmileyCategoryAction",objectIDs:[a]});this._proxy.sendRequest()},_success:function(c,d,b){var a=parseInt(c.returnValues.smileyCategoryID);this._cache[a]=c.returnValues.template;$("#smilies-"+this._wysiwygSelector+"-"+a).html(c.returnValues.template)}});WCF.Message.Smilies=Class.extend({_redactor:null,_wysiwygSelector:"",init:function(a){this._wysiwygSelector=a;WCF.System.Dependency.Manager.register("Redactor_"+this._wysiwygSelector,$.proxy(function(){this._redactor=$("#"+this._wysiwygSelector).redactor("getObject");$(document).on("click",".jsSmiley",$.proxy(this._smileyClick,this))},this))},_smileyClick:function(d){var b=$(d.currentTarget);var a=b.data("smileyCode");var c=b.data("smileyPath");this._redactor.insertSmiley(a,c,true)}});WCF.Message.QuickReply=Class.extend({_container:null,_messageField:null,_notification:null,_pendingSave:false,_proxy:null,_quickReplyButtons:null,_quoteManager:null,_scrollHandler:null,_successMessageNonVisible:"",init:function(c,b){this._container=$("#messageQuickReply");this._container.children(".message").addClass("jsInvalidQuoteTarget");this._messageField=$("#text");this._pendingSave=false;if(!this._container||!this._messageField){return}var a=this._container.find(".formSubmit");a.find("button[data-type=save]").click($.proxy(this._save,this));if(c){a.find("button[data-type=extended]").click($.proxy(this._prepareExtended,this))}a.find("button[data-type=cancel]").click($.proxy(this._cancel,this));if(b){this._quoteManager=b}this._quickReplyButtons=$(".jsQuickReply").data("__api",this).click($.proxy(this.click,this));this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),showLoadingOverlay:false,success:$.proxy(this._success,this)});this._scroll=new WCF.Effect.Scroll();this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.add"));this._successMessageNonVisible=""},click:function(b){this._container.toggle();if(this._container.is(":visible")){this._quickReplyButtons.hide();this._scroll.scrollTo(this._container,true);WCF.Message.Submit.registerButton("text",this._container.find(".formSubmit button[data-type=save]"));if(this._quoteManager){var a=true;if($.browser.redactor){if(this._messageField.data("redactor")){a=(!$.trim(this._messageField.redactor("getText")));this._editorCallback(a)}}else{a=(!this._messageField.val().length);this._editorCallback(a)}}}if(b!==null){b.stopPropagation();return false}},_editorCallback:function(a){if(a){this._quoteManager.insertQuotes(this._getClassName(),this._getObjectID(),$.proxy(this._insertQuotes,this))}if($.browser.redactor){this._messageField.redactor("focus")}else{this._messageField.focus()}},getContainer:function(){return this._container},_insertQuotes:function(a){if(!a.returnValues.template){return}if($.browser.redactor){this._messageField.redactor("insertDynamic",a.returnValues.template)}else{this._messageField.val(a.returnValues.template)}},_save:function(){if(this._pendingSave){return}var a="";if($.browser.redactor){a=this._messageField.redactor("getText")}else{a=$.trim(this._messageField.val())}var c=this._messageField.parent().find("small.innerError");if(a===""||a==="0"){if(!c.length){c=$('<small class="innerError" />').appendTo(this._messageField.parent())}c.html(WCF.Language.get("wcf.global.form.error.empty"));return}else{c.remove()}this._pendingSave=true;this._proxy.setOption("data",{actionName:"quickReply",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageQuickReplyAction",parameters:this._getParameters(a)});this._proxy.sendRequest();var b=this._container.find(".messageQuickReplyContent .messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(b);b.children(".redactor_box").hide().end().next().hide()},_getParameters:function(b){var a={objectID:this._getObjectID(),data:{message:b},lastPostTime:this._container.data("lastPostTime"),pageNo:this._container.data("pageNo"),removeQuoteIDs:(this._quoteManager===null?[]:this._quoteManager.getQuotesMarkedForRemoval()),tmpHash:this._container.data("tmpHash")||""};if(this._container.data("anchor")){a.anchor=this._container.data("anchor")}var c=$("#redactorMessageOptions_settings");if(c.length){a.settings={};c.find("input, textarea, select").each(function(e,f){var d=$(f);switch(d.getTagName()){case"input":switch(d.prop("type")){case"checkbox":case"radio":if(d.is(":checked")){a.settings[d.prop("name")]=d.val()}else{if(d.data("submitEmpty")){a.settings[d.prop("name")]=0}}break;default:a.settings[d.prop("name")]=d.val();break}break;default:a.settings[d.prop("name")]=d.val();break}})}return a},_cancel:function(){this._revertQuickReply(true);if($.browser.redactor){this._messageField.redactor("reset")}else{this._messageField.val("")}},_revertQuickReply:function(b){var a=this._container.find(".messageQuickReplyContent .messageBody");if(b){this._container.hide();a.children("small.innerError").remove()}a.children(".icon-spinner").remove();a.children(".redactor_box").show();a.next().show();this._quickReplyButtons.show()},_prepareExtended:function(){this._pendingSave=true;if(this._quoteManager!==null){this._quoteManager.markQuotesForRemoval()}var a="";if($.browser.redactor){a=this._messageField.redactor("getText")}else{a=this._messageField.val()}new WCF.Action.Proxy({autoSend:true,data:{actionName:"jumpToExtended",className:this._getClassName(),interfaceName:"wcf\\data\\IExtendedMessageQuickReplyAction",parameters:{containerID:this._getObjectID(),message:a}},success:function(c,d,b){window.location=c.returnValues.url}})},_success:function(c,d,b){if($.browser.redactor){this._messageField.redactor("autosavePurge")}if(c.returnValues.url){window.location=c.returnValues.url}else{if(c.returnValues.template){var a=$(""+c.returnValues.template);if(this._container.data("sortOrder")=="DESC"){a.insertAfter(this._container)}else{a.insertBefore(this._container)}this._container.data("lastPostTime",c.returnValues.lastPostTime);this._notification.show(undefined,undefined,WCF.Language.get("wcf.global.success.add"));this._updateHistory(a.wcfIdentify())}else{var a=(this._successMessageNonVisible)?this._successMessageNonVisible:"wcf.global.success.add";this._notification.show(undefined,5000,WCF.Language.get(a))}if($.browser.redactor){this._messageField.redactor("reset")}else{this._messageField.val("")}this._revertQuickReply(true);if(this._quoteManager!==null){this._quoteManager.countQuotes()}this._pendingSave=false}},_failure:function(b){this._pendingSave=false;this._revertQuickReply(false);if(b===null||b.returnValues===undefined||b.returnValues.errorType===undefined){return true}var a=this._container.find(".messageQuickReplyContent .messageBody");var c=a.children("small.innerError").empty();if(!c.length){c=$('<small class="innerError" />').appendTo(a)}c.html(b.returnValues.errorType);return false},_getClassName:function(){return""},_getObjectID:function(){return 0},_updateHistory:function(a){window.location.hash=a}});WCF.Message.InlineEditor=Class.extend({_activeElementID:"",_container:{},_containerID:0,_dropdowns:{},_messageContainerSelector:".jsMessage",_messageEditorIDPrefix:"messageEditor",_notification:null,_proxy:null,_quoteManager:null,_supportExtendedForm:false,init:function(a,c,b){this._activeElementID="";this._container={};this._containerID=parseInt(a);this._dropdowns={};this._quoteManager=b||null;this._supportExtendedForm=(c)?true:false;this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),showLoadingOverlay:false,success:$.proxy(this._success,this)});this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"));this.initContainers();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.InlineEditor",$.proxy(this.initContainers,this))},initContainers:function(){$(this._messageContainerSelector).each($.proxy(function(b,a){var e=$(a);var c=e.wcfIdentify();if(!this._container[c]){this._container[c]=e;if(e.data("canEditInline")){var d=e.find(".jsMessageEditButton:eq(0)").data("containerID",c).click($.proxy(this._clickInline,this));if(e.data("canEdit")){d.dblclick($.proxy(this._click,this))}}else{if(e.data("canEdit")){e.find(".jsMessageEditButton:eq(0)").data("containerID",c).click($.proxy(this._click,this))}}}},this))},_click:function(c,a){var b=(c===null)?a:$(c.currentTarget).data("containerID");if(this._activeElementID===""){this._activeElementID=b;this._prepare();this._proxy.setOption("data",{actionName:"beginEdit",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters:{containerID:this._containerID,objectID:this._container[b].data("objectID")}});this._proxy.setOption("failure",$.proxy(function(){this._cancel()},this));this._proxy.sendRequest()}else{var d=new WCF.System.Notification(WCF.Language.get("wcf.message.error.editorAlreadyInUse"),"warning");d.show()}if(this._dropdowns[this._container[b].data("objectID")]){this._dropdowns[this._container[b].data("objectID")].removeClass("dropdownOpen")}if(c!==null){c.stopPropagation();return false}},_clickInline:function(c){var d=$(c.currentTarget);if(!d.hasClass("dropdownToggle")){var b=d.data("containerID");d.addClass("dropdownToggle").parent().addClass("dropdown");var a=$('<ul class="dropdownMenu" />').insertAfter(d);this._initDropdownMenu(b,a);WCF.DOMNodeInsertedHandler.execute();this._dropdowns[this._container[b].data("objectID")]=a;WCF.Dropdown.registerCallback(d.parent().wcfIdentify(),$.proxy(this._toggleDropdown,this));d.trigger("click")}c.stopPropagation();return false},_failure:function(b){this._revertEditor();if(b===null||b.returnValues===undefined||b.returnValues.errorType===undefined){return true}var a=this._container[this._activeElementID].find(".messageBody .messageInlineEditor");var c=a.children("small.innerError").empty();if(!c.length){c=$('<small class="innerError" />').insertBefore(a.children(".formSubmit"))}c.html(b.returnValues.errorType);return false},_toggleDropdown:function(a,b){WCF.Dropdown.getDropdown(a).parents(".messageOptions").toggleClass("forceOpen")},_initDropdownMenu:function(a,b){},_prepare:function(){var b=this._container[this._activeElementID].find(".messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(b);var a=b.find(".messageText").hide();a.parent().children(".jsInlineEditorHideContent").hide();b.children(".attachmentThumbnailList, .attachmentFileList").hide()},_cancel:function(){var b=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget");this._destroyEditor();var a=b.find(".messageBody");a.children(".icon-spinner").remove();a.find(".messageText").show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();this._container[this._activeElementID].find(".messageOptions").removeClass("forceHidden");this._activeElementID="";if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_success:function(b,c,a){switch(b.returnValues.actionName){case"beginEdit":this._showEditor(b);break;case"save":this._showMessage(b);break}},_showEditor:function(f){this._proxy.setOption("failure",$.proxy(this._failure,this));var d=this._container[this._activeElementID].addClass("jsInvalidQuoteTarget").find(".messageBody");d.children(".icon-spinner").remove();var c=d.children("div:eq(0)");$(""+f.returnValues.template).appendTo(c);var b=c.find(".formSubmit");var e=b.find("button[data-type=save]").click($.proxy(this._save,this));if(this._supportExtendedForm){b.find("button[data-type=extended]").click($.proxy(this._prepareExtended,this))}b.find("button[data-type=cancel]").click($.proxy(this._cancel,this));WCF.Message.Submit.registerButton(this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID"),e);this._container[this._activeElementID].find(".messageOptions").addClass("forceHidden");var a=$("#"+this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID"));if($.browser.redactor){new WCF.PeriodicalExecuter($.proxy(function(g){g.stop();if(this._quoteManager){this._quoteManager.setAlternativeEditor(a)}},this),250)}else{a.focus()}},_revertEditor:function(){var a=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget").find(".messageBody");a.children("span.icon-spinner").remove();a.children("div:eq(0)").children().show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_save:function(){var c=this._container[this._activeElementID];var b=c.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+b).redactor("getText")}else{a=$("#"+this._messageEditorIDPrefix+b).val()}this._proxy.setOption("data",{actionName:"save",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters:{containerID:this._containerID,data:{message:a},objectID:b}});this._proxy.sendRequest();this._hideEditor()},_prepareExtended:function(){var c=this._container[this._activeElementID];var b=c.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+b).redactor("getText")}else{a=$("#"+this._messageEditorIDPrefix+b).val()}new WCF.Action.Proxy({autoSend:true,data:{actionName:"jumpToExtended",className:this._getClassName(),parameters:{containerID:this._containerID,message:a,messageID:b}},success:function(e,f,d){window.location=e.returnValues.url}})},_hideEditor:function(){var a=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget").find(".messageBody");$('<span class="icon icon48 icon-spinner" />').appendTo(a);a.children("div:eq(0)").children().hide();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_showMessage:function(c){var d=this._container[this._activeElementID].removeClass("jsInvalidQuoteTarget");var b=d.find(".messageBody");b.children(".icon-spinner").remove();var a=b.children("div:eq(0)");a.parent().children(".jsInlineEditorHideContent").show();this._container[this._activeElementID].find(".messageOptions").removeClass("forceHidden");this._destroyEditor();a.children(".messageText").html(c.returnValues.message).show();if(c.returnValues.attachmentList==undefined){b.children(".attachmentThumbnailList, .attachmentFileList").show()}else{b.children(".attachmentThumbnailList, .attachmentFileList").remove();if(c.returnValues.attachmentList){$(c.returnValues.attachmentList).insertAfter(b.children("div:eq(0)"))}}this._activeElementID="";this._updateHistory(this._getHash(d.data("objectID")));this._notification.show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_destroyEditor:function(){var b=this._container[this._activeElementID];if($.browser.redactor){var a=$("#"+this._messageEditorIDPrefix+b.data("objectID"));a.redactor("autosavePurge");a.redactor("destroy")}b.find(".messageBody > div > .messageInlineEditor").remove()},_getClassName:function(){return""},_getHash:function(a){return"#message"+a},_updateHistory:function(a){window.location.hash=a}});WCF.Message.Submit={_buttons:{},registerButton:function(b,a){if(!WCF.Browser.isChrome()){return}this._buttons[b]=$(a)},execute:function(a){if(!this._buttons[a]){return}this._buttons[a].trigger("click")}};WCF.Message.Quote={};WCF.Message.Quote.Handler=Class.extend({_activeContainerID:"",_className:"",_containers:{},_containerSelector:"",_copyQuote:null,_message:"",_messageBodySelector:"",_objectID:0,_objectType:"",_proxy:null,_quoteManager:null,init:function(e,d,b,a,c,f){this._className=d;if(this._className==""){console.debug("[WCF.Message.QuoteManager] Empty class name given, aborting.");return}this._objectType=b;if(this._objectType==""){console.debug("[WCF.Message.QuoteManager] Empty object type name given, aborting.");return}this._containerSelector=a;this._message="";this._messageBodySelector=c;this._messageContentSelector=f;this._objectID=0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initContainers();this._initCopyQuote();$(document).mouseup($.proxy(this._mouseUp,this));this._quoteManager=e;this._quoteManager.register(this._objectType,this);WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Quote.Handler"+b.hashCode(),$.proxy(this._initContainers,this))},_initContainers:function(){var a=this;$(this._containerSelector).each(function(c,b){var e=$(b);var d=e.wcfIdentify();if(!a._containers[d]){a._containers[d]=e;if(e.hasClass("jsInvalidQuoteTarget")){return true}if(a._messageBodySelector!==null){e=e.find(a._messageBodySelector).data("containerID",d)}e.mousedown($.proxy(a._mouseDown,a));a._containers[d].find(".jsQuoteMessage").click($.proxy(a._saveFullQuote,a))}})},_mouseDown:function(a){this._copyQuote.hide();var b=$(a.currentTarget);if(this._messageBodySelector){b=this._containers[b.data("containerID")]}if(b.hasClass("jsInvalidQuoteTarget")){this._activeContainerID="";return}this._activeContainerID=b.wcfIdentify();if($.browser.mozilla){b.find("img").each(function(){var c=$(this);c.data("__alt",c.attr("alt")).removeAttr("alt")})}},_getNodeText:function(d){var c="";for(var b=0;b<d.childNodes.length;b++){if(d.childNodes[b].nodeType==3){c+=d.childNodes[b].nodeValue}else{if(!d.childNodes[b].tagName){continue}var a=d.childNodes[b].tagName.toLowerCase();if(a==="li"){c+="\r\n"}else{if(a==="td"&&!$.browser.msie){c+="\r\n"}}c+=this._getNodeText(d.childNodes[b]);if(a==="ul"){c+="\n"}}}return c},_mouseUp:function(a){if(this._activeContainerID==""){this._copyQuote.hide();return}var i=this._containers[this._activeContainerID];var c=this._getSelectedText();var f=$.trim(c);if(f==""){this._copyQuote.hide();return}var d=null;if(this._messageBodySelector){d=this._getNodeText(i.find(this._messageContentSelector).get(0))}else{d=this._getNodeText(i.get(0))}if(this._normalize(d).indexOf(this._normalize(f))===-1){return}this._copyQuote.show();var g=this._getBoundingRectangle(i,c);var e=this._copyQuote.getDimensions("outer");var b=(g.right-g.left)/2-(e.width/2)+g.left;this._copyQuote.css({top:g.top-e.height-7+"px",left:b+"px"});this._copyQuote.hide();this._activeContainerID="";var h=this;new WCF.PeriodicalExecuter(function(j){j.stop();var k=$.trim(h._getSelectedText());if(k!=""){h._copyQuote.show();h._message=k;h._objectID=i.data("objectID");if($.browser.mozilla){i.find("img").each(function(){var l=$(this);l.attr("alt",l.data("__alt"))})}}},10)},_normalize:function(a){return a.replace(/\r?\n|\r/g,"\n").replace(/\s/g," ").replace(/\s{2,}/g," ")},_getOffset:function(c,d){c.collapse(d);var f=WCF.getRandomID();var a=document.createElement("span");a.innerHTML='<span id="'+f+'"></span>';var g=document.createDocumentFragment(),b;while(b=a.firstChild){g.appendChild(b)}c.insertNode(g);a=$("#"+f);var e=a.offset();e.top=e.top-$(window).scrollTop();a.remove();return e},_getBoundingRectangle:function(b,e){var d=null;if(document.createRange&&typeof document.createRange().getBoundingClientRect!="undefined"){if(e.rangeCount>0){var h=e.getRangeAt(0).getClientRects();var c=e.getRangeAt(0).getBoundingClientRect();var f=$(document);var a=f.scrollTop();d={left:c.left,right:c.right,top:c.top+a}}}else{if(document.selection&&document.selection.type!="Control"){var g=document.selection.createRange();d={left:g.boundingLeft,right:g.boundingRight,top:g.boundingTop}}}return d},_saveSelection:function(d){if(window.getSelection&&document.createRange){var c=window.getSelection().getRangeAt(0);var b=c.cloneRange();b.selectNodeContents(d);b.setEnd(c.startContainer,c.startOffset);var f=b.toString().length;return{start:f,end:f+c.toString().length}}else{var a=document.selection.createRange();var e=document.body.createTextRange();e.moveToElementText(d);e.setEndPoint("EndToStart",a);var f=e.text.length;return{start:f,end:f+a.text.length}}},_restoreSelection:function(j,k){if(window.getSelection&&document.createRange){var a=0,g=document.createRange();g.setStart(j,0);g.collapse(true);var f=[j],c,d=false,l=false;while(!l&&(c=f.pop())){if(c.nodeType==3){var h=a+c.length;if(!d&&k.start>=a&&k.start<=h){g.setStart(c,k.start-a);d=true}if(d&&k.end>=a&&k.end<=h){g.setEnd(c,k.end-a);l=true}a=h}else{var e=c.childNodes.length;while(e--){f.push(c.childNodes[e])}}}var b=window.getSelection();b.removeAllRanges();b.addRange(g)}else{var m=document.body.createTextRange();m.moveToElementText(j);m.collapse(true);m.moveEnd("character",k.end);m.moveStart("character",k.start);m.select()}},_initCopyQuote:function(){this._copyQuote=$("#quoteManagerCopy");if(!this._copyQuote.length){this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip"><span>'+WCF.Language.get("wcf.message.quote.quoteSelected")+'</span><span class="pointer"><span></span></span></div>').hide().appendTo(document.body);this._copyQuote.click($.proxy(this._saveQuote,this))}},_getSelectedText:function(){if(window.getSelection){return window.getSelection()}else{if(document.getSelection){return document.getSelection()}else{if(document.selection){return document.selection.createRange().text}}}return""},_saveFullQuote:function(b){var a=$(b.currentTarget);this._proxy.setOption("data",{actionName:"saveFullQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[a.data("objectID")]});this._proxy.sendRequest();if(a.data("isQuoted")){a.data("isQuoted",false).children("a").removeClass("active")}else{a.data("isQuoted",true).children("a").addClass("active")}b.stopPropagation();return false},_saveQuote:function(){this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message}});this._proxy.sendRequest()},_success:function(c,d,b){if(c.returnValues.count!==undefined){var a=(c.fullQuoteObjectIDs!==undefined)?c.fullQuoteObjectIDs:{};this._quoteManager.updateCount(c.returnValues.count,a)}},updateFullQuoteObjectIDs:function(b){for(var a in this._containers){this._containers[a].find(".jsQuoteMessage").each(function(c,d){var e=$(d).data("isQuoted",0);e.children("a").removeClass("active");if(WCF.inArray(e.data("objectID"),b)){e.data("isQuoted",1).children("a").addClass("active")}})}}});WCF.Message.Quote.Manager=Class.extend({_buttons:{},_count:0,_dialog:null,_editorElement:null,_editorElementAlternative:null,_form:null,_handlers:{},_hasTemplate:false,_insertQuotes:true,_proxy:null,_removeOnSubmit:[],_showQuotes:null,_supportPaste:false,init:function(c,a,b,d){this._buttons={insert:null,remove:null};this._count=parseInt(c)||0;this._dialog=null;this._editorElement=null;this._editorElementAlternative=null;this._form=null;this._handlers={};this._hasTemplate=false;this._insertQuotes=true;this._removeOnSubmit=[];this._showQuotes=null;this._supportPaste=false;if(a){this._editorElement=$("#"+a);if(this._editorElement.length){this._supportPaste=true;this._form=this._editorElement.parents("form:eq(0)");if(this._form.length){this._form.submit($.proxy(this._submit,this));this._removeOnSubmit=d||[]}else{this._form=null;this._supportPaste=(b===true)?true:false}}}this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this),url:"index.php/MessageQuote/?t="+SECURITY_TOKEN+SID_ARG_2ND});this._toggleShowQuotes()},setAlternativeEditor:function(a){this._editorElementAlternative=a},clearAlternativeEditor:function(){this._editorElementAlternative=null},register:function(a,b){this._handlers[a]=b},updateCount:function(c,b){this._count=parseInt(c)||0;this._toggleShowQuotes();for(var a in this._handlers){if(b[a]){this._handlers[a].updateFullQuoteObjectIDs(b[a])}}},insertQuotes:function(a,b,c){if(!this._insertQuotes){this._insertQuotes=true;return}new WCF.Action.Proxy({autoSend:true,data:{actionName:"getRenderedQuotes",className:a,interfaceName:"wcf\\data\\IMessageQuoteAction",parameters:{parentObjectID:b}},success:c})},_toggleShowQuotes:function(){if(!this._count){if(this._showQuotes!==null){this._showQuotes.hide()}}else{if(this._showQuotes===null){this._showQuotes=$("#showQuotes");if(!this._showQuotes.length){this._showQuotes=$('<div id="showQuotes" class="balloonTooltip" />').click($.proxy(this._click,this)).appendTo(document.body)}}var a=WCF.Language.get("wcf.message.quote.showQuotes").replace(/#count#/,this._count);this._showQuotes.text(a).show()}this._hasTemplate=false},_click:function(){if(this._hasTemplate){this._dialog.wcfDialog("open")}else{this._proxy.showLoadingOverlayOnce();this._proxy.setOption("data",{actionName:"getQuotes",supportPaste:this._supportPaste});this._proxy.sendRequest()}},renderDialog:function(c){if(this._dialog===null){this._dialog=$("#messageQuoteList");if(!this._dialog.length){this._dialog=$('<div id="messageQuoteList" />').hide().appendTo(document.body)}}this._dialog.html(c);var a=$('<div class="formSubmit" />').appendTo(this._dialog);if(this._supportPaste){this._buttons.insert=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.message.quote.insertAllQuotes")+"</button>").click($.proxy(this._insertSelected,this)).appendTo(a)}this._buttons.remove=$("<button>"+WCF.Language.get("wcf.message.quote.removeAllQuotes")+"</button>").click($.proxy(this._removeSelected,this)).appendTo(a);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.quote.manageQuotes")});this._dialog.wcfDialog("render");this._hasTemplate=true;var d=this._dialog.find(".jsInsertQuote");if(this._supportPaste){d.click($.proxy(this._insertQuote,this))}else{d.hide()}this._dialog.find("input.jsCheckbox").change($.proxy(this._changeButtons,this));if(this._removeOnSubmit.length){var b=this;this._dialog.find("input.jsRemoveQuote").each(function(f,e){var g=$(e).change($.proxy(this._change,this));if(WCF.inArray(g.parent("li").attr("data-quote-id"),b._removeOnSubmit)){g.attr("checked","checked")}})}},_changeButtons:function(){if(this._dialog.find("input.jsCheckbox:checked").length){if(this._supportPaste){this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertSelectedQuotes"))}this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeSelectedQuotes"))}else{if(this._supportPaste){this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertAllQuotes"))}this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeAllQuotes"))}},_change:function(c){var d=$(c.currentTarget);var b=d.parent("li").attr("data-quote-id");if(d.prop("checked")){this._removeOnSubmit.push(b)}else{for(var a in this._removeOnSubmit){if(this._removeOnSubmit[a]==b){delete this._removeOnSubmit[a];break}}}},_insertSelected:function(){if(this._editorElementAlternative===null){var a=$(".jsQuickReply:eq(0)").data("__api");if(a&&!a.getContainer().is(":visible")){this._insertQuotes=false;a.click(null)}}if(!this._dialog.find("input.jsCheckbox:checked").length){this._dialog.find("input.jsCheckbox").prop("checked","checked")}this._dialog.find("input.jsCheckbox:checked").each($.proxy(function(c,b){this._insertQuote(null,b)},this));this._dialog.wcfDialog("close")},_insertQuote:function(a,h){if(a!==null&&this._editorElementAlternative===null){var c=$(".jsQuickReply:eq(0)").data("__api");if(c&&!c.getContainer().is(":visible")){this._insertQuotes=false;c.click(null)}}var f=(a===null)?$(h).parents("li"):$(a.currentTarget).parents("li");var i=$.trim(f.children("div.jsFullQuote").text());var e=f.parents("article.message");i="[quote='"+e.attr("data-username")+"','"+e.data("link")+"']"+i+"[/quote]";if($.browser.redactor){if(this._editorElementAlternative===null){this._editorElement.redactor("insertDynamic",i)}else{this._editorElementAlternative.redactor("insertDynamic",i)}}else{var d=(this._editorElementAlternative===null)?this._editorElement:this._editorElementAlternative;var g=d.val();i+="\n\n";if(g.length==0){d.val(i)}else{var b=d.getCaret();d.val(g.substr(0,b)+i+g.substr(b))}}this._removeOnSubmit.push(f.attr("data-quote-id"));if(a!==null){this._dialog.wcfDialog("close")}},_removeSelected:function(){if(!this._dialog.find("input.jsCheckbox:checked").length){this._dialog.find("input.jsCheckbox").prop("checked","checked")}var b=[];this._dialog.find("input.jsCheckbox:checked").each(function(e,d){b.push($(d).parents("li").attr("data-quote-id"))});if(b.length){var c=[];for(var a in this._handlers){c.push(a)}this._proxy.setOption("data",{actionName:"remove",getFullQuoteObjectIDs:this._handlers.length>0,objectTypes:c,quoteIDs:b});this._proxy.sendRequest();this._dialog.wcfDialog("close")}},_submit:function(){if(this._supportPaste&&this._removeOnSubmit.length>0){var a=this._form.find(".formSubmit");for(var b in this._removeOnSubmit){$('<input type="hidden" name="__removeQuoteIDs[]" value="'+this._removeOnSubmit[b]+'" />').appendTo(a)}}},getQuotesMarkedForRemoval:function(){return this._removeOnSubmit},markQuotesForRemoval:function(){if(this._removeOnSubmit.length){this._proxy.setOption("data",{actionName:"markForRemoval",quoteIDs:this._removeOnSubmit});this._proxy.suppressErrors();this._proxy.sendRequest()}},removeMarkedQuotes:function(){if(this._removeOnSubmit.length){this._proxy.setOption("data",{actionName:"removeMarkedQuotes",getFullQuoteObjectIDs:this._handlers.length>0});this._proxy.sendRequest()}},countQuotes:function(){var b=[];for(var a in this._handlers){b.push(a)}this._proxy.setOption("data",{actionName:"count",getFullQuoteObjectIDs:this._handlers.length>0,objectTypes:b});this._proxy.sendRequest()},_success:function(c,d,b){if(c===null){return}if(c.count!==undefined){var a=(c.fullQuoteObjectIDs!==undefined)?c.fullQuoteObjectIDs:{};this.updateCount(c.count,a)}if(c.template!==undefined){if($.trim(c.template)==""){this.updateCount(0,{})}else{this.renderDialog(c.template)}}}});WCF.Message.Share={};WCF.Message.Share.Content=Class.extend({_cache:{},_dialog:null,init:function(){this._cache={};this._dialog=null;this._initLinks();WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Share.Content",$.proxy(this._initLinks,this))},_initLinks:function(){$("a.jsButtonShare").removeClass("jsButtonShare").click($.proxy(this._click,this))},_click:function(e){e.preventDefault();var a=$(e.currentTarget);var b=a.prop("href");var d=(a.data("linkTitle")?a.data("linkTitle"):b);var c=b.hashCode();if(this._cache[c]===undefined){var g=false;if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);g=true}else{this._dialog.empty()}var f=$('<fieldset><legend><label for="__sharePermalink">'+WCF.Language.get("wcf.message.share.permalink")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalink" class="long" readonly="readonly" />').attr("value",b).appendTo(f);var f=$('<fieldset><legend><label for="__sharePermalinkBBCode">'+WCF.Language.get("wcf.message.share.permalink.bbcode")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalinkBBCode" class="long" readonly="readonly" />').attr("value","[url='"+b+"']"+d+"[/url]").appendTo(f);var f=$('<fieldset><legend><label for="__sharePermalinkHTML">'+WCF.Language.get("wcf.message.share.permalink.html")+"</label></legend></fieldset>").appendTo(this._dialog);$('<input type="text" id="__sharePermalinkHTML" class="long" readonly="readonly" />').attr("value",'<a href="'+b+'">'+WCF.String.escapeHTML(d)+"</a>").appendTo(f);this._cache[c]=this._dialog.html();if(g){this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share")})}else{this._dialog.wcfDialog("open")}}else{this._dialog.html(this._cache[c]).wcfDialog("open")}this._enableSelection()},_enableSelection:function(){var a=this._dialog.find("input").click(function(){$(this).select()});if(navigator.userAgent.match(/iP(ad|hone|od)/)){a.keydown(function(){return false}).removeAttr("readonly").click(function(){this.setSelectionRange(0,9999)})}}});WCF.Message.Share.Page=Class.extend({_ui:{},_pageDescription:"",_pageURL:"",init:function(a){this._pageDescription=encodeURIComponent($('meta[property="og:title"]').prop("content"));this._pageURL=encodeURIComponent($('meta[property="og:url"]').prop("content"));var b=$(".messageShareButtons");this._ui={facebook:b.find(".jsShareFacebook"),google:b.find(".jsShareGoogle"),reddit:b.find(".jsShareReddit"),twitter:b.find(".jsShareTwitter")};this._ui.facebook.children("a").click($.proxy(this._shareFacebook,this));this._ui.google.children("a").click($.proxy(this._shareGoogle,this));this._ui.reddit.children("a").click($.proxy(this._shareReddit,this));this._ui.twitter.children("a").click($.proxy(this._shareTwitter,this));if(a===true){this._fetchFacebook();this._fetchTwitter();this._fetchReddit()}},_share:function(c,a,b){window.open(a.replace(/{pageURL}/,this._pageURL).replace(/{text}/,this._pageDescription+(b?" "+this._pageURL:"")),"height=600,width=600")},_shareFacebook:function(){this._share("facebook","https://www.facebook.com/sharer.php?u={pageURL}&t={text}",true)},_shareGoogle:function(){this._share("google","https://plus.google.com/share?url={pageURL}",true)},_shareReddit:function(){this._share("reddit","https://ssl.reddit.com/submit?url={pageURL}",true)},_shareTwitter:function(){this._share("twitter","https://twitter.com/share?url={pageURL}&text={text}",false)},_fetchCount:function(b,d,c){var a={autoSend:true,dataType:"jsonp",showLoadingOverlay:false,success:d,suppressErrors:true,type:"GET",url:b.replace(/{pageURL}/,this._pageURL)};if(c){a.jsonp=c}new WCF.Action.Proxy(a)},_fetchFacebook:function(){this._fetchCount("https://graph.facebook.com/?id={pageURL}",$.proxy(function(a){if(a.shares){this._ui.facebook.children("span.badge").show().text(a.shares)}},this))},_fetchTwitter:function(){if(window.location.protocol.match(/^https/)){return}this._fetchCount("http://urls.api.twitter.com/1/urls/count.json?url={pageURL}",$.proxy(function(a){if(a.count){this._ui.twitter.children("span.badge").show().text(a.count)}},this))},_fetchReddit:function(){if(window.location.protocol.match(/^https/)){return}this._fetchCount("http://www.reddit.com/api/info.json?url={pageURL}",$.proxy(function(a){if(a.data.children.length){this._ui.reddit.children("span.badge").show().text(a.data.children[0].data.score)}},this),"jsonp")}});WCF.Message.UserMention=Class.extend({_caretPosition:null,_className:"wcf\\data\\user\\UserAction",_dropdown:null,_dropdownMenu:null,_itemIndex:-1,_lineHeight:null,_mentionStart:"",_redactor:null,init:function(a){this._textarea=$("#"+a);this._redactor=this._textarea.redactor("getObject");this._redactor.setOption("keyupCallback",$.proxy(this._keyup,this));this._redactor.setOption("wkeydownCallback",$.proxy(this._keydown,this));this._dropdown=this._textarea.redactor("getEditor");this._dropdownMenu=$('<ul class="dropdownMenu userSuggestionList" />').appendTo(this._textarea.parent());WCF.Dropdown.initDropdownFragment(this._dropdown,this._dropdownMenu);this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},_clearList:function(){this._hideList();this._dropdownMenu.empty()},_click:function(a){this._redactor.replaceRangesWith(this._caretPosition);this._setUsername($(a.currentTarget).data("username"))},_createListItem:function(c){var b=$("<li />").data("username",c.label).click($.proxy(this._click,this)).appendTo(this._dropdownMenu);var a=$("<div />").addClass("box16").appendTo(b);a.append($(c.icon).addClass("framed"));a.append($("<div />").append($("<span />").text(c.label)))},_getDropdownMenuPosition:function(){var e=getSelection().getRangeAt(0).cloneRange();var a=document.createRange();a.setStart(e.startContainer,e.startOffset-(this._mentionStart.length+1));a.setEnd(e.startContainer,e.startOffset);this._redactor.replaceRangesWith(a);var f=getSelection().getRangeAt(0);var b=f.getBoundingClientRect();var d=$(window);var c={top:Math.round(b.bottom)+d.scrollTop(),left:Math.round(b.left)+d.scrollLeft()};if(this._lineHeight===null){this._lineHeight=Math.round(b.bottom-b.top)}this._redactor.replaceRangesWith(e);this._caretPosition=e;return c},_setUsername:function(e){var c=getSelection().getRangeAt(0).cloneRange();this._redactor.bufferSet();var a=document.createRange();a.setStart(c.startContainer,c.startOffset-(this._mentionStart.length+1));a.setEnd(c.startContainer,c.startOffset);this._redactor.replaceRangesWith(a);var d=getSelection().getRangeAt(0);d.deleteContents();d.collapse(true);if(e.indexOf("'")!==-1){e=e.replace(/'/g,"''");e="'"+e+"'"}else{if(e.indexOf(" ")!==-1){e="'"+e+"'"}}var b=document.createTextNode("@"+e);d.insertNode(b);var a=document.createRange();a.setStart(b,e.length+1);a.setEnd(b,e.length+1);this._redactor.replaceRangesWith(a);this._hideList()},_getParameters:function(){return{data:{includeUserGroups:false,searchString:this._mentionStart}}},_getTextLineInFrontOfCaret:function(){if(this._redactor.getSelectionHtml().length){return""}var e=this._redactor.getSelection().getRangeAt(0);var b=e.startContainer.textContent.substr(0,e.startOffset);var a=b;b="";for(var d=0;d<a.length;d++){var c=a.charCodeAt(d).toString(16);if(c!="200b"&&!/\s/.test(a[d])){if(a[d]==="@"&&d&&/\s/.test(a[d-1])){b=""}b+=a[d]}else{b=""}}return b},_hideList:function(){this._dropdown.removeClass("dropdownOpen");this._dropdownMenu.removeClass("dropdownOpen");this._itemIndex=-1},_keydown:function(a){if(this._redactor.inPlainMode()){return true}if(this._dropdownMenu.is(":visible")){switch(a.which){case $.ui.keyCode.ENTER:a.preventDefault();this._dropdownMenu.children("li").eq(this._itemIndex).trigger("click");return false;break;case $.ui.keyCode.UP:a.preventDefault();this._selectItem(this._itemIndex-1);return false;break;case $.ui.keyCode.DOWN:a.preventDefault();this._selectItem(this._itemIndex+1);return false;break}}return true},_keyup:function(c){if(this._redactor.inPlainMode()){return true}if(c.which===$.ui.keyCode.ENTER){return}if(this._dropdownMenu.is(":visible")&&c.which in {13:1,38:1,40:1}){return}var b=this._getTextLineInFrontOfCaret();if(b){var a=b.match(/@([^,]{3,})$/);if(a){if(!a.index||b[a.index-1].match(/\s/)){this._mentionStart=a[1];this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters()});this._proxy.sendRequest()}}else{this._hideList()}}else{this._hideList()}},_selectItem:function(a){var b=this._dropdownMenu.children("li");if(a<0){a=b.length-1}else{if(a+1>b.length){a=0}}b.removeClass("dropdownNavigationItem");b.eq(a).addClass("dropdownNavigationItem");this._itemIndex=a},_showList:function(){this._dropdown.addClass("dropdownOpen");this._dropdownMenu.addClass("dropdownOpen")},_success:function(c,e,b){this._clearList(false);if($.getLength(c.returnValues)){for(var d in c.returnValues){var a=c.returnValues[d];this._createListItem(a)}this._updateSuggestionListPosition();this._showList()}},_updateSuggestionListPosition:function(){try{var b=this._getDropdownMenuPosition();b.top+=5;this._dropdownMenu.css(b);this._selectItem(0);if(b.top+this._dropdownMenu.outerHeight()+10>$(window).height()+$(document).scrollTop()){this._dropdownMenu.addClass("dropdownArrowBottom");this._dropdownMenu.css({top:b.top-this._dropdownMenu.outerHeight()-2*this._lineHeight+5})}else{this._dropdownMenu.removeClass("dropdownArrowBottom")}}catch(a){}}});$.widget("wcf.messageTabMenu",{_tabs:[],_tabsByName:{},options:{collapsible:true},_create:function(){var c=this.element.find("> nav > ul > li");var b=this.element.find("> div, > fieldset");if(c.length!=b.length){console.debug("[wcf.messageTabMenu] Amount of tabs does not equal amount of tab containers, aborting.");return}var a=this.element.data("preselect");this._tabs=[];this._tabsByName={};for(var g=0;g<c.length;g++){var f=$(c[g]);var d=$(b[g]);var h=f.data("name");if(h===undefined){var i=f.children("a").prop("href");if(i!==undefined){if(i.match(/#([a-zA-Z_-]+)$/)){h=RegExp.$1}}if(h===undefined){h=f.wcfIdentify();console.debug("[wcf.messageTabMenu] Missing name attribute, assuming generic ID '"+h+"'")}}this._tabs.push({container:d,name:h,tab:f});this._tabsByName[h]=g;var j=f.children("a").data("index",g).click($.proxy(this._showTab,this));if(a==h){j.trigger("click")}}if(a===true){this._tabs[0].tab.children("a").trigger("click")}var e=this.element.data("collapsible");if(e!==undefined){this.options.collapsible=e}},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);this.element.remove()},_showTab:function(f,c,d){var b=(f===null)?c:$(f.currentTarget).data("index");d=(!this.options.collapsible||d===true)?true:false;var a=null;for(var g=0;g<this._tabs.length;g++){var e=this._tabs[g];if(g==b){if(!e.tab.hasClass("active")){e.tab.addClass("active");e.container.addClass("active");a=e;continue}else{if(d===true){continue}}}e.tab.removeClass("active");e.container.removeClass("active")}if(f!==null){f.preventDefault();f.stopPropagation()}if(a!==null){this._trigger("show",{},{activeTab:a})}},showTab:function(a,b){if(!$.isNumeric(a)){if(this._tabsByName[a]!==undefined){a=this._tabsByName[a]}}if(this._tabs[a]===undefined){console.debug("[wcf.messageTabMenu] Cannot locate tab identified by '"+a+"'");return}this._showTab(null,a,b)},getTab:function(a){if(this._tabsByName[a]!==undefined){return this._tabs[this._tabsByName[a]].tab}return null},getContainer:function(a){if(this._tabsByName[a]!==undefined){return this._tabs[this._tabsByName[a]].container}return null}});
// WCF.Moderation.js
WCF.Moderation={};WCF.Moderation.Management=Class.extend({_buttonSelector:"",_className:"",_confirmationTemplate:{},_languageItem:"",_proxy:null,_queueID:0,_redirectURL:"",init:function(a,c,b){if(!this._buttonSelector){console.debug("[WCF.Moderation.Management] Missing button selector, aborting.");return}else{if(!this._className){console.debug("[WCF.Moderation.Management] Missing class name, aborting.");return}}this._queueID=a;this._redirectURL=c;this._languageItem=b;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});$(this._buttonSelector).click($.proxy(this._click,this))},_click:function(c){var b=$(c.currentTarget).wcfIdentify();var a="";if(this._confirmationTemplate[b]){a=this._confirmationTemplate[b]}WCF.System.Confirmation.show(WCF.Language.get(this._languageItem.replace(/{actionName}/,b)),$.proxy(function(e){if(e==="confirm"){var d={actionName:b,className:this._className,objectIDs:[this._queueID]};if(this._confirmationTemplate[b]){d.parameters={};a.find("input, textarea").each(function(g,i){var f=$(i);var h=f.val();if(f.getTagName()==="input"&&f.attr("type")==="checkbox"){if(!f.is(":checked")){h=null}}if(h!==null){d.parameters[f.attr("name")]=h}})}this._proxy.setOption("data",d);this._proxy.sendRequest();$(this._buttonSelector).disable()}},this),{},a)},_success:function(c,e,b){var d=new WCF.System.Notification(WCF.Language.get("wcf.global.success"));var a=this;d.show(function(){window.location=a._redirectURL})}});WCF.Moderation.Activation={};WCF.Moderation.Activation.Management=WCF.Moderation.Management.extend({init:function(a,b){this._buttonSelector="#enableContent, #removeContent";this._className="wcf\\data\\moderation\\queue\\ModerationQueueActivationAction";this._super(a,b,"wcf.moderation.activation.{actionName}.confirmMessage")}});WCF.Moderation.Report={};WCF.Moderation.Report.Content=Class.extend({_buttons:{},_buttonSelector:"",_dialog:null,_notification:null,_objectID:0,_objectType:"",_proxy:null,init:function(a,b){this._objectType=a;this._buttonSelector=b;this._buttons={};this._notification=null;this._objectID=0;this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initButtons();WCF.DOMNodeInsertedHandler.addCallback("WCF.Moderation.Report"+this._objectType.hashCode(),$.proxy(this._initButtons,this))},_initButtons:function(){var a=this;$(this._buttonSelector).each(function(c,d){var e=$(d);var b=e.wcfIdentify();if(!a._buttons[b]){a._buttons[b]=e;e.click($.proxy(a._click,a))}})},_click:function(a){this._objectID=$(a.currentTarget).data("objectID");this._proxy.setOption("data",{actionName:"prepareReport",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{objectID:this._objectID,objectType:this._objectType}});this._proxy.sendRequest()},_success:function(b,c,a){if(b.returnValues.reported){if(this._notification===null){this._notification=new WCF.System.Notification(WCF.Language.get("wcf.moderation.report.success"))}this._dialog.wcfDialog("close");this._notification.show()}else{if(b.returnValues.template){this._showDialog(b.returnValues.template);if(!b.returnValues.alreadyReported){this._dialog.find(".jsSubmitReport").click($.proxy(this._submit,this))}}}},_showDialog:function(a){if(this._dialog===null){this._dialog=$("#moderationReport");if(!this._dialog.length){this._dialog=$('<div id="moderationReport" />').hide().appendTo(document.body)}}this._dialog.html(a).wcfDialog({title:WCF.Language.get("wcf.moderation.report.reportContent")}).wcfDialog("render")},_submit:function(){var a=this._dialog.find(".jsReportMessage").val();if(a==""){this._dialog.find("fieldset > dl").addClass("formError");if(!this._dialog.find(".innerError").length){this._dialog.find(".jsReportMessage").after($('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>"))}return}this._proxy.setOption("data",{actionName:"report",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{message:a,objectID:this._objectID,objectType:this._objectType}});this._proxy.sendRequest()}});WCF.Moderation.Report.Management=WCF.Moderation.Management.extend({init:function(a,b){this._buttonSelector="#removeContent, #removeReport";this._className="wcf\\data\\moderation\\queue\\ModerationQueueReportAction";this._super(a,b,"wcf.moderation.report.{actionName}.confirmMessage");this._confirmationTemplate.removeContent=$('<fieldset><dl><dt><label for="message">'+WCF.Language.get("wcf.moderation.report.removeContent.reason")+'</label></dt><dd><textarea name="message" id="message" cols="40" rows="3" /></dd></dl></fieldset>')}});WCF.Moderation.UserPanel=WCF.UserPanel.extend({_showAllLink:"",_deletedContentLink:"",init:function(a,b){this._noItems="wcf.moderation.noMoreItems";this._showAllLink=a;this._deletedContentLink=b;this._super("outstandingModeration")},_addDefaultItems:function(a){this._addDivider(a);$('<li><a href="'+this._showAllLink+'">'+WCF.Language.get("wcf.moderation.showAll")+"</a></li>").appendTo(a);this._addDivider(a);$('<li><a href="'+this._deletedContentLink+'">'+WCF.Language.get("wcf.moderation.showDeletedContent")+"</a></li>").appendTo(a)},_getParameters:function(){return{actionName:"getOutstandingQueues",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"}}});