Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Tue, 20 Jan 2015 17:21:56 +0000 (18:21 +0100)
committerwoltlab.com <woltlab@woltlab.com>
Tue, 20 Jan 2015 17:21:56 +0000 (18:21 +0100)
wcfsetup/install/files/js/WCF.Combined.min.js

index 50650604a0735f4e7c749f3d3ab3536a6a1e6b6d..5df94bbda416247989f514528063fb2595bcc5bb 100755 (executable)
@@ -88,7 +88,7 @@ window.matchMedia||(window.matchMedia=function(){var c=window.styleMedia||window
 (function (window, undefined) {"use strict";WCF.ACL={};WCF.ACL.List=Class.extend({_categoryName:"",_container:null,_containerElements:{},_objectID:0,_objectTypeID:null,_options:{},_proxy:null,_search:null,_values:{group:{},user:{}},init:function(g,i,d,b,c,j){this._objectID=b||0;this._objectTypeID=i;this._categoryName=d;if(c===undefined){c=true}this._values={group:{},user:{}};this._proxy=new WCF.Action.Proxy({showLoadingOverlay:false,success:$.proxy(this._success,this)});this._container=$(g).hide().addClass("aclContainer");var f=this._container.children("dd");var a=$('<ul class="aclList container" />').appendTo(f);var k=$('<input type="text" class="long" placeholder="'+WCF.Language.get("wcf.acl.search."+(!c?"user.":"")+"description")+'" />').appendTo(f);var e=$('<ul class="aclPermissionList container" />').hide().appendTo(f);this._containerElements={aclList:a,denyAll:null,grantAll:null,permissionList:e,searchInput:k};this._search=new WCF.Search.User(k,$.proxy(this.addObject,this),c);var l=this._container.parents("form:eq(0)");l.submit($.proxy(this.submit,this));var h=l.find("input[type=reset]:eq(0)");if(h.length){h.click($.proxy(this._reset,this))}if(j){this._success(j)}else{this._loadACL()}},_reset:function(){this._values={group:{},user:{}};this._containerElements.aclList.empty();this._containerElements.searchInput.val("");this._containerElements.permissionList.hide().find("input[type=checkbox]").prop("checked",false)},_loadACL:function(){this._proxy.setOption("data",{actionName:"loadAll",className:"wcf\\data\\acl\\option\\ACLOptionAction",parameters:{categoryName:this._categoryName,objectID:this._objectID,objectTypeID:this._objectTypeID}});this._proxy.sendRequest()},addObject:function(b){var a=this._createListItem(b.objectID,b.label,b.type);this._savePermissions();this._containerElements.aclList.children("li").removeClass("active");a.addClass("active");this._search.addExcludedSearchValue(b.label);this._containerElements.permissionList.find("input[type=checkbox]").prop("checked",false);this._containerElements.searchInput.val("");this._containerElements.permissionList.show();WCF.DOMNodeInsertedHandler.execute()},_createListItem:function(d,a,c){var b=$('<li><span class="icon icon16 icon-'+(c==="group"?"group":"user")+'" /> <span>'+a+"</span></li>").appendTo(this._containerElements.aclList);b.data("objectID",d).data("type",c).data("label",a).click($.proxy(this._click,this));$('<span class="icon icon16 icon-remove jsTooltip pointer" title="'+WCF.Language.get("wcf.global.button.delete")+'" />').click($.proxy(this._removeItem,this)).appendTo(b);return b},_removeItem:function(d){var b=$(d.currentTarget).parent();var a=b.data("type");var c=b.data("objectID");this._search.removeExcludedSearchValue(b.data("label"));b.remove();if(this._values[a][c]){delete this._values[a][c]}this._selectFirstEntry()},_selectFirstEntry:function(){var a=this._containerElements.aclList.children("li:eq(0)");if(a.length){this._select(a,false)}else{this._reset()}},_success:function(g,f,l){if(!$.getLength(g.returnValues.options)){return}var i=0;var n={};for(var h in g.returnValues.options){var a=g.returnValues.options[h];var j=$("<li><span>"+a.label+"</span></li>").data("optionID",h).data("optionName",a.optionName);var d=$('<input type="checkbox" id="grant'+h+'" />').appendTo(j).wrap('<label for="grant'+h+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.grant")+'" />');var b=$('<input type="checkbox" id="deny'+h+'" />').appendTo(j).wrap('<label for="deny'+h+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.deny")+'" />');d.data("type","grant").data("optionID",h).change($.proxy(this._change,this));b.data("type","deny").data("optionID",h).change($.proxy(this._change,this));if(!n[a.categoryName]){n[a.categoryName]=[]}if(a.categoryName===""){j.appendTo(this._containerElements.permissionList)}else{n[a.categoryName].push(j)}i++}if(i>1){var j=$('<li class="aclFullAccess"><span>'+WCF.Language.get("wcf.acl.option.fullAccess")+"</span></li>").prependTo(this._containerElements.permissionList);this._containerElements.grantAll=$('<input type="checkbox" id="grantAll_'+this._container.attr("id")+'" />').appendTo(j).wrap('<label class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.grant")+'" />');this._containerElements.denyAll=$('<input type="checkbox" id="denyAll_'+this._container.attr("id")+'" />').appendTo(j).wrap('<label class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.deny")+'" />');this._containerElements.grantAll.data("type","grant").change($.proxy(this._changeAll,this));this._containerElements.denyAll.data("type","deny").change($.proxy(this._changeAll,this))}if($.getLength(n)){for(var e in n){var c=n[e];if(g.returnValues.categories[e]){$('<li class="aclCategory">'+g.returnValues.categories[e]+"</li>").appendTo(this._containerElements.permissionList)}for(var m=0,k=c.length;m<k;m++){c[m].appendTo(this._containerElements.permissionList)}}}this._parseData(g,"group");this._parseData(g,"user");this._container.show();this._selectFirstEntry()},_parseData:function(c,a){if(!$.getLength(c.returnValues[a].option)){return}for(var b in c.returnValues[a].label){this._createListItem(b,c.returnValues[a].label[b],a);this._search.addExcludedSearchValue(c.returnValues[a].label[b])}this._values[a]=c.returnValues[a].option;WCF.DOMNodeInsertedHandler.execute()},_click:function(b){var a=$(b.currentTarget);if(a.hasClass("active")){return}this._select(a,true)},_select:function(b,a){if(a){this._savePermissions()}this._containerElements.aclList.children("li").removeClass("active");b.addClass("active");this._setupPermissions(b.data("type"),b.data("objectID"))},_change:function(d){var c=$(d.currentTarget);var b=c.data("optionID");var a=c.data("type");if(c.is(":checked")){if(a==="deny"){$("#grant"+b).prop("checked",false);if(this._containerElements.grantAll!==null){this._containerElements.grantAll.prop("checked",false)}}else{$("#deny"+b).prop("checked",false);if(this._containerElements.denyAll!==null){this._containerElements.denyAll.prop("checked",false)}}}else{if(a==="deny"&&this._containerElements.denyAll!==null){this._containerElements.denyAll.prop("checked",false)}else{if(a==="grant"&&this._containerElements.grantAll!==null){this._containerElements.grantAll.prop("checked",false)}}}var e=true;this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(g,h){var f=$(h);if(f.data("type")===a&&f.attr("id")!==a+"All_"+this._container.attr("id")){if(!f.is(":checked")){e=false;return false}}},this));if(a=="deny"){if(this._containerElements.denyAll!==null){if(e){this._containerElements.denyAll.prop("checked",true)}else{this._containerElements.denyAll.prop("checked",false)}}}else{if(this._containerElements.grantAll!==null){if(e){this._containerElements.grantAll.prop("checked",true)}else{this._containerElements.grantAll.prop("checked",false)}}}},_changeAll:function(c){var b=$(c.currentTarget);var a=b.data("type");if(b.is(":checked")){if(a==="deny"){this._containerElements.grantAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="deny"&&d.attr("id")!=="denyAll_"+this._container.attr("id")){d.prop("checked",true).trigger("change")}},this))}else{this._containerElements.denyAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="grant"&&d.attr("id")!=="grantAll_"+this._container.attr("id")){d.prop("checked",true).trigger("change")}},this))}}else{if(a==="deny"){this._containerElements.grantAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="deny"&&d.attr("id")!=="denyAll_"+this._container.attr("id")){d.prop("checked",false).trigger("change")}},this))}else{this._containerElements.denyAll.prop("checked",false);this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,f){var d=$(f);if(d.data("type")==="grant"&&d.attr("id")!=="grantAll_"+this._container.attr("id")){d.prop("checked",false).trigger("change")}},this))}}},_setupPermissions:function(b,c){this._containerElements.permissionList.find("input[type='checkbox']").prop("checked",false);if(this._values[b]&&this._values[b][c]){for(var a in this._values[b][c]){if(this._values[b][c][a]==1){$("#grant"+a).prop("checked",true).trigger("change")}else{$("#deny"+a).prop("checked",true).trigger("change")}}}this._containerElements.permissionList.show()},_savePermissions:function(){var b=this._containerElements.aclList.find("li.active");if(!b.length){return}var c=b.data("objectID");var a=b.data("type");this._values[a][c]={};this._containerElements.permissionList.find("input[type='checkbox']").each((function(d,h){var g=$(h);if(g.attr("id")!="grantAll_"+this._container.attr("id")&&g.attr("id")!="denyAll_"+this._container.attr("id")){var f=(g.data("type")==="deny")?0:1;var e=g.data("optionID");if(g.is(":checked")){this._values[a][c][e]=f;g.prop("checked",false)}else{if(this._values[a]&&this._values[a][c]&&this._values[a][c][e]&&this._values[a][c][e]==f){delete this._values[a][c][e]}}}}).bind(this))},submit:function(a){this._savePermissions();this._save("group");this._save("user")},_save:function(a){if($.getLength(this._values[a])){var b=this._container.parents("form:eq(0)");for(var e in this._values[a]){var d=this._values[a][e];for(var c in d){$('<input type="hidden" name="aclValues['+a+"]["+e+"]["+c+']" value="'+d[c]+'" />').appendTo(b)}}}}}); })(this);
 
 // WCF.Attachment.js
-(function (window, undefined) {"use strict";WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._autoInsert=[];this._objectType=a;this._objectID=h;this._tmpHash=d;this._parentObjectID=e;this._wysiwygContainerID=b;this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this));this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this));this._fileListSelector.find(".jsButtonAttachmentInsertThumbnail").click($.proxy(this._insert,this));this._fileListSelector.find(".jsButtonAttachmentInsertFull").click($.proxy(this._insert,this));WCF.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._wysiwygContainerID,$.proxy(this._removeLimitError,this));this._makeSortable();this._insertAllButton=$('<p class="button jsButtonAttachmentInsertAll">'+WCF.Language.get("wcf.attachment.insertAll")+"</p>").hide().appendTo(this._buttonSelector);this._insertAllButton.click($.proxy(this._insertAll,this));if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}if(this._wysiwygContainerID){WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","submit_"+this._wysiwygContainerID,$.proxy(this._submitInline,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._reset,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","upload_"+this._wysiwygContainerID,$.proxy(this._editorUpload,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","getImageAttachments_"+this._wysiwygContainerID,$.proxy(this._getImageAttachments,this))}},_editorUpload:function(b){var a;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",true);if(b.file){a=this._upload(undefined,b.file)}else{a=this._upload(undefined,undefined,b.blob)}this._autoInsert.push(a);b.uploadID=a},_getImageAttachments:function(a){this._fileListSelector.children("li").each(function(b,d){var c=$(d);if(c.children("img.attachmentTinyThumbnail").length){a.imageAttachments[parseInt(c.data("objectID"))]={height:parseInt(c.data("height")),width:parseInt(c.data("width"))}}})},_submitInline:function(a){if(this._tmpHash){a.tmpHash=this._tmpHash}},_reset:function(){this._fileListSelector.hide().empty();this._insertAllButton.hide();this._validateLimit()},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a<d){var b=(a<=0)?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,a);if(!c.length){c=$('<small class="innerError" />').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=this._fileListSelector.children("li");if(!a.filter(":not(.uploadFailed)").length){this._insertAllButton.hide()}if(!a.length){setTimeout((function(){this._fileListSelector.wcfBlindOut()}).bind(this),250)}if(this._wysiwygContainerID){$("#"+this._wysiwygContainerID).redactor("wbbcode.removeAttachment",b.button.data("objectID"))}},_upload:function(c,b,a){var d=undefined;if(this._validateLimit()){d=this._super(c,b,a)}if(this._fileUpload){this._removeButton();this._createButton()}return d},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('<li class="box64"><span class="icon icon48 icon-spinner" /><div><div><p>'+a.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize")<a.size){b.find("progress").remove();b.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");b.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>"));b.addClass("uploadFailed")}return b},_success:function(b,d){for(var l in this._uploadMatrix[b]){var i=this._uploadMatrix[b][l];i.find("progress").remove();var j=i.data("filename");var m=i.data("internalFileID");if(d.returnValues&&d.returnValues.attachments[m]){if(d.returnValues.attachments[m].tinyURL){i.children(".icon-spinner").replaceWith($('<img src="'+d.returnValues.attachments[m]["tinyURL"]+'" alt="" class="attachmentTinyThumbnail" />'));i.data("height",d.returnValues.attachments[m].height);i.data("width",d.returnValues.attachments[m].width)}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var f=$('<a href=""></a>');f.text(j).attr("href",d.returnValues.attachments[m]["url"]);if(d.returnValues.attachments[m]["isImage"]!=0){f.addClass("jsImageViewer").attr("title",j)}i.find("p").empty().append(f);i.find("small").append(d.returnValues.attachments[m]["formattedFilesize"]);var a=i.find("ul").addClass("buttonGroup");var h=$('<li><span class="button small jsDeleteButton" data-object-id="'+d.returnValues.attachments[m]["attachmentID"]+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment_'+this._wysiwygContainerID+'">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>");a.append(h);i.data("objectID",d.returnValues.attachments[m].attachmentID);if(this._wysiwygContainerID){if(d.returnValues.attachments[m].tinyURL){var k=$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(a);var g=$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(a);k.children("span.button").click($.proxy(this._insert,this));g.children("span.button").click($.proxy(this._insert,this))}else{var c=$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>");c.children("span.button").click($.proxy(this._insert,this)).appendTo(a)}}}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var e="";if(d.returnValues&&d.returnValues.errors[m]){e=d.returnValues.errors[m]["errorType"]}else{e="uploadFailed"}i.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+e)+"</small>"));i.addClass("uploadFailed")}i.css("display","block");if(WCF.inArray(b,this._autoInsert)){this._autoInsert.splice(this._autoInsert.indexOf(b),1);if(!i.hasClass("uploadFailed")){WCF.System.Event.fireEvent("com.woltlab.wcf.attachment","autoInsert_"+this._wysiwygContainerID,{attachment:"[attach="+d.returnValues.attachments[m].attachmentID+"][/attach]",uploadID:b})}}}this._makeSortable();if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}else{this._insertAllButton.hide()}WCF.DOMNodeInsertedHandler.execute()},_insert:function(d,c){var b=(d===null)?c:$(d.currentTarget).data("objectID");var a=(d!==null)?$(d.currentTarget).hasClass("jsButtonAttachmentInsertFull"):false;if($.browser.redactor){$("#"+this._wysiwygContainerID).redactor("wbbcode.insertAttachment",b,a)}},_insertAll:function(){this._fileListSelector.children("li:not(.uploadFailed)").each($.proxy(function(a,b){this._insert(null,$(b).data("objectID"))},this))},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($('<small class="innerError">'+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"</small>"))}})},_makeSortable:function(){var b=this._fileListSelector.children("li:not(.uploadFailed)");if(!b.length){return}b.addClass("sortableAttachment").children("img").addClass("sortableNode");if(!this._fileListSelector.hasClass("sortableList")){this._fileListSelector.addClass("sortableList");var a=this;new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:false,items:"li.sortableAttachment",toleranceElement:null,update:function(d,e){var c=[];a._fileListSelector.children("li:not(.uploadFailed)").each(function(f,g){c.push($(g).data("objectID"))});if(c.length){new WCF.Action.Proxy({autoSend:true,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:c,objectID:a._objectID,objectType:a._objectType,tmpHash:a._tmpHash}}})}}},true)}}}); })(this);
+(function (window, undefined) {"use strict";WCF.Attachment={};WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_wysiwygContainerID:"",init:function(c,g,a,h,d,e,f,b){this._super(c,g,"wcf\\data\\attachment\\AttachmentAction",{multiple:true,maxUploads:f});this._autoInsert=[];this._objectType=a;this._objectID=parseInt(h);this._tmpHash=d;this._parentObjectID=parseInt(e);this._wysiwygContainerID=b;this._buttonSelector.children("p.button").click($.proxy(this._validateLimit,this));this._fileListSelector.find(".jsButtonInsertAttachment").click($.proxy(this._insert,this));this._fileListSelector.find(".jsButtonAttachmentInsertThumbnail").click($.proxy(this._insert,this));this._fileListSelector.find(".jsButtonAttachmentInsertFull").click($.proxy(this._insert,this));WCF.System.Event.addListener("com.woltlab.wcf.action.delete","attachment_"+this._wysiwygContainerID,$.proxy(this._removeLimitError,this));this._makeSortable();this._insertAllButton=$('<p class="button jsButtonAttachmentInsertAll">'+WCF.Language.get("wcf.attachment.insertAll")+"</p>").hide().appendTo(this._buttonSelector);this._insertAllButton.click($.proxy(this._insertAll,this));if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}if(this._wysiwygContainerID){WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","submit_"+this._wysiwygContainerID,$.proxy(this._submitInline,this));WCF.System.Event.addListener("com.woltlab.wcf.messageOptionsInline","prepareExtended_"+this._wysiwygContainerID,$.proxy(this._prepareExtended,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","reset",$.proxy(this._reset,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","upload_"+this._wysiwygContainerID,$.proxy(this._editorUpload,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","getImageAttachments_"+this._wysiwygContainerID,$.proxy(this._getImageAttachments,this))}},_editorUpload:function(b){var a;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",true);if(b.file){a=this._upload(undefined,b.file)}else{a=this._upload(undefined,undefined,b.blob)}this._autoInsert.push(a);b.uploadID=a},_getImageAttachments:function(a){this._fileListSelector.children("li").each(function(b,d){var c=$(d);if(c.children("img.attachmentTinyThumbnail").length){a.imageAttachments[parseInt(c.data("objectID"))]={height:parseInt(c.data("height")),width:parseInt(c.data("width"))}}})},_submitInline:function(a){if(this._tmpHash){a.tmpHash=this._tmpHash}},_prepareExtended:function(a){if(!this._objectID&&this._tmpHash&&this._fileListSelector.children("li:not(.uploadFailed)").length){a.tmpHash=this._tmpHash}},_reset:function(){this._fileListSelector.hide().empty();this._insertAllButton.hide();this._validateLimit()},_validateLimit:function(){var c=this._buttonSelector.next("small.innerError");var a=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length;var d=(this._fileUpload)?this._fileUpload.prop("files").length:0;if(a<=0||a<d){var b=(a<=0)?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,a);if(!c.length){c=$('<small class="innerError" />').insertAfter(this._buttonSelector)}c.html(b);return false}c.remove();return true},_removeLimitError:function(b){var a=this._fileListSelector.children("li");if(!a.filter(":not(.uploadFailed)").length){this._insertAllButton.hide()}if(!a.length){setTimeout((function(){this._fileListSelector.wcfBlindOut()}).bind(this),250)}if(this._wysiwygContainerID){$("#"+this._wysiwygContainerID).redactor("wbbcode.removeAttachment",b.button.data("objectID"))}},_upload:function(c,b,a){var d=undefined;if(this._validateLimit()){d=this._super(c,b,a)}if(this._fileUpload){this._removeButton();this._createButton()}return d},_createUploadMatrix:function(a){this._fileListSelector.children("li.uploadFailed").remove();return this._super(a)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(a){var b=$('<li class="box64"><span class="icon icon48 icon-spinner" /><div><div><p>'+a.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",a.name);this._fileListSelector.append(b);this._fileListSelector.show();if(this._buttonSelector.data("maxSize")<a.size){b.find("progress").remove();b.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");b.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>"));b.addClass("uploadFailed")}return b},_success:function(b,d){for(var l in this._uploadMatrix[b]){var i=this._uploadMatrix[b][l];i.find("progress").remove();var j=i.data("filename");var m=i.data("internalFileID");if(d.returnValues&&d.returnValues.attachments[m]){if(d.returnValues.attachments[m].tinyURL){i.children(".icon-spinner").replaceWith($('<img src="'+d.returnValues.attachments[m]["tinyURL"]+'" alt="" class="attachmentTinyThumbnail" />'));i.data("height",d.returnValues.attachments[m].height);i.data("width",d.returnValues.attachments[m].width)}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-paper-clip")}var f=$('<a href=""></a>');f.text(j).attr("href",d.returnValues.attachments[m]["url"]);if(d.returnValues.attachments[m]["isImage"]!=0){f.addClass("jsImageViewer").attr("title",j)}i.find("p").empty().append(f);i.find("small").append(d.returnValues.attachments[m]["formattedFilesize"]);var a=i.find("ul").addClass("buttonGroup");var h=$('<li><span class="button small jsDeleteButton" data-object-id="'+d.returnValues.attachments[m]["attachmentID"]+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment_'+this._wysiwygContainerID+'">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>");a.append(h);i.data("objectID",d.returnValues.attachments[m].attachmentID);if(this._wysiwygContainerID){if(d.returnValues.attachments[m].tinyURL){var k=$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(a);var g=$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(a);k.children("span.button").click($.proxy(this._insert,this));g.children("span.button").click($.proxy(this._insert,this))}else{var c=$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+d.returnValues.attachments[m].attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>");c.children("span.button").click($.proxy(this._insert,this)).appendTo(a)}}}else{i.children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");var e="";if(d.returnValues&&d.returnValues.errors[m]){e=d.returnValues.errors[m]["errorType"]}else{e="uploadFailed"}i.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+e)+"</small>"));i.addClass("uploadFailed")}i.css("display","block");if(WCF.inArray(b,this._autoInsert)){this._autoInsert.splice(this._autoInsert.indexOf(b),1);if(!i.hasClass("uploadFailed")){WCF.System.Event.fireEvent("com.woltlab.wcf.attachment","autoInsert_"+this._wysiwygContainerID,{attachment:"[attach="+d.returnValues.attachments[m].attachmentID+"][/attach]",uploadID:b})}}}this._makeSortable();if(this._fileListSelector.children("li:not(.uploadFailed)").length){this._insertAllButton.show()}else{this._insertAllButton.hide()}WCF.DOMNodeInsertedHandler.execute()},_insert:function(d,c){var b=(d===null)?c:$(d.currentTarget).data("objectID");var a=(d!==null)?$(d.currentTarget).hasClass("jsButtonAttachmentInsertFull"):false;if($.browser.redactor){$("#"+this._wysiwygContainerID).redactor("wbbcode.insertAttachment",b,a)}},_insertAll:function(){this._fileListSelector.children("li:not(.uploadFailed)").each($.proxy(function(a,b){this._insert(null,$(b).data("objectID"))},this))},_error:function(a){this._fileListSelector.find("li").each(function(b,d){var c=$(d);if(c.children(".icon-spinner").length){c.addClass("uploadFailed").children(".icon-spinner").removeClass("icon-spinner").addClass("icon-ban-circle");c.find("div > div").append($('<small class="innerError">'+(a.responseJSON&&a.responseJSON.message?a.responseJSON.message:WCF.Language.get("wcf.attachment.upload.error.uploadFailed"))+"</small>"))}})},_makeSortable:function(){var b=this._fileListSelector.children("li:not(.uploadFailed)");if(!b.length){return}b.addClass("sortableAttachment").children("img").addClass("sortableNode");if(!this._fileListSelector.hasClass("sortableList")){this._fileListSelector.addClass("sortableList");var a=this;new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:false,items:"li.sortableAttachment",toleranceElement:null,update:function(d,e){var c=[];a._fileListSelector.children("li:not(.uploadFailed)").each(function(f,g){c.push($(g).data("objectID"))});if(c.length){new WCF.Action.Proxy({autoSend:true,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:c,objectID:a._objectID,objectType:a._objectType,tmpHash:a._tmpHash}}})}}},true)}}}); })(this);
 
 // WCF.ColorPicker.js
 (function (window, undefined) {"use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:false,_barSelector:null,_dialog:null,_didInit:false,_elementID:"",_gradient:null,_gradientActive:false,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(a){this._elementID="";this._hsv={h:0,s:100,v:100};this._position={};var b=$(a);if(!b.length){console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.");return}b.click($.proxy(this._open,this))},_open:function(c){if(!this._didInit){this._initColorPicker();this._didInit=true}var a=$(c.currentTarget);this._elementID=a.wcfIdentify();this._parseColor(a);var b=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+b.r+", "+b.g+", "+b.b+", "+(this._rgba.a.val()/100)+")"});this._dialog.wcfDialog({title:WCF.Language.get("wcf.style.colorPicker")});this._hex.focus()},_parseColor:function(b){if(b.data("hsv")&&b.data("rgb")){var d=b.data("hsv");for(var a in d){this._hsv[a]=d[a]}this._updateValues(b.data("rgb"),true,true);this._rgba.a.val(parseInt(b.data("alpha")))}else{if(this._rgbaRegExp===null){this._rgbaRegExp=new RegExp("^rgba\\((\\d{1,3}), ?(\\d{1,3}), ?(\\d{1,3}), ?(1|1\\.00?|0|0?\\.[0-9]{1,2})\\)$")}this._rgbaRegExp.exec(b.data("color"));var c=RegExp.$4;if(c.indexOf(".")===0){c="0"+c}c*=100;this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(c)},true,true)}},_initColorPicker:function(){this._dialog=$('<div id="colorPickerContainer" />').hide().appendTo(document.body);this._gradient=$('<div id="colorPickerGradient" />').appendTo(this._dialog);this._gradientSelector=$('<span id="colorPickerGradientSelector"><span></span></span>').appendTo(this._gradient);this._bar=$('<div id="colorPickerBar" />').appendTo(this._dialog);this._barSelector=$('<span id="colorPickerBarSelector" />').appendTo(this._bar);this._gradient.mousedown($.proxy(this._mouseDownGradient,this));this._bar.mousedown($.proxy(this._mouseDownBar,this));var a=this;$(document).mouseup(function(b){if(a._barActive){a._barActive=false;a._mouseBar(b)}else{if(a._gradientActive){a._gradientActive=false;a._mouseGradient(b)}}}).mousemove(function(b){if(a._barActive){a._mouseBar(b)}else{if(a._gradientActive){a._mouseGradient(b)}}});this._initColorPickerForm()},_initColorPickerForm:function(){var c=$('<div id="colorPickerForm" />').appendTo(this._dialog);$("<small>"+WCF.Language.get("wcf.style.colorPicker.new")+"</small>").appendTo(c);var d=$('<ul class="colors" />').appendTo(c);this._newColor=$('<li class="new"><span /></li>').appendTo(d).children("span");this._oldColor=$('<li class="old"><span /></li>').appendTo(d).children("span");$("<small>"+WCF.Language.get("wcf.style.colorPicker.current")+"</small>").appendTo(c);var a=$('<ul class="rgba" />').appendTo(c);this._createInputElement("r","R",0,255).appendTo(a);this._createInputElement("g","G",0,255).appendTo(a);this._createInputElement("b","B",0,255).appendTo(a);this._createInputElement("a","a",0,100).appendTo(a);var e=$('<ul class="hex"><li><label><span>#</span></label></li></ul>').appendTo(c);this._hex=$('<input type="text" maxlength="6" />').appendTo(e.find("label"));this._rgba.r.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this));this._rgba.g.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this));this._rgba.b.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this));this._rgba.a.blur($.proxy(this._blurRgba,this)).keyup($.proxy(this._keyUpRGBA,this));this._hex.blur($.proxy(this._blurHex,this)).keyup($.proxy(this._keyUpHex,this));var f=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.style.colorPicker.button.apply")+"</button>").appendTo(f).click($.proxy(this._submit,this));var b=this;this._hex.on("paste",function(){b._hex.attr("maxlength","7");setTimeout(function(){var g=b._hex.val();if(g.substring(0,1)=="#"){g=g.substr(1)}if(g.length>6){g=g.substring(0,6)}b._hex.attr("maxlength","6").val(g)},50)});c.find("input").focus(function(){this.select()})},_keyUpRGBA:function(a){if(a.which==13){this._blurRgba();this._submit()}},_keyUpHex:function(a){if(a.which==13){this._blurHex();this._submit()}},_submit:function(){var d=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);var c={};for(var b in this._hsv){c[b]=this._hsv[b]}var a=$("#"+this._elementID);a.data("hsv",c).css({backgroundColor:"rgba("+d.r+", "+d.g+", "+d.b+", "+(this._rgba.a.val()/100)+")"}).data("alpha",parseInt(this._rgba.a.val()));a.data("rgb",{r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()});$("#"+a.data("store")).val("rgba("+this._rgba.r.val()+", "+this._rgba.g.val()+", "+this._rgba.b.val()+", "+(this._rgba.a.val()/100)+")").trigger("change");this._dialog.wcfDialog("close")},_createInputElement:function(f,c,e,b){var d=$('<li class="'+f+'" />');var a=$("<label />").appendTo(d);$("<span>"+c+"</span>").appendTo(a);this._rgba[f]=$('<input type="number" value="0" min="'+e+'" max="'+b+'" step="1" />').appendTo(a);return d},_mouseDownGradient:function(a){this._gradientActive=true;this._mouseGradient(a)},_mouseGradient:function(b){var c=this._gradient.getOffsets("offset");var a=Math.max(Math.min(b.pageX-c.left,255),0);var d=Math.max(Math.min(b.pageY-c.top,255),0);this._hsv.s=Math.max(0,Math.min(1,a/255))*100;this._hsv.v=Math.max(0,Math.min(1,(255-d)/255))*100;this._updateValues(null)},_mouseDownBar:function(a){this._barActive=true;this._mouseBar(a)},_mouseBar:function(a){var b=this._bar.getOffsets("offset");var c=Math.max(Math.min(a.pageY-b.top,255),0);this._barSelector.css({top:c+"px"});this._hsv.h=Math.max(0,Math.min(359,Math.round((255-c)/255*360)));this._updateValues(null)},_blurRgba:function(){for(var a in this._rgba){var b=parseInt(this._rgba[a].val())||0;if(a==="a"){this._rgba[a].val(Math.max(0,Math.min(100,b)))}else{this._rgba[a].val(Math.max(0,Math.min(255,b)))}}this._updateValues({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()},true,true)},_blurHex:function(){var a=this.hexToRgb(this._hex.val());if(a!==Number.NaN){this._updateValues(a,true,true)}},_updateValues:function(c,e,a){e=(e===true)?true:false;a=(a===true)?true:false;if(c===null){c=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);if(this._rgba.a.val()==0){c.a=100}}if(c.a===undefined){c.a=this._rgba.a.val()}for(var b in c){this._rgba[b].val(c[b])}this._hex.val(this.rgbToHex(c.r,c.g,c.b));if(e||a){var g=this.rgbToHsv(c.r,c.g,c.b);if(e){this._hsv.h=g.h}if(a){this._hsv.s=g.s;this._hsv.v=g.v}}var h=Math.max(0,Math.min(255,255-(this._hsv.h/360)*255));this._barSelector.css({top:h+"px"});var d=Math.max(0,Math.min(255,(this._hsv.s/100)*255));var h=Math.max(0,Math.min(255,255-((this._hsv.v/100)*255)));this._gradientSelector.css({left:(d-6)+"px",top:(h-6)+"px"});this._newColor.css({backgroundColor:"rgba("+c.r+", "+c.g+", "+c.b+", "+(c.a/100)+")"});var f=this.hsvToRgb(this._hsv.h,100,100);this._gradient.css({backgroundColor:"rgb("+f.r+", "+f.g+", "+f.b+")"})},hsvToRgb:function(d,j,g){var b={r:0,g:0,b:0};var i,a,f,e,c;i=Math.floor(d/60);a=d/60-i;j/=100;g/=100;f=g*(1-j);e=g*(1-j*a);c=g*(1-j*(1-a));if(j==0){b.r=b.g=b.b=g}else{switch(i){case 1:b.r=e;b.g=g;b.b=f;break;case 2:b.r=f;b.g=g;b.b=c;break;case 3:b.r=f;b.g=e;b.b=g;break;case 4:b.r=c;b.g=f;b.b=g;break;case 5:b.r=g;b.g=f;b.b=e;break;case 0:case 6:b.r=g;b.g=c;b.b=f;break}}return{r:Math.round(b.r*255),g:Math.round(b.g*255),b:Math.round(b.b*255)}},rgbToHsv:function(a,f,i){var j,e,c;var d,k,h;a/=255;f/=255;i/=255;d=Math.max(Math.max(a,f),i);k=Math.min(Math.min(a,f),i);h=d-k;j=0;if(d!==k){switch(d){case a:j=60*(0+(f-i)/h);break;case f:j=60*(2+(i-a)/h);break;case i:j=60*(4+(a-f)/h);break}if(j<0){j+=360}}if(d===0){e=0}else{e=h/d}c=d;return{h:Math.round(j),s:Math.round(e*100),v:Math.round(c*100)}},hexToRgb:function(a){if(/^#?([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/.test(a)){a=a.split("");if(a[0]==="#"){a.shift()}if(a.length===3){return{r:parseInt(a[0]+""+a[0],16),g:parseInt(a[1]+""+a[1],16),b:parseInt(a[2]+""+a[2],16)}}else{return{r:parseInt(a[0]+""+a[1],16),g:parseInt(a[2]+""+a[3],16),b:parseInt(a[4]+""+a[5],16)}}}return Number.NaN},rgbToHex:function(d,c,a){return("0123456789ABCDEF".charAt((d-d%16)/16)+""+"0123456789ABCDEF".charAt(d%16))+""+("0123456789ABCDEF".charAt((c-c%16)/16)+""+"0123456789ABCDEF".charAt(c%16))+""+("0123456789ABCDEF".charAt((a-a%16)/16)+""+"0123456789ABCDEF".charAt(a%16))}}); })(this);
@@ -106,7 +106,7 @@ window.matchMedia||(window.matchMedia=function(){var c=window.styleMedia||window
 (function (window, undefined) {"use strict";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,_additionalParameters:{},_locationSearch:null,_locationSearchInputSelector:null,_markerClusterer:null,_objectIDs:[],_previousNorthEast:null,_previousSouthWest:null,init:function(e,b,d,c,a){this._super(e,b);this._actionClassName=d;this._locationSearchInputSelector=c||"";this._additionalParameters=a||{};this._objectIDs=[];if(this._locationSearchInputSelector){this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(c,$.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(f){if(f.infoWindow){f.infoWindow.open(this._map,f)}},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 false}this._previousNorthEast=a;this._previousSouthWest=b;this._proxy.setOption("data",{actionName:"getMapMarkers",className:this._actionClassName,parameters:$.extend(this._additionalParameters,{excludedObjectIDs:this._objectIDs,eastLongitude:a.lng(),northLatitude:a.lat(),southLatitude:b.lat(),westLongitude:b.lng()})});this._proxy.sendRequest();return true},_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.SuggestionMap=WCF.Location.GoogleMaps.LargeMap.extend({_locationSuggestionsButton:null,_suggestionSelectionCallback:null,init:function(f,c,e,d,a){this._super(f,c,e,d,a);var b=$('<div class="gmnoprint googleMapsCustomControlContainer"><div class="gm-style-mtc"><div class="googleMapsCustomControl">'+WCF.Language.get("wcf.map.showLocationSuggestions")+"</div></div></div>");this._locationSuggestionsButton=b.find(".googleMapsCustomControl").click($.proxy(this._toggleLocationSuggestions,this));this._map.controls[google.maps.ControlPosition.TOP_RIGHT].push(b.get(0))},_loadMarkers:function(){if(!this._locationSuggestionsButton.hasClass("active")){return}if(!this._super()){this._loadSuggestions=false}},_success:function(c,d,b){var a=this._markers.length;this._super(c,d,b);if(this._loadSuggestions&&a==this._markers.length){this._loadSuggestions=false;new WCF.System.Notification(WCF.Language.get("wcf.map.noLocationSuggestions"),"info").show()}},_toggleLocationSuggestions:function(){var a=!this._locationSuggestionsButton.hasClass("active");if(a){this._loadSuggestions=true}this.showSuggestions(a)},addMarker:function(h,f,g,e,d){var a=$(d);var c=$('<a class="googleMapsUseLocationSuggestionLink" />').text(WCF.Language.get("wcf.map.useLocationSuggestion")).click(this._suggestionSelectionCallback);a.append($('<p class="marginTopTiny" />').append(c));var b=this._super(h,f,g,"//mt.google.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png",a.get(0));c.data("marker",b);return b},setSuggestionSelectionCallback:function(a){this._suggestionSelectionCallback=a},showSuggestions:function(c){if(c===undefined){c=true}this._locationSuggestionsButton.toggleClass("active",c);var b=[];for(var e=0,d=this._markers.length;e<d;e++){var a=this._markers[e];if(!a.draggable){a.setVisible(c);if(c){b.push(a)}}}this._markerClusterer.clearMarkers();if(c){this._markerClusterer.addMarkers(b)}this._loadMarkers()}});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(e,b,a,f,d,c){this._searchInput=a;if(c){this._map=new WCF.Location.GoogleMaps.SuggestionMap(e,b,c);this._map.setSuggestionSelectionCallback($.proxy(this._useSuggestion,this))}else{this._map=new WCF.Location.GoogleMaps.Map(e,b)}this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(a,$.proxy(this._setMarkerByLocation,this));if(f&&d){this._marker=this._map.addDraggableMarker(f,d)}else{this._marker=this._map.addDraggableMarker(WCF.Location.GoogleMaps.Settings.get("defaultLatitude"),WCF.Location.GoogleMaps.Settings.get("defaultLongitude"));WCF.Location.Util.getLocation($.proxy(function(h,g){if(h!==undefined&&g!==undefined){WCF.Location.GoogleMaps.Util.moveMarker(this._marker,h,g);WCF.Location.GoogleMaps.Util.focusMarker(this._marker)}},this))}this._marker.addListener("dragend",$.proxy(this._updateLocation,this))},_useSuggestion:function(b){var a=$(b.currentTarget).data("marker");this._marker.setPosition(a.getPosition());this._updateLocation();this._map.showSuggestions(false)},_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)},getMap:function(){return this._map},getMarker:function(){return this._marker}});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)}})}}; })(this);
 
 // WCF.Message.js
-(function (window, undefined) {"use strict";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.EditHistory=Class.extend({_oldIDInputs:null,_newIDInputs:null,_containerSelector:"",_buttonSelector:".jsRevertButton",init:function(c,b,a,d){this._oldIDInputs=c;this._newIDInputs=b;this._containerSelector=a;this._buttonSelector=(d)?d:".jsRevertButton";this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initInputs();this._initElements()},_initInputs:function(){var a=this;this._newIDInputs.change(function(c){var b=parseInt($(this).val());if($(this).val()==="current"){b=Infinity}a._oldIDInputs.each(function(d){var e=parseInt($(this).val());if($(this).val()==="current"){e=Infinity}if(e>=b){$(this).disable()}else{$(this).enable()}})});this._oldIDInputs.change(function(b){var c=parseInt($(this).val());if($(this).val()==="current"){c=Infinity}a._newIDInputs.each(function(e){var d=parseInt($(this).val());if($(this).val()==="current"){d=Infinity}if(d<=c){$(this).disable()}else{$(this).enable()}})});this._oldIDInputs.filter(":checked").change();this._newIDInputs.filter(":checked").change()},_initElements:function(){var a=this;$(this._containerSelector).each(function(c,b){var d=$(b);d.find(a._buttonSelector).click($.proxy(a._click,a))})},_click:function(c){var a=$(c.currentTarget);c.preventDefault();if(a.data("confirmMessage")){var b=this;WCF.System.Confirmation.show(a.data("confirmMessage"),function(d){if(d==="cancel"){return}b._sendRequest(a)})}else{this._sendRequest(a)}},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"revert",className:"wcf\\data\\edit\\history\\entry\\EditHistoryEntryAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){window.location.reload(true)}});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_"+this._messageFieldID).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 $.trim(this._messageField.val())}else{if(this._messageField.data("redactor")){return this._messageField.redactor("wutil.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,c){var a=parseInt(c.activeTab.tab.data("smileyCategoryID"));if(!a){return}if(c.activeTab.container.children("ul.smileyList").length){return}if(this._cache[a]!==undefined){c.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("core.getObject");$(".messageTabMenu[data-wysiwyg-container-id="+this._wysiwygSelector+"]").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.wbbcode.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(d,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");var c=a.find("button[data-type=save]").removeAttr("accesskey").click($.proxy(this._save,this));if(d){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="";WCF.System.Event.addListener("com.woltlab.wcf.redactor","submitEditor_text",function(e){e.cancel=true;c.trigger("click")});WCF.System.Event.addListener("com.woltlab.wcf.message.quote","insert",(function(f){var e=false;if(this._container.is(":visible")){e=true}else{if(f.forceInsert){e=(this._messageField.redactor("wutil.isEmptyEditor")?false:true);this.click(null)}}if(e){this._messageField.redactor("wutil.adjustSelectionForBlockElement");this._messageField.redactor("wbbcode.insertQuoteBBCode",f.quote.username,f.quote.link,f.quote.text,f.quote.text);this._scroll.scrollTo(this._container,true)}}).bind(this))},click:function(b){this._container.toggle();if(this._container.is(":visible")){this._quickReplyButtons.hide();setTimeout((function(){$(document).trigger("resize");if(!$.browser.mobile||!$.browser.chrome){this._scroll.scrollTo(this._container,true)}}).bind(this),100);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")){this._editorCallback(this._messageField.redactor("wutil.isEmptyEditor"))}}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("wutil.selectionEndOfEditor")}else{this._messageField.focus()}},getContainer:function(){return this._container},_insertQuotes:function(b){if(!b.returnValues.template){return}if($.browser.redactor){var a=WCF.String.unescapeHTML(b.returnValues.template);a=this._messageField.redactor("wbbcode.convertToHtml",a);a=a.replace(/<p><blockquote/,"<blockquote");a=a.replace(/blockquote><\/p>/,"blockquote>");this._messageField.redactor("focus.setEnd");this._messageField.redactor("wutil.insertDynamic",a,b.returnValues.template);this._messageField.redactor("wutil.selectionEndOfEditor");this._messageField.redactor("wbbcode.observeQuotes")}else{this._messageField.val(b.returnValues.template)}},_save:function(){if(this._pendingSave){return}var a="";if($.browser.redactor){a=this._messageField.redactor("wutil.getText")}else{a=$.trim(this._messageField.val())}var d=this._messageField.parent().find("small.innerError");if(a===""||a==="0"){if(!d.length){d=$('<small class="innerError" />').appendTo(this._messageField.parent())}d.html(WCF.Language.get("wcf.global.form.error.empty"));return}else{d.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);var c=b.children(".redactor-box").hide();c.next().hide();b.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())};if(this._container.data("anchor")){a.anchor=this._container.data("anchor")}WCF.System.Event.fireEvent("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageField.wcfIdentify(),a.data);return a},_cancel:function(){this._revertQuickReply(true);if($.browser.redactor){this._messageField.redactor("wutil.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().next().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("wutil.getText");if(a.length){this._messageField.redactor("wutil.saveTextToStorage",true)}else{this._messageField.redactor("wutil.autosavePurge")}}else{a=$.trim(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(b){this._messageField.redactor("wutil.saveTextToStorage");window.location=b.returnValues.url}).bind(this)})},_success:function(c,d,b){if($.browser.redactor){this._messageField.redactor("wutil.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("wutil.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(g){this._proxy.setOption("failure",$.proxy(this._failure,this));var e=this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID");var d=this._container[this._activeElementID].addClass("jsInvalidQuoteTarget").find(".messageBody");d.children(".icon-spinner").remove();var c=d.children("div:eq(0)");$(""+g.returnValues.template).appendTo(c);var b=c.find(".formSubmit");var f=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"),f);WCF.System.Event.addListener("com.woltlab.wcf.redactor","submitEditor_"+e,function(h){h.cancel=true;f.trigger("click")});this._container[this._activeElementID].find(".messageOptions").addClass("forceHidden");var a=$("#"+e);if($.browser.redactor){new WCF.PeriodicalExecuter($.proxy(function(h){h.stop();if(this._quoteManager){this._quoteManager.setAlternativeEditor(a)}new WCF.Effect.Scroll().scrollTo(this._container[this._activeElementID],true)},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(":not(.messageText)").show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_save:function(){var d=this._container[this._activeElementID];var c=d.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+c).redactor("wutil.getText")}else{a=$("#"+this._messageEditorIDPrefix+c).val()}var b={containerID:this._containerID,data:{message:a},objectID:c};WCF.System.Event.fireEvent("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageEditorIDPrefix+c,b);this._proxy.setOption("data",{actionName:"save",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters: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("wutil.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("wutil.autosavePurge");a.redactor("core.destroy")}b.find(".messageBody > div > .messageInlineEditor").remove();WCF.System.Event.removeAllListeners("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageEditorIDPrefix+b.data("objectID"))},_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,g){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();g=(g&&e.supportPaste())?true:false;this._initCopyQuote(g);$(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(e){var a=function(f){if(f.tagName==="H3"||f.tagName==="SCRIPT"){return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT};a.acceptNode=a;var b=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,a,true);var d="";while(b.nextNode()){var c=b.currentNode;if(c.nodeType===Node.ELEMENT_NODE){switch(c.tagName){case"BR":case"LI":case"UL":d+="\n";break;case"TD":if(!$.browser.msie){d+="\n"}break}}else{d+=c.nodeValue.replace(/\n/g,"")}}return d},_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)[0])}else{d=this._getNodeText(i[0])}if(this._normalize(d).indexOf(this._normalize(f))===-1){return}this._copyQuote.show();var g=this._getBoundingRectangle(i,window.getSelection());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(a,d){var c=null;if(document.createRange&&typeof document.createRange().getBoundingClientRect!="undefined"){if(d.rangeCount>0){var b=d.getRangeAt(0).getBoundingClientRect();c={left:b.left,right:b.right,top:b.top+$(document).scrollTop()}}}else{if(document.selection&&document.selection.type!="Control"){var e=document.selection.createRange();c={left:e.boundingLeft,right:e.boundingRight,top:e.boundingTop}}}return c},_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==Node.TEXT_NODE){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(b){this._copyQuote=$("#quoteManagerCopy");if(!this._copyQuote.length){this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip"><span class="jsQuoteManagerStore">'+WCF.Language.get("wcf.message.quote.quoteSelected")+'</span><span class="pointer"><span></span></span></div>').hide().appendTo(document.body);var a=this._copyQuote.children("span.jsQuoteManagerStore").click($.proxy(this._saveQuote,this));if(b){$('<span class="jsQuoteManagerQuoteAndInsert">'+WCF.Language.get("wcf.message.quote.quoteAndReply")+"</span>").click($.proxy(this._saveAndInsertQuote,this)).insertAfter(a)}}},_getSelectedText:function(){var a=window.getSelection();if(a.rangeCount){return this._getNodeText(a.getRangeAt(0).cloneContents())}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")}var c=a.parents(".buttonGroupNavigation");if(c.hasClass("jsMobileButtonGroupNavigation")){c.children(".dropdownLabel").trigger("click")}b.stopPropagation();return false},_saveQuote:function(a){a=(a===true)?true:false;this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message,renderQuote:a}});this._proxy.sendRequest()},_saveAndInsertQuote:function(){this._saveQuote(true)},_success:function(c,d,b){if(c.returnValues.count!==undefined){if(c.returnValues.fullQuoteMessageIDs!==undefined){c.returnValues.fullQuoteObjectIDs=c.returnValues.fullQuoteMessageIDs}var a=(c.returnValues.fullQuoteObjectIDs!==undefined)?c.returnValues.fullQuoteObjectIDs:{};this._quoteManager.updateCount(c.returnValues.count,a)}switch(c.actionName){case"saveQuote":case"saveFullQuote":if(c.returnValues.renderedQuote){WCF.System.Event.fireEvent("com.woltlab.wcf.message.quote","insert",{forceInsert:(c.actionName==="saveQuote"?true:false),quote:c.returnValues.renderedQuote})}break}},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(d,c){this._count=parseInt(d)||0;this._toggleShowQuotes();for(var a in this._handlers){var b=c[a]||[];this._handlers[a].updateFullQuoteObjectIDs(b)}},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){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");if($.browser.redactor){if(this._editorElementAlternative===null){if(a!==null){var c=$(".jsQuickReply:eq(0)").data("__api");if(c&&!c.getContainer().is(":visible")){this._insertQuotes=false;c.click(null)}}this._editorElement.redactor("wbbcode.insertQuoteBBCode",e.attr("data-username"),e.data("link"),i,i)}else{this._editorElementAlternative.redactor("wbbcode.insertQuoteBBCode",e.attr("data-username"),e.data("link"),i,i)}}else{i="[quote='"+e.attr("data-username")+"','"+e.data("link")+"']"+i+"[/quote]";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:(b.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)}}},supportPaste:function(){return this._supportPaste}});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({_dialog:null,_fetchObjectCount:false,_pageDescription:"",_pageURL:"",_privacySettings:{},_provider:{},_proxy:null,init:function(a,b){this._dialog=null;this._fetchObjectCount=(a===true)?true:false;this._pageDescription=encodeURIComponent($('meta[property="og:title"]').prop("content"));this._pageURL=encodeURIComponent($('meta[property="og:url"]').prop("content"));this._privacySettings=$.extend({facebook:false,google:false,twitter:false,reddit:false},b||{});this._proxy=null;this._initProvider()},_initProvider:function(){var c=$(".messageShareButtons");var a=this;this._provider={facebook:{fetch:function(){a._fetchFacebook()},link:c.find(".jsShareFacebook"),share:function(){a._share("facebook","https://www.facebook.com/sharer.php?u={pageURL}&t={text}",true)}},google:{fetch:undefined,link:c.find(".jsShareGoogle"),share:function(){a._share("google","https://plus.google.com/share?url={pageURL}",true)}},reddit:{fetch:function(){a._fetchReddit()},link:c.find(".jsShareReddit"),share:function(){a._share("reddit","https://ssl.reddit.com/submit?url={pageURL}",true)}},twitter:{fetch:function(){a._fetchTwitter()},link:c.find(".jsShareTwitter"),share:function(){a._share("twitter","https://twitter.com/share?url={pageURL}&text={text}",false)}}};$.each(this._provider,function(e,d){if(a._privacySettings[e]){if(a._fetchObjectCount&&d.fetch){d.fetch()}}else{d.link.addClass("disabled")}d.link.data("provider",e).click($.proxy(a._click,a))});if(WCF.User.userID){var b=$('<li class="jsShowPrivacySettings"><a><span class="icon icon32 fa-gear jsTooltip" title="'+WCF.Language.get("wcf.message.share.privacy")+'" /></a></li>');b.appendTo(c.children("ul")).children("a").click($.proxy(this._openPrivacySettings,this))}},_click:function(b){var a=$(b.currentTarget);var c=a.data("provider");if(a.hasClass("disabled")){if(WCF.User.userID){this._openPrivacySettings()}else{a.removeClass("disabled")}}else{this._provider[c].share()}},_openPrivacySettings:function(){if(this._proxy===null){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})}this._proxy.setOption("data",{actionName:"getSocialNetworkPrivacySettings",className:"wcf\\data\\user\\UserAction"});this._proxy.sendRequest()},_success:function(b,c,a){switch(b.actionName){case"getSocialNetworkPrivacySettings":this._renderDialog(b);break;case"saveSocialNetworkPrivacySettings":this._updatePrivacySettings(b);break}},_renderDialog:function(a){if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.html(a.returnValues.template);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share.privacy")})}else{this._dialog.html(a.returnValues.template);this._dialog.wcfDialog("open")}this._dialog.find("input[type=submit]").click($.proxy(this._save,this))},_save:function(){this._proxy.setOption("data",{actionName:"saveSocialNetworkPrivacySettings",className:"wcf\\data\\user\\UserAction",parameters:{facebook:(this._dialog.find("input[name=facebook]").is(":checked")),google:(this._dialog.find("input[name=google]").is(":checked")),reddit:(this._dialog.find("input[name=reddit]").is(":checked")),twitter:(this._dialog.find("input[name=twitter]").is(":checked"))}});this._proxy.sendRequest();this._dialog.wcfDialog("close")},_updatePrivacySettings:function(b){this._privacySettings=$.extend(this._privacySettings,b.returnValues.settings);var a=this;$.each(b.returnValues.settings,function(d,c){a._privacySettings[d]=(c)?true:false;if(c){a._provider[d].link.removeClass("disabled");if(a._fetchObjectCount&&a._provider[d].fetch){a._provider[d].fetch()}}else{a._provider[d].link.addClass("disabled")}});new WCF.System.Notification().show()},_share:function(c,a,b){window.open(a.replace(/{pageURL}/,this._pageURL).replace(/{text}/,this._pageDescription+(b?" "+this._pageURL:"")),c,"height=600,width=600")},_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._provider.facebook.link.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._provider.twitter.link.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._provider.reddit.link.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,_timer:null,init:function(a){if($.browser.mobile&&$.browser.mozilla){return}this._textarea=$("#"+a);this._redactor=this._textarea.redactor("core.getObject");this._dropdown=this._textarea.redactor("core.getEditor");this._dropdownMenu=$('<ul class="dropdownMenu userSuggestionList" />').appendTo(this._textarea.parent());WCF.Dropdown.initDropdownFragment(this._dropdown,this._dropdownMenu);this._proxy=new WCF.Action.Proxy({autoAbortPrevious:true,success:$.proxy(this._success,this)});WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+a,$.proxy(this._keydown,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+a,$.proxy(this._keyup,this))},_clearList:function(){this._hideList();this._dropdownMenu.empty()},_click:function(a){if($.browser.mozilla&&this._caretPosition.startContainer.nodeName=="P"){var b=this._caretPosition.startContainer.childNodes[this._caretPosition.startOffset-1];this._caretPosition=document.createRange();this._caretPosition.selectNodeContents(b);this._caretPosition.collapse()}this._redactor.wutil.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.wutil.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.wutil.replaceRangesWith(e);this._caretPosition=e;return c},_setUsername:function(e){if(this._timer!==null){this._timer.stop();this._timer=null}this._proxy.abortPrevious();var c=getSelection().getRangeAt(0).cloneRange();this._redactor.buffer.set();var a=document.createRange();a.setStart(c.startContainer,c.startOffset-(this._mentionStart.length+1));a.setEnd(c.startContainer,c.startOffset);this._redactor.wutil.replaceRangesWith(a);var d=getSelection().getRangeAt(0);d.deleteContents();d.collapse(true);if(e.indexOf("'")!==-1){e=e.replace(/'/g,"''")}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.wutil.replaceRangesWith(a);this._hideList()},_getParameters:function(){return{data:{includeUserGroups:false,searchString:this._mentionStart}}},_getTextLineInFrontOfCaret:function(){if(this._redactor.selection.getHtml().length){return""}var f=getSelection().getRangeAt(0);if($.browser.mozilla&&f.startContainer.nodeType==3){f.startContainer.parentNode.normalize()}var c=f.startContainer.textContent.substr(0,f.startOffset);var a=c;c="";var b=false;for(var e=0;e<a.length;e++){var d=a.charCodeAt(e).toString(16);if(d!="200b"&&(!/\s/.test(a[e])||((d=="a0"||d=="20")&&!b))){if(d=="a0"||d=="20"){b=true}if(a[e]==="@"&&e&&/\s/.test(a[e-1])){b=false;c=""}c+=a[e]}else{b=false;c=""}}return c},_hideList:function(){this._dropdown.removeClass("dropdownOpen");this._dropdownMenu.removeClass("dropdownOpen");this._itemIndex=-1},_keydown:function(a){if(this._redactor.wutil.inPlainMode()){return}if(this._dropdownMenu.is(":visible")){switch(a.event.which){case $.ui.keyCode.ENTER:a.event.preventDefault();a.cancel=true;this._dropdownMenu.children("li").eq(this._itemIndex).trigger("click");break;case $.ui.keyCode.UP:a.cancel=true;a.event.preventDefault();this._selectItem(this._itemIndex-1);break;case $.ui.keyCode.DOWN:a.cancel=true;a.event.preventDefault();this._selectItem(this._itemIndex+1);break}}},_keyup:function(c){if(this._redactor.wutil.inPlainMode()){return true}if(this._timer!==null){this._timer.stop();this._timer=null}this._proxy.abortPrevious();if(c.event.which===$.ui.keyCode.ENTER){return}if(this._dropdownMenu.is(":visible")&&c.event.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];if(this._timer!==null){this._timer.stop()}this._timer=new WCF.PeriodicalExecuter($.proxy(function(){this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters()});this._proxy.sendRequest();this._timer.stop();this._timer=null},this),500)}}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:not(.jsFlexibleMenuDropdown)");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.length){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}}); })(this);
+(function (window, undefined) {"use strict";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.EditHistory=Class.extend({_oldIDInputs:null,_newIDInputs:null,_containerSelector:"",_buttonSelector:".jsRevertButton",init:function(c,b,a,d){this._oldIDInputs=c;this._newIDInputs=b;this._containerSelector=a;this._buttonSelector=(d)?d:".jsRevertButton";this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)});this._initInputs();this._initElements()},_initInputs:function(){var a=this;this._newIDInputs.change(function(c){var b=parseInt($(this).val());if($(this).val()==="current"){b=Infinity}a._oldIDInputs.each(function(d){var e=parseInt($(this).val());if($(this).val()==="current"){e=Infinity}if(e>=b){$(this).disable()}else{$(this).enable()}})});this._oldIDInputs.change(function(b){var c=parseInt($(this).val());if($(this).val()==="current"){c=Infinity}a._newIDInputs.each(function(e){var d=parseInt($(this).val());if($(this).val()==="current"){d=Infinity}if(d<=c){$(this).disable()}else{$(this).enable()}})});this._oldIDInputs.filter(":checked").change();this._newIDInputs.filter(":checked").change()},_initElements:function(){var a=this;$(this._containerSelector).each(function(c,b){var d=$(b);d.find(a._buttonSelector).click($.proxy(a._click,a))})},_click:function(c){var a=$(c.currentTarget);c.preventDefault();if(a.data("confirmMessage")){var b=this;WCF.System.Confirmation.show(a.data("confirmMessage"),function(d){if(d==="cancel"){return}b._sendRequest(a)})}else{this._sendRequest(a)}},_sendRequest:function(a){this.proxy.setOption("data",{actionName:"revert",className:"wcf\\data\\edit\\history\\entry\\EditHistoryEntryAction",objectIDs:[$(a).data("objectID")]});this.proxy.sendRequest()},_success:function(b,c,a){window.location.reload(true)}});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_"+this._messageFieldID).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 $.trim(this._messageField.val())}else{if(this._messageField.data("redactor")){return this._messageField.redactor("wutil.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,c){var a=parseInt(c.activeTab.tab.data("smileyCategoryID"));if(!a){return}if(c.activeTab.container.children("ul.smileyList").length){return}if(this._cache[a]!==undefined){c.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("core.getObject");$(".messageTabMenu[data-wysiwyg-container-id="+this._wysiwygSelector+"]").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.wbbcode.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(d,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");var c=a.find("button[data-type=save]").removeAttr("accesskey").click($.proxy(this._save,this));if(d){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="";WCF.System.Event.addListener("com.woltlab.wcf.redactor","submitEditor_text",function(e){e.cancel=true;c.trigger("click")});WCF.System.Event.addListener("com.woltlab.wcf.message.quote","insert",(function(f){var e=false;if(this._container.is(":visible")){e=true}else{if(f.forceInsert){e=(this._messageField.redactor("wutil.isEmptyEditor")?false:true);this.click(null)}}if(e){this._messageField.redactor("wutil.adjustSelectionForBlockElement");this._messageField.redactor("wbbcode.insertQuoteBBCode",f.quote.username,f.quote.link,f.quote.text,f.quote.text);this._scroll.scrollTo(this._container,true)}}).bind(this))},click:function(b){this._container.toggle();if(this._container.is(":visible")){this._quickReplyButtons.hide();setTimeout((function(){$(document).trigger("resize");if(!$.browser.mobile||!$.browser.chrome){this._scroll.scrollTo(this._container,true)}}).bind(this),100);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")){this._editorCallback(this._messageField.redactor("wutil.isEmptyEditor"))}}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("wutil.selectionEndOfEditor")}else{this._messageField.focus()}},getContainer:function(){return this._container},_insertQuotes:function(b){if(!b.returnValues.template){return}if($.browser.redactor){var a=WCF.String.unescapeHTML(b.returnValues.template);a=this._messageField.redactor("wbbcode.convertToHtml",a);a=a.replace(/<p><blockquote/,"<blockquote");a=a.replace(/blockquote><\/p>/,"blockquote>");this._messageField.redactor("focus.setEnd");this._messageField.redactor("wutil.insertDynamic",a,b.returnValues.template);this._messageField.redactor("wutil.selectionEndOfEditor");this._messageField.redactor("wbbcode.observeQuotes")}else{this._messageField.val(b.returnValues.template)}},_save:function(){if(this._pendingSave){return}var a="";if($.browser.redactor){a=this._messageField.redactor("wutil.getText")}else{a=$.trim(this._messageField.val())}var d=this._messageField.parent().find("small.innerError");if(a===""||a==="0"){if(!d.length){d=$('<small class="innerError" />').appendTo(this._messageField.parent())}d.html(WCF.Language.get("wcf.global.form.error.empty"));return}else{d.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);var c=b.children(".redactor-box").hide();c.next().hide();b.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())};if(this._container.data("anchor")){a.anchor=this._container.data("anchor")}WCF.System.Event.fireEvent("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageField.wcfIdentify(),a.data);return a},_cancel:function(){this._revertQuickReply(true);if($.browser.redactor){this._messageField.redactor("wutil.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().next().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("wutil.getText");if(a.length){this._messageField.redactor("wutil.saveTextToStorage",true)}else{this._messageField.redactor("wutil.autosavePurge")}}else{a=$.trim(this._messageField.val())}var b={containerID:this._getObjectID(),message:a};WCF.System.Event.fireEvent("com.woltlab.wcf.messageOptionsInline","prepareExtended_"+this._messageField.wcfIdentify(),b);new WCF.Action.Proxy({autoSend:true,data:{actionName:"jumpToExtended",className:this._getClassName(),interfaceName:"wcf\\data\\IExtendedMessageQuickReplyAction",parameters:b},success:(function(c){this._messageField.redactor("wutil.saveTextToStorage");window.location=c.returnValues.url}).bind(this)})},_success:function(c,d,b){if($.browser.redactor){this._messageField.redactor("wutil.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("wutil.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(g){this._proxy.setOption("failure",$.proxy(this._failure,this));var e=this._messageEditorIDPrefix+this._container[this._activeElementID].data("objectID");var d=this._container[this._activeElementID].addClass("jsInvalidQuoteTarget").find(".messageBody");d.children(".icon-spinner").remove();var c=d.children("div:eq(0)");$(""+g.returnValues.template).appendTo(c);var b=c.find(".formSubmit");var f=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"),f);WCF.System.Event.addListener("com.woltlab.wcf.redactor","submitEditor_"+e,function(h){h.cancel=true;f.trigger("click")});this._container[this._activeElementID].find(".messageOptions").addClass("forceHidden");var a=$("#"+e);if($.browser.redactor){new WCF.PeriodicalExecuter($.proxy(function(h){h.stop();if(this._quoteManager){this._quoteManager.setAlternativeEditor(a)}new WCF.Effect.Scroll().scrollTo(this._container[this._activeElementID],true)},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(":not(.messageText)").show();a.children(".attachmentThumbnailList, .attachmentFileList").show();a.find(".jsInlineEditorHideContent").show();if(this._quoteManager){this._quoteManager.clearAlternativeEditor()}},_save:function(){var d=this._container[this._activeElementID];var c=d.data("objectID");var a="";if($.browser.redactor){a=$("#"+this._messageEditorIDPrefix+c).redactor("wutil.getText")}else{a=$("#"+this._messageEditorIDPrefix+c).val()}var b={containerID:this._containerID,data:{message:a},objectID:c};WCF.System.Event.fireEvent("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageEditorIDPrefix+c,b);this._proxy.setOption("data",{actionName:"save",className:this._getClassName(),interfaceName:"wcf\\data\\IMessageInlineEditorAction",parameters: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("wutil.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("wutil.autosavePurge");a.redactor("core.destroy")}b.find(".messageBody > div > .messageInlineEditor").remove();WCF.System.Event.removeAllListeners("com.woltlab.wcf.messageOptionsInline","submit_"+this._messageEditorIDPrefix+b.data("objectID"))},_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,g){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();g=(g&&e.supportPaste())?true:false;this._initCopyQuote(g);$(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(e){var a=function(f){if(f.tagName==="H3"||f.tagName==="SCRIPT"){return NodeFilter.FILTER_REJECT}return NodeFilter.FILTER_ACCEPT};a.acceptNode=a;var b=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,a,true);var d="";while(b.nextNode()){var c=b.currentNode;if(c.nodeType===Node.ELEMENT_NODE){switch(c.tagName){case"BR":case"LI":case"UL":d+="\n";break;case"TD":if(!$.browser.msie){d+="\n"}break}}else{d+=c.nodeValue.replace(/\n/g,"")}}return d},_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)[0])}else{d=this._getNodeText(i[0])}if(this._normalize(d).indexOf(this._normalize(f))===-1){return}this._copyQuote.show();var g=this._getBoundingRectangle(i,window.getSelection());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(a,d){var c=null;if(document.createRange&&typeof document.createRange().getBoundingClientRect!="undefined"){if(d.rangeCount>0){var b=d.getRangeAt(0).getBoundingClientRect();c={left:b.left,right:b.right,top:b.top+$(document).scrollTop()}}}else{if(document.selection&&document.selection.type!="Control"){var e=document.selection.createRange();c={left:e.boundingLeft,right:e.boundingRight,top:e.boundingTop}}}return c},_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==Node.TEXT_NODE){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(b){this._copyQuote=$("#quoteManagerCopy");if(!this._copyQuote.length){this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip"><span class="jsQuoteManagerStore">'+WCF.Language.get("wcf.message.quote.quoteSelected")+'</span><span class="pointer"><span></span></span></div>').hide().appendTo(document.body);var a=this._copyQuote.children("span.jsQuoteManagerStore").click($.proxy(this._saveQuote,this));if(b){$('<span class="jsQuoteManagerQuoteAndInsert">'+WCF.Language.get("wcf.message.quote.quoteAndReply")+"</span>").click($.proxy(this._saveAndInsertQuote,this)).insertAfter(a)}}},_getSelectedText:function(){var a=window.getSelection();if(a.rangeCount){return this._getNodeText(a.getRangeAt(0).cloneContents())}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")}var c=a.parents(".buttonGroupNavigation");if(c.hasClass("jsMobileButtonGroupNavigation")){c.children(".dropdownLabel").trigger("click")}b.stopPropagation();return false},_saveQuote:function(a){a=(a===true)?true:false;this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message,renderQuote:a}});this._proxy.sendRequest()},_saveAndInsertQuote:function(){this._saveQuote(true)},_success:function(c,d,b){if(c.returnValues.count!==undefined){if(c.returnValues.fullQuoteMessageIDs!==undefined){c.returnValues.fullQuoteObjectIDs=c.returnValues.fullQuoteMessageIDs}var a=(c.returnValues.fullQuoteObjectIDs!==undefined)?c.returnValues.fullQuoteObjectIDs:{};this._quoteManager.updateCount(c.returnValues.count,a)}switch(c.actionName){case"saveQuote":case"saveFullQuote":if(c.returnValues.renderedQuote){WCF.System.Event.fireEvent("com.woltlab.wcf.message.quote","insert",{forceInsert:(c.actionName==="saveQuote"?true:false),quote:c.returnValues.renderedQuote})}break}},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(d,c){this._count=parseInt(d)||0;this._toggleShowQuotes();for(var a in this._handlers){var b=c[a]||[];this._handlers[a].updateFullQuoteObjectIDs(b)}},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){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");if($.browser.redactor){if(this._editorElementAlternative===null){if(a!==null){var c=$(".jsQuickReply:eq(0)").data("__api");if(c&&!c.getContainer().is(":visible")){this._insertQuotes=false;c.click(null)}}this._editorElement.redactor("wbbcode.insertQuoteBBCode",e.attr("data-username"),e.data("link"),i,i)}else{this._editorElementAlternative.redactor("wbbcode.insertQuoteBBCode",e.attr("data-username"),e.data("link"),i,i)}}else{i="[quote='"+e.attr("data-username")+"','"+e.data("link")+"']"+i+"[/quote]";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:(b.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)}}},supportPaste:function(){return this._supportPaste}});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({_dialog:null,_fetchObjectCount:false,_pageDescription:"",_pageURL:"",_privacySettings:{},_provider:{},_proxy:null,init:function(a,b){this._dialog=null;this._fetchObjectCount=(a===true)?true:false;this._pageDescription=encodeURIComponent($('meta[property="og:title"]').prop("content"));this._pageURL=encodeURIComponent($('meta[property="og:url"]').prop("content"));this._privacySettings=$.extend({facebook:false,google:false,twitter:false,reddit:false},b||{});this._proxy=null;this._initProvider()},_initProvider:function(){var c=$(".messageShareButtons");var a=this;this._provider={facebook:{fetch:function(){a._fetchFacebook()},link:c.find(".jsShareFacebook"),share:function(){a._share("facebook","https://www.facebook.com/sharer.php?u={pageURL}&t={text}",true)}},google:{fetch:undefined,link:c.find(".jsShareGoogle"),share:function(){a._share("google","https://plus.google.com/share?url={pageURL}",true)}},reddit:{fetch:function(){a._fetchReddit()},link:c.find(".jsShareReddit"),share:function(){a._share("reddit","https://ssl.reddit.com/submit?url={pageURL}",true)}},twitter:{fetch:function(){a._fetchTwitter()},link:c.find(".jsShareTwitter"),share:function(){a._share("twitter","https://twitter.com/share?url={pageURL}&text={text}",false)}}};$.each(this._provider,function(e,d){if(a._privacySettings[e]){if(a._fetchObjectCount&&d.fetch){d.fetch()}}else{d.link.addClass("disabled")}d.link.data("provider",e).click($.proxy(a._click,a))});if(WCF.User.userID){var b=$('<li class="jsShowPrivacySettings"><a><span class="icon icon32 fa-gear jsTooltip" title="'+WCF.Language.get("wcf.message.share.privacy")+'" /></a></li>');b.appendTo(c.children("ul")).children("a").click($.proxy(this._openPrivacySettings,this))}},_click:function(b){var a=$(b.currentTarget);var c=a.data("provider");if(a.hasClass("disabled")){if(WCF.User.userID){this._openPrivacySettings()}else{a.removeClass("disabled")}}else{this._provider[c].share()}},_openPrivacySettings:function(){if(this._proxy===null){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})}this._proxy.setOption("data",{actionName:"getSocialNetworkPrivacySettings",className:"wcf\\data\\user\\UserAction"});this._proxy.sendRequest()},_success:function(b,c,a){switch(b.actionName){case"getSocialNetworkPrivacySettings":this._renderDialog(b);break;case"saveSocialNetworkPrivacySettings":this._updatePrivacySettings(b);break}},_renderDialog:function(a){if(this._dialog===null){this._dialog=$("<div />").hide().appendTo(document.body);this._dialog.html(a.returnValues.template);this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share.privacy")})}else{this._dialog.html(a.returnValues.template);this._dialog.wcfDialog("open")}this._dialog.find("input[type=submit]").click($.proxy(this._save,this))},_save:function(){this._proxy.setOption("data",{actionName:"saveSocialNetworkPrivacySettings",className:"wcf\\data\\user\\UserAction",parameters:{facebook:(this._dialog.find("input[name=facebook]").is(":checked")),google:(this._dialog.find("input[name=google]").is(":checked")),reddit:(this._dialog.find("input[name=reddit]").is(":checked")),twitter:(this._dialog.find("input[name=twitter]").is(":checked"))}});this._proxy.sendRequest();this._dialog.wcfDialog("close")},_updatePrivacySettings:function(b){this._privacySettings=$.extend(this._privacySettings,b.returnValues.settings);var a=this;$.each(b.returnValues.settings,function(d,c){a._privacySettings[d]=(c)?true:false;if(c){a._provider[d].link.removeClass("disabled");if(a._fetchObjectCount&&a._provider[d].fetch){a._provider[d].fetch()}}else{a._provider[d].link.addClass("disabled")}});new WCF.System.Notification().show()},_share:function(c,a,b){window.open(a.replace(/{pageURL}/,this._pageURL).replace(/{text}/,this._pageDescription+(b?" "+this._pageURL:"")),c,"height=600,width=600")},_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._provider.facebook.link.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._provider.twitter.link.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._provider.reddit.link.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,_timer:null,init:function(a){if($.browser.mobile&&$.browser.mozilla){return}this._textarea=$("#"+a);this._redactor=this._textarea.redactor("core.getObject");this._dropdown=this._textarea.redactor("core.getEditor");this._dropdownMenu=$('<ul class="dropdownMenu userSuggestionList" />').appendTo(this._textarea.parent());WCF.Dropdown.initDropdownFragment(this._dropdown,this._dropdownMenu);this._proxy=new WCF.Action.Proxy({autoAbortPrevious:true,success:$.proxy(this._success,this)});WCF.System.Event.addListener("com.woltlab.wcf.redactor","keydown_"+a,$.proxy(this._keydown,this));WCF.System.Event.addListener("com.woltlab.wcf.redactor","keyup_"+a,$.proxy(this._keyup,this))},_clearList:function(){this._hideList();this._dropdownMenu.empty()},_click:function(a){if($.browser.mozilla&&this._caretPosition.startContainer.nodeName=="P"){var b=this._caretPosition.startContainer.childNodes[this._caretPosition.startOffset-1];this._caretPosition=document.createRange();this._caretPosition.selectNodeContents(b);this._caretPosition.collapse()}this._redactor.wutil.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.wutil.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.wutil.replaceRangesWith(e);this._caretPosition=e;return c},_setUsername:function(e){if(this._timer!==null){this._timer.stop();this._timer=null}this._proxy.abortPrevious();var c=getSelection().getRangeAt(0).cloneRange();this._redactor.buffer.set();var a=document.createRange();a.setStart(c.startContainer,c.startOffset-(this._mentionStart.length+1));a.setEnd(c.startContainer,c.startOffset);this._redactor.wutil.replaceRangesWith(a);var d=getSelection().getRangeAt(0);d.deleteContents();d.collapse(true);if(e.indexOf("'")!==-1){e=e.replace(/'/g,"''")}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.wutil.replaceRangesWith(a);this._hideList()},_getParameters:function(){return{data:{includeUserGroups:false,searchString:this._mentionStart}}},_getTextLineInFrontOfCaret:function(){if(this._redactor.selection.getHtml().length){return""}var f=getSelection().getRangeAt(0);if($.browser.mozilla&&f.startContainer.nodeType==3){f.startContainer.parentNode.normalize()}var c=f.startContainer.textContent.substr(0,f.startOffset);var a=c;c="";var b=false;for(var e=0;e<a.length;e++){var d=a.charCodeAt(e).toString(16);if(d!="200b"&&(!/\s/.test(a[e])||((d=="a0"||d=="20")&&!b))){if(d=="a0"||d=="20"){b=true}if(a[e]==="@"&&e&&/\s/.test(a[e-1])){b=false;c=""}c+=a[e]}else{b=false;c=""}}return c},_hideList:function(){this._dropdown.removeClass("dropdownOpen");this._dropdownMenu.removeClass("dropdownOpen");this._itemIndex=-1},_keydown:function(a){if(this._redactor.wutil.inPlainMode()){return}if(this._dropdownMenu.is(":visible")){switch(a.event.which){case $.ui.keyCode.ENTER:a.event.preventDefault();a.cancel=true;this._dropdownMenu.children("li").eq(this._itemIndex).trigger("click");break;case $.ui.keyCode.UP:a.cancel=true;a.event.preventDefault();this._selectItem(this._itemIndex-1);break;case $.ui.keyCode.DOWN:a.cancel=true;a.event.preventDefault();this._selectItem(this._itemIndex+1);break}}},_keyup:function(c){if(this._redactor.wutil.inPlainMode()){return true}if(this._timer!==null){this._timer.stop();this._timer=null}this._proxy.abortPrevious();if(c.event.which===$.ui.keyCode.ENTER){return}if(this._dropdownMenu.is(":visible")&&c.event.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];if(this._timer!==null){this._timer.stop()}this._timer=new WCF.PeriodicalExecuter($.proxy(function(){this._proxy.setOption("data",{actionName:"getSearchResultList",className:this._className,interfaceName:"wcf\\data\\ISearchAction",parameters:this._getParameters()});this._proxy.sendRequest();this._timer.stop();this._timer=null},this),500)}}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:not(.jsFlexibleMenuDropdown)");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.length){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}}); })(this);
 
 // WCF.Poll.js
 (function (window, undefined) {"use strict";WCF.Poll={};WCF.Poll.Management=Class.extend({_container:null,_count:0,_inputSize:0,_maxOptions:0,init:function(a,c,d){this._count=0;this._maxOptions=d||-1;this._container=$("#"+a).children("ol:eq(0)");if(!this._container.length){console.debug("[WCF.Poll.Management] Invalid container id given, aborting.");return}c=c||[];this._createOptionList(c);$(window).resize($.proxy(this._resize,this));this._container.parents("form").submit($.proxy(this._submit,this));new WCF.Sortable.List(a,"",undefined,undefined,true);this._resize();var b=this;this._container.closest(".messageTabMenu").on("messagetabmenushow",function(e,f){if(f.activeTab.name=="poll"){b._resize()}})},_createOptionList:function(b){for(var d=0,c=b.length;d<c;d++){var a=b[d];this._createOption(a.optionValue,a.optionID)}this._createOption()},_createOption:function(f,d,c){f=f||"";d=parseInt(d)||0;c=c||null;var b=$('<li class="sortableNode" />').data("optionID",d);if(c===null){b.appendTo(this._container)}else{b.insertAfter(c)}var a=$('<span class="sortableButtonContainer" />').appendTo(b);$('<span class="icon icon16 icon-plus jsTooltip jsAddOption pointer" title="'+WCF.Language.get("wcf.poll.button.addOption")+'" />').click($.proxy(this._addOption,this)).appendTo(a);$('<span class="icon icon16 icon-remove jsTooltip jsDeleteOption pointer" title="'+WCF.Language.get("wcf.poll.button.removeOption")+'" />').click($.proxy(this._removeOption,this)).appendTo(a);var e=$('<input type="text" value="'+f+'" maxlength="255" />').css({width:this._inputSize+"px"}).keydown($.proxy(this._keyDown,this)).appendTo(b);if(c!==null){e.focus()}WCF.DOMNodeInsertedHandler.execute();this._count++;if(this._count===this._maxOptions){this._container.find("span.jsAddOption").removeClass("pointer").addClass("disabled")}},_keyDown:function(a){if(a.which!==13){return true}$(a.currentTarget).prev(".sortableButtonContainer").children(".jsAddOption").trigger("click");a.preventDefault();a.stopPropagation();return false},_addOption:function(b){if(this._count===this._maxOptions){return false}var a=$(b.currentTarget).parents("li");this._createOption(undefined,undefined,a)},_removeOption:function(a){$(a.currentTarget).parents("li").remove();this._count--;this._container.find("span.jsAddOption").addClass("pointer").removeClass("disabled");if(this._container.children("li").length==0){this._createOption()}},_resize:function(){var d=this._container.innerWidth();var c=this._container.children("li:eq(0)");var b=c.children(".sortableButtonContainer").outerWidth();var a=d-b;if(a!=this._inputSize){this._inputSize=a;this._container.find("li > input").css({width:this._inputSize+"px"})}},_submit:function(){var a=[];this._container.children("li").each(function(f,i){var h=$(i);var g=$.trim(h.children("input").val());if(g!=""){a.push({optionID:h.data("optionID"),optionValue:g})}});if(a.length){var b=this._container.parents("form").find(".formSubmit");for(var e=0,d=a.length;e<d;e++){var c=a[e];$('<input type="hidden" name="pollOptions['+e+']" />').val(c.optionID+"_"+c.optionValue).appendTo(b)}}}});WCF.Poll.Manager=Class.extend({_cache:{},_canViewParticipants:{},_canViewResult:{},_canVote:{},_inputElements:{},_participants:{},_polls:{},_proxy:null,init:function(a){var c=$(a);if(!c.length){console.debug("[WCF.Poll.Manager] Given selector '"+a+"' does not match, aborting.");return}this._cache={};this._canViewParticipants={};this._canViewResult={};this._inputElements={};this._participants={};this._polls={};this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),url:"index.php/Poll/?t="+SECURITY_TOKEN+SID_ARG_2ND});var b=this;c.each(function(e,g){var f=$(g);var d=f.data("pollID");if(b._polls[d]===undefined){b._cache[d]={result:"",vote:""};b._polls[d]=f;b._canViewParticipants[d]=(f.data("canViewParticipants"))?true:false;b._canViewResult[d]=(f.data("canViewResult"))?true:false;b._canVote[d]=(f.data("canVote"))?true:false;b._bindListeners(d);if(f.data("inVote")){b._prepareVote(d)}b._toggleButtons(d)}})},_bindListeners:function(a){this._polls[a].find(".jsButtonPollShowParticipants").data("pollID",a).click($.proxy(this._showParticipants,this));this._polls[a].find(".jsButtonPollShowResult").data("pollID",a).click($.proxy(this._showResult,this));this._polls[a].find(".jsButtonPollShowVote").data("pollID",a).click($.proxy(this._showVote,this));this._polls[a].find(".jsButtonPollVote").data("pollID",a).click($.proxy(this._vote,this))},_showResult:function(b,c){var a=(b===null)?c:$(b.currentTarget).data("pollID");if(!this._canViewResult[a]){return}if(!this._polls[a].data("inVote")){return}if(!this._cache[a].result){this._proxy.setOption("data",{actionName:"getResult",pollID:a});this._proxy.sendRequest()}else{this._polls[a].find(".pollInnerContainer").html(this._cache[a].result);this._polls[a].data("inVote",false);this._toggleButtons(a)}},_showParticipants:function(b){var a=$(b.currentTarget).data("pollID");if(!this._participants[a]){this._participants[a]=new WCF.User.List("wcf\\data\\poll\\PollAction",this._polls[a].data("question"),{pollID:a})}this._participants[a].open()},_showVote:function(b,c){var a=(b===null)?c:$(b.currentTarget).data("pollID");if(!this._canVote[a]){return}if(this._polls[a].data("inVote")){return}if(!this._cache[a].vote){this._proxy.setOption("data",{actionName:"getVote",pollID:a});this._proxy.sendRequest()}else{this._polls[a].find(".pollInnerContainer").html(this._cache[a].vote);this._polls[a].data("inVote",true);this._prepareVote(a);this._toggleButtons(a)}},_success:function(c,d,b){if(!c||!c.actionName){return}var a=c.pollID;if(c.resultTemplate){this._cache[a].result=c.resultTemplate}if(c.voteTemplate){this._cache[a].vote=c.voteTemplate}switch(c.actionName){case"getResult":this._showResult(null,a);break;case"getVote":this._showVote(null,a);break;case"vote":this._canViewResult[a]=true;this._canVote[a]=(c.canVote)?true:false;this._showResult(null,a);break}},_prepareVote:function(c){this._polls[c].find(".jsButtonPollVote").disable();var d=this._polls[c].find(".pollInnerContainer > .jsPollVote");var a=this;this._inputElements[c]=d.find("input").change(function(){a._handleVoteButton(c)});this._handleVoteButton(c);var b=d.data("maxVotes");if(this._inputElements[c].filter("[type=checkbox]").length){this._inputElements[c].change(function(){a._enforceMaxVotes(c,b)});this._enforceMaxVotes(c,b)}},_enforceMaxVotes:function(c,b){var a=this._inputElements[c];if(a.filter(":checked").length==b){a.filter(":not(:checked)").disable()}else{a.enable()}},_handleVoteButton:function(b){var a=this._inputElements[b];var c=this._polls[b].find(".jsButtonPollVote");if(a.filter(":checked").length){c.enable()}else{c.disable()}},_toggleButtons:function(c){var a=this._polls[c].children(".formSubmit");a.find(".jsButtonPollShowParticipants, .jsButtonPollShowResult, .jsButtonPollShowVote, .jsButtonPollVote").hide();var b=true;if(this._polls[c].data("inVote")){b=false;a.find(".jsButtonPollVote").show();if(this._canViewResult[c]){a.find(".jsButtonPollShowResult").show()}}else{if(this._canVote[c]){b=false;a.find(".jsButtonPollShowVote").show()}if(this._canViewParticipants[c]){b=false;a.find(".jsButtonPollShowParticipants").show()}}if(b){a.hide()}},_vote:function(c){var a=$(c.currentTarget).data("pollID");if(!this._canVote[a]){return}var b=[];this._inputElements[a].each(function(e,d){var f=$(d);if(f.is(":checked")){b.push(f.data("optionID"))}});if(b.length){this._proxy.setOption("data",{actionName:"vote",optionIDs:b,pollID:a});this._proxy.sendRequest()}}}); })(this);