(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(e,t,n,i,a,s){this._objectID=i||0,this._objectTypeID=t,this._categoryName=n,void 0===a&&(a=!0),this._values={group:{},user:{}},this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)}),this._container=$(e).hide().addClass("aclContainer");var r=this._container.children("dd"),c=$('<ul class="aclList containerList" />').appendTo(r),l=$('<input type="text" class="long" placeholder="'+WCF.Language.get("wcf.acl.search."+(a?"":"user.")+"description")+'" />').appendTo(r),o=$('<ul class="aclPermissionList containerList" />').hide().appendTo(r);elData(o[0],"grant",WCF.Language.get("wcf.acl.option.grant")),elData(o[0],"deny",WCF.Language.get("wcf.acl.option.deny")),this._containerElements={aclList:c,denyAll:null,grantAll:null,permissionList:o,searchInput:l},this._search=new WCF.Search.User(l,$.proxy(this.addObject,this),a);var h=this._container.parents("form:eq(0)");h.submit($.proxy(this.submit,this));var p=h.find("input[type=reset]:eq(0)");p.length&&p.click($.proxy(this._reset,this)),s?this._success(s):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",!1)},_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(e){var t=this._createListItem(e.objectID,e.label,e.type);this._savePermissions(),this._containerElements.aclList.children("li").removeClass("active"),t.addClass("active"),this._search.addExcludedSearchValue(e.label),this._containerElements.permissionList.find("input[type=checkbox]").prop("checked",!1),this._containerElements.searchInput.val(""),this._containerElements.permissionList.show(),WCF.DOMNodeInsertedHandler.execute()},_createListItem:function(e,t,n){var i=$('<li><span class="icon icon16 fa-user'+("group"===n?"s":"")+'" /> <span class="aclLabel">'+t+"</span></li>").appendTo(this._containerElements.aclList);return i.data("objectID",e).data("type",n).data("label",t).click($.proxy(this._click,this)),$('<span class="icon icon16 fa-times jsTooltip pointer" title="'+WCF.Language.get("wcf.global.button.delete")+'" />').click($.proxy(this._removeItem,this)).appendTo(i),i},_removeItem:function(e){var t=$(e.currentTarget).parent(),n=t.data("type"),i=t.data("objectID");this._search.removeExcludedSearchValue(t.data("label")),t.remove(),this._values[n][i]&&delete this._values[n][i],this._selectFirstEntry()},_selectFirstEntry:function(){var e=this._containerElements.aclList.children("li:eq(0)");e.length?this._select(e,!1):this._reset()},_success:function(e,t,n){if($.getLength(e.returnValues.options)){var i=0,a={};for(var s in e.returnValues.options){var r=e.returnValues.options[s],c=$("<li><span>"+r.label+"</span></li>").data("optionID",s).data("optionName",r.optionName),l=$('<input type="checkbox" id="grant'+s+'" />').appendTo(c).wrap('<label for="grant'+s+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.grant")+'" />'),o=$('<input type="checkbox" id="deny'+s+'" />').appendTo(c).wrap('<label for="deny'+s+'" class="jsTooltip" title="'+WCF.Language.get("wcf.acl.option.deny")+'" />');l.data("type","grant").data("optionID",s).change($.proxy(this._change,this)),o.data("type","deny").data("optionID",s).change($.proxy(this._change,this)),a[r.categoryName]||(a[r.categoryName]=[]),""===r.categoryName?c.appendTo(this._containerElements.permissionList):a[r.categoryName].push(c),i++}if(1<i&&(c=$('<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(c).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(c).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))),$.getLength(a))for(var h in a){var p=a[h];e.returnValues.categories[h]&&$('<li class="aclCategory">'+e.returnValues.categories[h]+"</li>").appendTo(this._containerElements.permissionList);for(var d=0,u=p.length;d<u;d++)p[d].appendTo(this._containerElements.permissionList)}this._parseData(e,"group"),this._parseData(e,"user"),this._container.show(),require(["WoltLabSuite/Core/Form/Builder/Field/Dependency/Manager"],function(e){e.checkDependencies()}),this._selectFirstEntry()}},_parseData:function(e,t){if($.getLength(e.returnValues[t].option)){for(var n in e.returnValues[t].label)this._createListItem(n,e.returnValues[t].label[n],t),this._search.addExcludedSearchValue(e.returnValues[t].label[n]);this._values[t]=e.returnValues[t].option,WCF.DOMNodeInsertedHandler.execute()}},_click:function(e){var t=$(e.currentTarget);t.hasClass("active")||this._select(t,!0)},_select:function(e,t){t&&this._savePermissions(),this._containerElements.aclList.children("li").removeClass("active"),e.addClass("active"),this._setupPermissions(e.data("type"),e.data("objectID"))},_change:function(e){var t=$(e.currentTarget),n=t.data("optionID"),i=t.data("type");t.is(":checked")?"deny"===i?($("#grant"+n).prop("checked",!1),null!==this._containerElements.grantAll&&this._containerElements.grantAll.prop("checked",!1)):($("#deny"+n).prop("checked",!1),null!==this._containerElements.denyAll&&this._containerElements.denyAll.prop("checked",!1)):"deny"===i&&null!==this._containerElements.denyAll?this._containerElements.denyAll.prop("checked",!1):"grant"===i&&null!==this._containerElements.grantAll&&this._containerElements.grantAll.prop("checked",!1);var a=!0;this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,t){var n=$(t);if(n.data("type")===i&&n.attr("id")!==i+"All_"+this._container.attr("id")&&!n.is(":checked"))return a=!1},this)),"deny"==i?null!==this._containerElements.denyAll&&(a?this._containerElements.denyAll.prop("checked",!0):this._containerElements.denyAll.prop("checked",!1)):null!==this._containerElements.grantAll&&(a?this._containerElements.grantAll.prop("checked",!0):this._containerElements.grantAll.prop("checked",!1))},_changeAll:function(e){var t=$(e.currentTarget),n=t.data("type");t.is(":checked")?"deny"===n?(this._containerElements.grantAll.prop("checked",!1),this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,t){var n=$(t);"deny"===n.data("type")&&n.attr("id")!=="denyAll_"+this._container.attr("id")&&n.prop("checked",!0).trigger("change")},this))):(this._containerElements.denyAll.prop("checked",!1),this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,t){var n=$(t);"grant"===n.data("type")&&n.attr("id")!=="grantAll_"+this._container.attr("id")&&n.prop("checked",!0).trigger("change")},this))):"deny"===n?(this._containerElements.grantAll.prop("checked",!1),this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,t){var n=$(t);"deny"===n.data("type")&&n.attr("id")!=="denyAll_"+this._container.attr("id")&&n.prop("checked",!1).trigger("change")},this))):(this._containerElements.denyAll.prop("checked",!1),this._containerElements.permissionList.find("input[type=checkbox]").each($.proxy(function(e,t){var n=$(t);"grant"===n.data("type")&&n.attr("id")!=="grantAll_"+this._container.attr("id")&&n.prop("checked",!1).trigger("change")},this)))},_setupPermissions:function(e,t){if(this._containerElements.permissionList.find("input[type='checkbox']").prop("checked",!1),this._values[e]&&this._values[e][t])for(var n in this._values[e][t])1==this._values[e][t][n]?$("#grant"+n).prop("checked",!0).trigger("change"):$("#deny"+n).prop("checked",!0).trigger("change");this._containerElements.permissionList.show()},_savePermissions:function(){var s,r,e=this._containerElements.aclList.find("li.active");e.length&&(s=e.data("objectID"),r=e.data("type"),this._values[r][s]={},this._containerElements.permissionList.find("input[type='checkbox']").each(function(e,t){var n,i,a=$(t);a.attr("id")!="grantAll_"+this._container.attr("id")&&a.attr("id")!="denyAll_"+this._container.attr("id")&&(n="deny"===a.data("type")?0:1,i=a.data("optionID"),a.is(":checked")?(this._values[r][s][i]=n,a.prop("checked",!1)):this._values[r]&&this._values[r][s]&&this._values[r][s][i]&&this._values[r][s][i]==n&&delete this._values[r][s][i])}.bind(this)))},submit:function(e){this._savePermissions(),this._save("group"),this._save("user")},_save:function(e){if($.getLength(this._values[e])){var t=this._container.parents("form:eq(0)");for(var n in this._values[e]){var i=this._values[e][n];for(var a in i)$('<input type="hidden" name="aclValues['+e+"]["+n+"]["+a+']" value="'+i[a]+'" />').appendTo(t)}}},getData:function(){return this._savePermissions(),this._values}}); })(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,_editorId:"",_replaceOnLoad:{},_options:{},init:function(t,e,i,a,n,s,r,l,o){var d,c;this._super(t,e,"wcf\\data\\attachment\\AttachmentAction",{multiple:!0,maxUploads:r}),this._autoInsert=[],this._objectType=i,this._objectID=parseInt(a),this._tmpHash=n,this._parentObjectID=parseInt(s),this._editorId=l,this._options=$.extend(!0,this._options,o||{}),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._onDelete.bind(this)),this._makeSortable(),this._insertAllButton=$('<p class="button jsButtonAttachmentInsertAll">'+WCF.Language.get("wcf.attachment.insertAll")+"</p>").hide(),this._editorId&&(this._insertAllButton.appendTo(this._buttonSelector),this._insertAllButton.click($.proxy(this._insertAll,this)),this._fileListSelector.children("li:not(.uploadFailed)").length&&this._insertAllButton.show(),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+this._editorId,this._submitInline.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+this._editorId,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId,function(t){t.tmpHashes&&Array.isArray(t.tmpHashes)||(t.tmpHashes=[]);var e=t.tmpHashes.indexOf(n);0<this._fileListSelector.children("li:not(.uploadFailed)").length?-1===e&&t.tmpHashes.push(n):-1!==e&&t.tmpHashes.splice(e)}.bind(this)),d=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,function(t){var e,i,a,n,s,r=this._getImageAttachments(),l=t.attributes[0]||0;r.hasOwnProperty(l)&&(e=~~$("#"+this._editorId).data("redactor").opts.woltlab.attachmentThumbnailWidth,i=!0===(i=t.attributes[2])||"true"===i||~~i&&~~i<=e,(a=elCreate("img")).className="woltlabAttachment",a.src=r[l][i?"thumbnailUrl":"url"],elData(a,"attachment-id",l),"left"===(n=t.attributes[1]||"none")?a.classList.add("messageFloatObjectLeft"):"right"===n&&a.classList.add("messageFloatObjectRight"),(s=t.metacode).parentNode.insertBefore(a,s),elRemove(s),t.cancel=!0)}.bind(this)),c=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,this._sync.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","destroy_"+this._editorId,function(){WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","submit_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","reset_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,d),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,c)}.bind(this)))},_editorUpload:function(e){var i=null;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",!0);var t=function(t){null===i?this._autoInsert.push(t):this._replaceOnLoad[t]=i,e.uploadID=t}.bind(this);e.file?this._upload(void 0,e.file,void 0,t):(this._upload(void 0,void 0,e.blob,t),i=e.replace||null)},_getImageAttachments:function(){var a={};return this._fileListSelector.children("li").each(function(t,e){var i=$(e);i.data("isImage")&&(a[~~i.data("objectID")]={thumbnailUrl:i.find(".jsButtonAttachmentInsertThumbnail").data("url"),url:i.find(".jsButtonAttachmentInsertFull").data("url")})}),a},_submitInline:function(t){var e;this._tmpHash&&(t.tmpHash=this._tmpHash,e={},WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","getMetaData_"+this._editorId,e),e.tmpHashes&&Array.isArray(e.tmpHashes)&&0<e.tmpHashes.length&&(t.tmpHash+=","+e.tmpHashes.join(",")))},_reset:function(){this._fileListSelector.hide().empty(),this._insertAllButton.hide(),this._validateLimit()},_validateLimit:function(){var t=this._buttonSelector.next("small.innerError"),e=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length,i=this._fileUpload?this._fileUpload.prop("files").length:0;if(e<=0||e<i){var a=e<=0?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,e);return t.length||(t=$('<small class="innerError" />').insertAfter(this._buttonSelector)),t.html(a),!1}return t.remove(),!0},_removeLimitError:function(t){var e=this._fileListSelector.children("li");e.filter(":not(.uploadFailed)").length||this._insertAllButton.hide(),e.length||this._fileListSelector.hide(),this._editorId&&t.button&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","deleteAttachment_"+this._editorId,{attachmentId:t.button.data("objectID")})},_upload:function(s,r,l,o){var m=this._super.bind(this);require(["WoltLabSuite/Core/FileUtil","WoltLabSuite/Core/Image/ImageUtil","WoltLabSuite/Core/Image/Resizer","WoltLabSuite/Core/Ajax/Status"],function(t,d,e,i){i.show();var a=[];r?a.push(r):l?a.push(t.blobToFile(l,"pasted-from-clipboard")):a=this._fileUpload.prop("files");var c,h,n=Promise.resolve(a);this._options.autoScale&&this._options.autoScale.enable&&(c=this._buttonSelector.data("maxSize"),h=new e,n=Array.prototype.reduce.call(a,function(t,o){return t.then(function(e){if(-1===["image/png","image/gif","image/jpeg"].indexOf(o.type))return e.push(o),e;var l=new Promise(function(t,e){setTimeout(function(){t(o)},1e4)}),t=h.loadFile(o).then(function(t){var e,i,a=t.exif,n=this._options.autoScale.maxWidth,s=this._options.autoScale.maxHeight,r=this._options.autoScale.quality;return 2<=window.devicePixelRatio&&(e=window.screen.width*window.devicePixelRatio,i=window.screen.height*window.devicePixelRatio,e-10<t.image.width&&t.image.width<10+e&&i-10<t.image.height&&(n=Math.min(n,window.screen.width))),h.resize(t.image,n,s,r,o.size>c,l).then(function(t){if(void 0===t)return o;var e=this._options.autoScale.fileType;return"keep"!==this._options.autoScale.fileType&&!d.containsTransparentPixels(t)||(e=o.type),h.saveFile({exif:a,image:t},o.name,e,r)}.bind(this)).then(function(t){return t.size>o.size?(console.debug('[WCF.Attachment] File size of "'+o.name+'" increased, uploading untouched image.'),o):t})}.bind(this)).catch(function(t){return console.debug('[WCF.Attachment] Failed to resize image "'+o.name+'":',t),o});return Promise.race([l,t]).then(function(t){return e.push(t),e})}.bind(this))}.bind(this),Promise.resolve([]))),n.then(function(t){var e=void 0;return this._validateLimit()&&(e=m(s,void 0,void 0,t)),this._fileUpload&&(this._removeButton(),this._createButton()),"function"==typeof o&&o(e),e}.bind(this)).catch(function(t){console.debug("[WCF.Attachment] Failed to upload attachments:",t)}).finally(i.hide)}.bind(this),function(t){console.debug("[WCF.Attachment] Failed to load modules:",t)})},_createUploadMatrix:function(t){return this._fileListSelector.children("li.uploadFailed").remove(),this._super(t)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(t){var e=$('<li class="box64 formAttachmentListItem"><span class="icon icon64 fa-spinner" /><div><div><p>'+t.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",t.name);return this._fileListSelector.append(e),this._fileListSelector.show(),this._buttonSelector.data("maxSize")<t.size&&(e.find("progress").remove(),e.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),e.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>")),e.addClass("uploadFailed")),e},_useThumbnail:function(){return!0},_success:function(t,e){var i,a,n,s,r,l,o,d,c,h,m;for(var u in this._uploadMatrix[t]){this._uploadMatrix[t].hasOwnProperty(u)&&((a=this._uploadMatrix[t][u]).find("progress").remove(),n=a.data("filename"),s=a.data("internalFileID"),e.returnValues&&e.returnValues.attachments[s]?(i=e.returnValues.attachments[s],elData(a[0],"object-id",i.attachmentID),i.tinyURL?(a.children(".fa-spinner").replaceWith($('<img src="'+i.tinyURL+'" alt="" class="attachmentTinyThumbnail" />')),a.data("height",i.height),a.data("width",i.width),elData(a[0],"is-image",i.isImage)):a.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-"+i.iconName),(r=$('<a href=""></a>')).text(n).attr("href",i.url),r[0].target="_blank",0!=i.isImage&&r.addClass("jsImageViewer").attr("title",n),a.find("p").empty().append(r),a.find("small").append(i.formattedFilesize),l=a.find("ul").addClass("buttonGroup"),o=$('<li><span class="button small jsDeleteButton" data-object-id="'+i.attachmentID+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>"),l.append(o),a.data("objectID",i.attachmentID),this._editorId&&(i.tinyURL?(i.thumbnailURL&&$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+i.attachmentID+'" data-url="'+WCF.String.escapeHTML(i.thumbnailURL)+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(l),$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+i.attachmentID+'" data-url="'+WCF.String.escapeHTML(i.url)+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(l)):$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+i.attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>").appendTo(l)),this._triggerSync("new",{html:a[0].outerHTML}),this._registerEditorButtons(a[0]),this._replaceOnLoad.hasOwnProperty(t)&&(a.hasClass("uploadFailed")||(d=this._replaceOnLoad[t])&&d.parentNode&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","replaceAttachment_"+this._editorId,{attachmentId:i.attachmentID,img:d,src:i.thumbnailURL?i.thumbnailURL:i.url}),this._replaceOnLoad[t]=null)):(a.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),h="",e.returnValues&&e.returnValues.errors[s]?"uploadFailed"===(h=(c=e.returnValues.errors[s]).errorType)&&c.additionalData.phpLimitExceeded&&(h="uploadPhpLimit"):h="uploadFailed",a.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+h)+"</small>")),a.addClass("uploadFailed")),WCF.inArray(t,this._autoInsert)&&(this._autoInsert.splice(this._autoInsert.indexOf(t),1),a.hasClass("uploadFailed")||((m=a.find(".jsButtonAttachmentInsertThumbnail")).length||(m=a.find(".jsButtonAttachmentInsertFull")),m.trigger("click"))))}this._rebuildInterface()},_rebuildInterface:function(){this._makeSortable(),this._fileListSelector.children("li:not(.uploadFailed)").length?this._insertAllButton.show():this._insertAllButton.hide(),WCF.DOMNodeInsertedHandler.execute()},_registerEditorButtons:function(t){this._editorId&&elBySelAll(".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain",t,function(t){t.addEventListener("click",this._insert.bind(this))}.bind(this))},_insert:function(t){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId,{attachmentId:elData(t.currentTarget,"object-id"),url:elData(t.currentTarget,"url")})},_insertAll:function(){for(var t,e,i=0,a=this._fileListSelector[0].childNodes.length;i<a;i++)"LI"!==(t=this._fileListSelector[0].childNodes[i]).nodeName||t.classList.contains("uploadFailed")||(null===(e=elBySel(".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain",t))&&(e=elBySel(".jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain",t)),window.jQuery(e).trigger("click"))},_error:function(a){this._fileListSelector.find("li").each(function(t,e){var i=$(e);i.children(".fa-spinner").length&&(i.addClass("uploadFailed").children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),i.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 t=this._fileListSelector.children("li:not(.uploadFailed)");t.length&&(t.addClass("sortableAttachment").children("img").addClass("sortableNode"),this._fileListSelector.hasClass("sortableList")||(this._fileListSelector.addClass("sortableList"),require(["Environment"],function(t){"desktop"===t.platform()&&new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:!1,items:"li.sortableAttachment",toleranceElement:null,start:function(t,e){e.placeholder[0].style.setProperty("height",e.helper[0].offsetHeight+"px","")},update:function(){var i=[];this._fileListSelector.children("li:not(.uploadFailed)").each(function(t,e){i.push($(e).data("objectID"))}),i.length&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:i,objectID:this._objectID,objectType:this._objectType,tmpHash:this._tmpHash}}})}.bind(this)},!0)}.bind(this))))},_onDelete:function(t){var e=elData(t.button[0],"object-id"),i=elBySel('.formAttachmentListItem[data-object-id="'+e+'"]',this._fileListSelector[0]);null!==i&&elRemove(i),this._removeLimitError(t)},_sync:function(t){if(t.source!==this)switch(t.type){case"new":this._syncNew(t.data);break;default:throw new Error("Unexpected type '"+t.type+"'")}},_syncNew:function(a){require(["Dom/Util"],function(t){var e=t.createFragmentFromHtml(a.html),i=elBySel("li",e);i.id="",this._registerEditorButtons(i),this._fileListSelector[0].appendChild(i),elShow(this._fileListSelector[0]),this._rebuildInterface()}.bind(this))},_triggerSync:function(t,e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,{source:this,type:t,data:e})}}); })(this);
+(function (window, undefined) { "use strict";WCF.Attachment={},WCF.Attachment.Upload=WCF.Upload.extend({_autoInsert:[],_insertAllButton:null,_objectType:"",_objectID:0,_tmpHash:"",_parentObjectID:0,_editorId:"",_replaceOnLoad:{},_options:{},init:function(t,e,i,a,n,s,r,l,o){var d,c;this._super(t,e,"wcf\\data\\attachment\\AttachmentAction",{multiple:!0,maxUploads:r}),this._autoInsert=[],this._objectType=i,this._objectID=parseInt(a),this._tmpHash=n,this._parentObjectID=parseInt(s),this._editorId=l,this._options=$.extend(!0,this._options,o||{}),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._onDelete.bind(this)),this._makeSortable(),this._insertAllButton=$('<p class="button jsButtonAttachmentInsertAll">'+WCF.Language.get("wcf.attachment.insertAll")+"</p>").hide(),this._editorId&&(this._insertAllButton.appendTo(this._buttonSelector),this._insertAllButton.click($.proxy(this._insertAll,this)),this._fileListSelector.children("li:not(.uploadFailed)").length&&this._insertAllButton.show(),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+this._editorId,this._submitInline.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+this._editorId,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId,this._editorUpload.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId,function(t){t.tmpHashes&&Array.isArray(t.tmpHashes)||(t.tmpHashes=[]);var e=t.tmpHashes.indexOf(n);0<this._fileListSelector.children("li:not(.uploadFailed)").length?-1===e&&t.tmpHashes.push(n):-1!==e&&t.tmpHashes.splice(e)}.bind(this)),d=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,function(t){var e,i,a,n,s,r=this._getImageAttachments(),l=t.attributes[0]||0;r.hasOwnProperty(l)&&(e=~~$("#"+this._editorId).data("redactor").opts.woltlab.attachmentThumbnailWidth,i=!0===(i=t.attributes[2])||"true"===i||~~i&&~~i<=e,(a=elCreate("img")).className="woltlabAttachment",a.src=r[l][i?"thumbnailUrl":"url"],elData(a,"attachment-id",l),"left"===(n=t.attributes[1]||"none")?a.classList.add("messageFloatObjectLeft"):"right"===n&&a.classList.add("messageFloatObjectRight"),(s=t.metacode).parentNode.insertBefore(a,s),elRemove(s),t.cancel=!0)}.bind(this)),c=WCF.System.Event.addListener("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,this._sync.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","destroy_"+this._editorId,function(){WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","submit_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","reset_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","dragAndDrop_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","pasteFromClipboard_"+this._editorId),WCF.System.Event.removeAllListeners("com.woltlab.wcf.redactor2","autosaveMetaData_"+this._editorId),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","metacode_attach_"+this._editorId,d),WCF.System.Event.removeListener("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,c)}.bind(this)))},_editorUpload:function(e){var i=null;this._fileListSelector.closest(".messageTabMenu").messageTabMenu("showTab","attachments",!0);var t=function(t){null===i?this._autoInsert.push(t):this._replaceOnLoad[t]=i,e.uploadID=t}.bind(this);e.file?this._upload(void 0,e.file,void 0,t):(this._upload(void 0,void 0,e.blob,t),i=e.replace||null)},_getImageAttachments:function(){var a={};return this._fileListSelector.children("li").each(function(t,e){var i=$(e);i.data("isImage")&&(a[~~i.data("objectID")]={thumbnailUrl:i.find(".jsButtonAttachmentInsertThumbnail").data("url"),url:i.find(".jsButtonAttachmentInsertFull").data("url")})}),a},_submitInline:function(t){var e;this._tmpHash&&(t.tmpHash=this._tmpHash,e={},WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","getMetaData_"+this._editorId,e),e.tmpHashes&&Array.isArray(e.tmpHashes)&&0<e.tmpHashes.length&&(t.tmpHash+=","+e.tmpHashes.join(",")))},_reset:function(){this._fileListSelector.hide().empty(),this._insertAllButton.hide(),this._validateLimit()},_validateLimit:function(){var t=this._buttonSelector.next("small.innerError"),e=this._options.maxUploads-this._fileListSelector.children("li:not(.uploadFailed)").length,i=this._fileUpload?this._fileUpload.prop("files").length:0;if(e<=0||e<i){var a=e<=0?WCF.Language.get("wcf.attachment.upload.error.reachedLimit"):WCF.Language.get("wcf.attachment.upload.error.reachedRemainingLimit").replace(/#remaining#/,e);return t.length||(t=$('<small class="innerError" />').insertAfter(this._buttonSelector)),t.html(a),!1}return t.remove(),!0},_removeLimitError:function(t){var e=this._fileListSelector.children("li");e.filter(":not(.uploadFailed)").length||this._insertAllButton.hide(),e.length||this._fileListSelector.hide(),this._editorId&&t.button&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","deleteAttachment_"+this._editorId,{attachmentId:t.button.data("objectID")})},_upload:function(s,r,l,o){var m=this._super.bind(this);require(["WoltLabSuite/Core/FileUtil","WoltLabSuite/Core/Image/ImageUtil","WoltLabSuite/Core/Image/Resizer","WoltLabSuite/Core/Ajax/Status"],function(t,d,e,i){i.show();var a=[];r?a.push(r):l?a.push(t.blobToFile(l,"pasted-from-clipboard")):a=this._fileUpload.prop("files");var c,h,n=Promise.resolve(a);this._options.autoScale&&this._options.autoScale.enable&&(c=this._buttonSelector.data("maxSize"),h=new e,n=Array.prototype.reduce.call(a,function(t,o){return t.then(function(e){if(-1===["image/png","image/jpeg"].indexOf(o.type))return e.push(o),e;var l=new Promise(function(t,e){setTimeout(function(){t(o)},1e4)}),t=h.loadFile(o).then(function(t){var e,i,a=t.exif,n=this._options.autoScale.maxWidth,s=this._options.autoScale.maxHeight,r=this._options.autoScale.quality;return 2<=window.devicePixelRatio&&(e=window.screen.width*window.devicePixelRatio,i=window.screen.height*window.devicePixelRatio,e-10<t.image.width&&t.image.width<10+e&&i-10<t.image.height&&(n=Math.min(n,window.screen.width))),h.resize(t.image,n,s,r,o.size>c,l).then(function(t){if(void 0===t)return o;var e=this._options.autoScale.fileType;return"keep"!==this._options.autoScale.fileType&&!d.containsTransparentPixels(t)||(e=o.type),h.saveFile({exif:a,image:t},o.name,e,r)}.bind(this)).then(function(t){return t.size>o.size?(console.debug('[WCF.Attachment] File size of "'+o.name+'" increased, uploading untouched image.'),o):t})}.bind(this)).catch(function(t){return console.debug('[WCF.Attachment] Failed to resize image "'+o.name+'":',t),o});return Promise.race([l,t]).then(function(t){return e.push(t),e})}.bind(this))}.bind(this),Promise.resolve([]))),n.then(function(t){var e=void 0;return this._validateLimit()&&(e=m(s,void 0,void 0,t)),this._fileUpload&&(this._removeButton(),this._createButton()),"function"==typeof o&&o(e),e}.bind(this)).catch(function(t){console.debug("[WCF.Attachment] Failed to upload attachments:",t)}).finally(i.hide)}.bind(this),function(t){console.debug("[WCF.Attachment] Failed to load modules:",t)})},_createUploadMatrix:function(t){return this._fileListSelector.children("li.uploadFailed").remove(),this._super(t)},_getParameters:function(){return{objectType:this._objectType,objectID:this._objectID,tmpHash:this._tmpHash,parentObjectID:this._parentObjectID}},_initFile:function(t){var e=$('<li class="box64 formAttachmentListItem"><span class="icon icon64 fa-spinner" /><div><div><p>'+t.name+'</p><small><progress max="100"></progress></small></div><ul></ul></div></li>').data("filename",t.name);return this._fileListSelector.append(e),this._fileListSelector.show(),this._buttonSelector.data("maxSize")<t.size&&(e.find("progress").remove(),e.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),e.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error.tooLarge")+"</small>")),e.addClass("uploadFailed")),e},_useThumbnail:function(){return!0},_success:function(t,e){var i,a,n,s,r,l,o,d,c,h,m;for(var u in this._uploadMatrix[t]){this._uploadMatrix[t].hasOwnProperty(u)&&((a=this._uploadMatrix[t][u]).find("progress").remove(),n=a.data("filename"),s=a.data("internalFileID"),e.returnValues&&e.returnValues.attachments[s]?(i=e.returnValues.attachments[s],elData(a[0],"object-id",i.attachmentID),i.tinyURL?(a.children(".fa-spinner").replaceWith($('<img src="'+i.tinyURL+'" alt="" class="attachmentTinyThumbnail" />')),a.data("height",i.height),a.data("width",i.width),elData(a[0],"is-image",i.isImage)):a.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-"+i.iconName),(r=$('<a href=""></a>')).text(n).attr("href",i.url),r[0].target="_blank",0!=i.isImage&&r.addClass("jsImageViewer").attr("title",n),a.find("p").empty().append(r),a.find("small").append(i.formattedFilesize),l=a.find("ul").addClass("buttonGroup"),o=$('<li><span class="button small jsDeleteButton" data-object-id="'+i.attachmentID+'" data-confirm-message="'+WCF.Language.get("wcf.attachment.delete.sure")+'" data-event-name="attachment">'+WCF.Language.get("wcf.global.button.delete")+"</span></li>"),l.append(o),a.data("objectID",i.attachmentID),this._editorId&&(i.tinyURL?(i.thumbnailURL&&$('<li><span class="button small jsButtonAttachmentInsertThumbnail" data-object-id="'+i.attachmentID+'" data-url="'+WCF.String.escapeHTML(i.thumbnailURL)+'">'+WCF.Language.get("wcf.attachment.insertThumbnail")+"</span></li>").appendTo(l),$('<li><span class="button small jsButtonAttachmentInsertFull" data-object-id="'+i.attachmentID+'" data-url="'+WCF.String.escapeHTML(i.url)+'">'+WCF.Language.get("wcf.attachment.insertFull")+"</span></li>").appendTo(l)):$('<li><span class="button small jsButtonAttachmentInsertPlain" data-object-id="'+i.attachmentID+'">'+WCF.Language.get("wcf.attachment.insert")+"</span></li>").appendTo(l)),this._triggerSync("new",{html:a[0].outerHTML}),this._registerEditorButtons(a[0]),this._replaceOnLoad.hasOwnProperty(t)&&(a.hasClass("uploadFailed")||(d=this._replaceOnLoad[t])&&d.parentNode&&WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","replaceAttachment_"+this._editorId,{attachmentId:i.attachmentID,img:d,src:i.thumbnailURL?i.thumbnailURL:i.url}),this._replaceOnLoad[t]=null)):(a.children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),h="",e.returnValues&&e.returnValues.errors[s]?"uploadFailed"===(h=(c=e.returnValues.errors[s]).errorType)&&c.additionalData.phpLimitExceeded&&(h="uploadPhpLimit"):h="uploadFailed",a.find("div > div").append($('<small class="innerError">'+WCF.Language.get("wcf.attachment.upload.error."+h)+"</small>")),a.addClass("uploadFailed")),WCF.inArray(t,this._autoInsert)&&(this._autoInsert.splice(this._autoInsert.indexOf(t),1),a.hasClass("uploadFailed")||((m=a.find(".jsButtonAttachmentInsertThumbnail")).length||(m=a.find(".jsButtonAttachmentInsertFull")),m.trigger("click"))))}this._rebuildInterface()},_rebuildInterface:function(){this._makeSortable(),this._fileListSelector.children("li:not(.uploadFailed)").length?this._insertAllButton.show():this._insertAllButton.hide(),WCF.DOMNodeInsertedHandler.execute()},_registerEditorButtons:function(t){this._editorId&&elBySelAll(".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain",t,function(t){t.addEventListener("click",this._insert.bind(this))}.bind(this))},_insert:function(t){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertAttachment_"+this._editorId,{attachmentId:elData(t.currentTarget,"object-id"),url:elData(t.currentTarget,"url")})},_insertAll:function(){for(var t,e,i=0,a=this._fileListSelector[0].childNodes.length;i<a;i++)"LI"!==(t=this._fileListSelector[0].childNodes[i]).nodeName||t.classList.contains("uploadFailed")||(null===(e=elBySel(".jsButtonAttachmentInsertThumbnail, .jsButtonAttachmentInsertPlain",t))&&(e=elBySel(".jsButtonAttachmentInsertFull, .jsButtonAttachmentInsertPlain",t)),window.jQuery(e).trigger("click"))},_error:function(a){this._fileListSelector.find("li").each(function(t,e){var i=$(e);i.children(".fa-spinner").length&&(i.addClass("uploadFailed").children(".fa-spinner").removeClass("fa-spinner").addClass("fa-ban"),i.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 t=this._fileListSelector.children("li:not(.uploadFailed)");t.length&&(t.addClass("sortableAttachment").children("img").addClass("sortableNode"),this._fileListSelector.hasClass("sortableList")||(this._fileListSelector.addClass("sortableList"),require(["Environment"],function(t){"desktop"===t.platform()&&new WCF.Sortable.List(this._fileListSelector.parent().wcfIdentify(),"",0,{axis:!1,items:"li.sortableAttachment",toleranceElement:null,start:function(t,e){e.placeholder[0].style.setProperty("height",e.helper[0].offsetHeight+"px","")},update:function(){var i=[];this._fileListSelector.children("li:not(.uploadFailed)").each(function(t,e){i.push($(e).data("objectID"))}),i.length&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"updatePosition",className:"wcf\\data\\attachment\\AttachmentAction",parameters:{attachmentIDs:i,objectID:this._objectID,objectType:this._objectType,tmpHash:this._tmpHash}}})}.bind(this)},!0)}.bind(this))))},_onDelete:function(t){var e=elData(t.button[0],"object-id"),i=elBySel('.formAttachmentListItem[data-object-id="'+e+'"]',this._fileListSelector[0]);null!==i&&elRemove(i),this._removeLimitError(t)},_sync:function(t){if(t.source!==this)switch(t.type){case"new":this._syncNew(t.data);break;default:throw new Error("Unexpected type '"+t.type+"'")}},_syncNew:function(a){require(["Dom/Util"],function(t){var e=t.createFragmentFromHtml(a.html),i=elBySel("li",e);i.id="",this._registerEditorButtons(i),this._fileListSelector[0].appendChild(i),elShow(this._fileListSelector[0]),this._rebuildInterface()}.bind(this))},_triggerSync:function(t,e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","sync_"+this._tmpHash,{source:this,type:t,data:e})}}); })(this);
// WCF.ColorPicker.js
(function (window, undefined) { "use strict";WCF.ColorPicker=Class.extend({_bar:null,_barActive:!1,_barSelector:null,_callbackSubmit:null,_dialog:null,_didInit:!1,_elementID:"",_gradient:null,_gradientActive:!1,_gradientSelector:null,_hex:null,_hsv:{},_newColor:null,_oldColor:null,_rgba:{},_rgbaRegExp:null,init:function(t){this._callbackSubmit=null,this._elementID="",this._hsv={h:0,s:100,v:100},this._position={};var a=$(t);a.length?a.click($.proxy(this._open,this)):console.debug("[WCF.ColorPicker] Selector does not match any element, aborting.")},setCallbackSubmit:function(t){this._callbackSubmit=t},_open:function(t){this._didInit||(this._initColorPicker(),this._didInit=!0);var a=$(t.currentTarget);this._elementID=a.wcfIdentify(),this._parseColor(a);var i=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v);this._oldColor.css({backgroundColor:"rgba("+i.r+", "+i.g+", "+i.b+", "+this._rgba.a.val()/100+")"}),this._dialog.wcfDialog({backdropCloseOnClick:!1,title:WCF.Language.get("wcf.style.colorPicker")}),window.setTimeout(function(){this._hex.focus()}.bind(this),200)},_parseColor:function(t){if(t.data("hsv")&&t.data("rgb")){var a=t.data("hsv");for(var i in a)this._hsv[i]=a[i];this._updateValues(t.data("rgb"),!0,!0),this._rgba.a.val(parseInt(t.data("alpha")))}else{t.data("color").match(/^rgb\((\d{1,3}), ?(\d{1,3}), ?(\d{1,3})\)$/)&&t.data("color","rgba("+RegExp.$1+", "+RegExp.$2+", "+RegExp.$3+", 1)"),null===this._rgbaRegExp&&(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(t.data("color"));var s=RegExp.$4;0===s.indexOf(".")&&(s="0"+s),s*=100,this._updateValues({r:RegExp.$1,g:RegExp.$2,b:RegExp.$3,a:Math.round(s)},!0,!0)}},_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(t){a._barActive?(a._barActive=!1,a._mouseBar(t)):a._gradientActive&&(a._gradientActive=!1,a._mouseGradient(t))}).mousemove(function(t){a._barActive?a._mouseBar(t):a._gradientActive&&a._mouseGradient(t)}),this._initColorPickerForm()},_initColorPickerForm:function(){var t=$('<div id="colorPickerForm" />').appendTo(this._dialog);$("<small>"+WCF.Language.get("wcf.style.colorPicker.new")+"</small>").appendTo(t);var a=$('<ul class="colors" />').appendTo(t);this._newColor=$('<li class="new"><span /></li>').appendTo(a).children("span"),this._oldColor=$('<li class="old"><span /></li>').appendTo(a).children("span"),$("<small>"+WCF.Language.get("wcf.style.colorPicker.current")+"</small>").appendTo(t);var i=$('<ul class="rgba" />').appendTo(t);this._createInputElement("r","R",0,255).appendTo(i),this._createInputElement("g","G",0,255).appendTo(i),this._createInputElement("b","B",0,255).appendTo(i),this._createInputElement("a","a",0,100).appendTo(i);var s=$('<ul class="hex"><li><label><span>#</span></label></li></ul>').appendTo(t);this._hex=$('<input type="text" maxlength="6" />').appendTo(s.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 e=$('<div class="formSubmit" />').appendTo(this._dialog);$('<button class="buttonPrimary">'+WCF.Language.get("wcf.style.colorPicker.button.apply")+"</button>").appendTo(e).click($.proxy(this._submit,this));var r=this;this._hex.on("paste",function(){r._hex.attr("maxlength","7"),setTimeout(function(){var t=r._hex.val();"#"==t.substring(0,1)&&(t=t.substr(1)),6<t.length&&(t=t.substring(0,6)),r._hex.attr("maxlength","6").val(t)},50)}),t.find("input").focus(function(){this.select()})},_keyUpRGBA:function(t){13==t.which&&(this._blurRgba(),this._submit())},_keyUpHex:function(t){13==t.which&&(this._blurHex(),this._submit())},_submit:function(){var t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),a={};for(var i in this._hsv)a[i]=this._hsv[i];var s=$("#"+this._elementID);s.data("hsv",a).css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+this._rgba.a.val()/100+")"}).data("alpha",parseInt(this._rgba.a.val())),s.data("rgb",{r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()}),$("#"+s.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"),"function"==typeof this._callbackSubmit&&this._callbackSubmit({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val(),a:this._rgba.a.val()/100})},_createInputElement:function(t,a,i,s){var e=$('<li class="'+t+'" />'),r=$("<label />").appendTo(e);return $("<span>"+a+"</span>").appendTo(r),this._rgba[t]=$('<input type="number" value="0" min="'+i+'" max="'+s+'" step="1" />').appendTo(r),e},_mouseDownGradient:function(t){this._gradientActive=!0,this._mouseGradient(t)},_mouseGradient:function(t){var a=this._gradient.getOffsets("offset"),i=Math.max(Math.min(t.pageX-a.left,255),0),s=Math.max(Math.min(t.pageY-a.top,255),0);this._hsv.s=100*Math.max(0,Math.min(1,i/255)),this._hsv.v=100*Math.max(0,Math.min(1,(255-s)/255)),this._updateValues(null)},_mouseDownBar:function(t){this._barActive=!0,this._mouseBar(t)},_mouseBar:function(t){var a=this._bar.getOffsets("offset"),i=Math.max(Math.min(t.pageY-a.top,255),0);this._barSelector.css({top:i+"px"}),this._hsv.h=Math.max(0,Math.min(359,Math.round((255-i)/255*360))),this._updateValues(null)},_blurRgba:function(){for(var t in this._rgba){var a=parseInt(this._rgba[t].val())||0;"a"===t?this._rgba[t].val(Math.max(0,Math.min(100,a))):this._rgba[t].val(Math.max(0,Math.min(255,a)))}this._updateValues({r:this._rgba.r.val(),g:this._rgba.g.val(),b:this._rgba.b.val()},!0,!0)},_blurHex:function(){var t=this.hexToRgb(this._hex.val());t!==Number.NaN&&this._updateValues(t,!0,!0)},_updateValues:function(t,a,i){for(var s in a=!0===a,i=!0===i,null===t&&(t=this.hsvToRgb(this._hsv.h,this._hsv.s,this._hsv.v),0==this._rgba.a.val()&&(t.a=100)),void 0===t.a&&(t.a=this._rgba.a.val()),t)this._rgba[s].val(t[s]);var e;this._hex.val(this.rgbToHex(t.r,t.g,t.b)),(a||i)&&(e=this.rgbToHsv(t.r,t.g,t.b),a&&(this._hsv.h=e.h),i&&(this._hsv.s=e.s,this._hsv.v=e.v));var r=Math.max(0,Math.min(255,255-this._hsv.h/360*255));this._barSelector.css({top:r+"px"});var o=Math.max(0,Math.min(255,this._hsv.s/100*255)),r=Math.max(0,Math.min(255,255-this._hsv.v/100*255));this._gradientSelector.css({left:o-6+"px",top:r-6+"px"}),this._newColor.css({backgroundColor:"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a/100+")"});var h=this.hsvToRgb(this._hsv.h,100,100);this._gradient.css({backgroundColor:"rgb("+h.r+", "+h.g+", "+h.b+")"})},hsvToRgb:function(t,a,i){return window.__wcf_bc_colorUtil.hsvToRgb(t,a,i)},rgbToHsv:function(t,a,i){return window.__wcf_bc_colorUtil.rgbToHsv(t,a,i)},hexToRgb:function(t){return window.__wcf_bc_colorUtil.hexToRgb(t)},rgbToHex:function(t,a,i){return window.__wcf_bc_colorUtil.rgbToHex(t,a,i)}}),void 0===window.__wcf_bc_colorUtil&&require(["ColorUtil"],function(t){}),"function"==typeof window.__wcf_bc_colorPickerInit&&window.__wcf_bc_colorPickerInit(); })(this);
(function (window, undefined) { "use strict";function gm_authFailure(){WCF.System.Event.fireEvent("com.woltlab.wcf.googleMaps","authenticationFailure")}WCF.Location={},WCF.Location.Util={getLocation:function(e,t){var o=WCF.Location.GoogleMaps.Settings.get("accessUserLocation");navigator.geolocation&&null!==o&&o?navigator.geolocation.getCurrentPosition(function(t){e(t.coords.latitude,t.coords.longitude)},function(){e(void 0,void 0)},{timeout:t||5e3}):e(void 0,void 0)}},WCF.Location.GoogleMaps={},WCF.Location.GoogleMaps.Settings={_settings:{},get:function(t){return void 0===t?this._settings:void 0!==this._settings[t]?this._settings[t]:null},set:function(t,e){if($.isPlainObject(t))for(var o in t)this._settings[o]=t[o];else this._settings[t]=e}},WCF.Location.GoogleMaps.Map=Class.extend({_map:null,_markers:[],init:function(t,e){this._mapContainer=$("#"+t),this._mapOptions=$.extend(!0,this._getDefaultMapOptions(),e),this._map=new google.maps.Map(this._mapContainer[0],this._mapOptions),this._markers=[],this._mapContainer.parents(".sidebar").length&&require(["Ui/Screen"],function(t){t.on("screen-sm-down",{setup:$.proxy(this._addSidebarMapListener,this)})}.bind(this)),this.refresh()},_addInfoWindowEventListener:function(t,e){google.maps.event.addListener(t,"click",$.proxy(function(){e.open(this._map,t)},this))},_addSidebarMapListener:function(){$(".content > .mobileSidebarToggleButton").click($.proxy(this.refresh,this))},_getDefaultMapOptions:function(){var t={};switch(t.center=new google.maps.LatLng(WCF.Location.GoogleMaps.Settings.get("defaultLatitude"),WCF.Location.GoogleMaps.Settings.get("defaultLongitude")),t.disableDoubleClickZoom=WCF.Location.GoogleMaps.Settings.get("disableDoubleClickZoom"),t.draggable=WCF.Location.GoogleMaps.Settings.get("draggable"),WCF.Location.GoogleMaps.Settings.get("mapType")){case"map":t.mapTypeId=google.maps.MapTypeId.ROADMAP;break;case"satellite":t.mapTypeId=google.maps.MapTypeId.SATELLITE;break;case"physical":t.mapTypeId=google.maps.MapTypeId.TERRAIN;break;case"hybrid":default:t.mapTypeId=google.maps.MapTypeId.HYBRID}if(t.mapTypeControl="off"!=WCF.Location.GoogleMaps.Settings.get("mapTypeControl"),t.mapTypeControl)switch(WCF.Location.GoogleMaps.Settings.get("mapTypeControl")){case"dropdown":t.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.DROPDOWN_MENU};break;case"horizontalBar":t.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.HORIZONTAL_BAR};break;default:t.mapTypeControlOptions={style:google.maps.MapTypeControlStyle.DEFAULT}}return t.scaleControl=WCF.Location.GoogleMaps.Settings.get("scaleControl"),t.scrollwheel=WCF.Location.GoogleMaps.Settings.get("scrollwheel"),t.zoom=WCF.Location.GoogleMaps.Settings.get("zoom"),t},addDraggableMarker:function(t,e){var o=new google.maps.Marker({clickable:!1,draggable:!0,map:this._map,position:new google.maps.LatLng(t,e),zIndex:1});return this._markers.push(o),o},addMarker:function(t,e,o,s,i){var a,n=new google.maps.Marker({map:this._map,position:new google.maps.LatLng(t,e),title:o});return s&&n.setIcon(s),i&&(a=new google.maps.InfoWindow({content:i}),this._addInfoWindowEventListener(n,a),n.infoWindow=a),this._markers.push(n),n},getMarkers:function(){return this._markers},getMap:function(){return this._map},refresh:function(){var t=this._map.getCenter();google.maps.event.trigger(this._map,"resize"),this._map.setCenter(t)},refreshBounds:function(){var t=null,e=null,o=null,s=null;for(var i in this._markers){var a=this._markers[i],n=a.getPosition().lat(),r=a.getPosition().lng();null===t?(t=e=n,o=s=r):(n<t?t=n:e<n&&(e=n),n<o?o=n:s<r&&(s=r))}this._map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(t,o),new google.maps.LatLng(e,s)))},removeMarkers:function(){for(var t in this._markers)this._markers[t].setMap(null);this._markers=[]},setBounds:function(t,e){this._map.fitBounds(new google.maps.LatLngBounds(new google.maps.LatLng(e.latitude,e.longitude),new google.maps.LatLng(t.latitude,t.longitude)))},setCenter:function(t,e){this._map.setCenter(new google.maps.LatLng(t,e))}}),WCF.Location.GoogleMaps.LargeMap=WCF.Location.GoogleMaps.Map.extend({_actionClassName:null,_additionalParameters:{},_locationSearch:null,_locationSearchInputSelector:null,_markerClusterer:null,_objectIDs:[],_previousNorthEast:null,_previousSouthWest:null,_stringifyExcludedObjectIds:!1,init:function(t,e,o,s,i){this._stringifyExcludedObjectIds=!1,e&&e.stringifyExcludedObjectIds&&(this._stringifyExcludedObjectIds=e.stringifyExcludedObjectIds,delete e.stringifyExcludedObjectIds),this._super(t,e),this._actionClassName=o,this._locationSearchInputSelector=s||"",this._additionalParameters=i||{},this._objectIDs=[],this._locationSearchInputSelector&&(this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(s,$.proxy(this._centerMap,this))),this._markerClusterer=new MarkerClusterer(this._map,this._markers,{maxZoom:17,imagePath:WCF.Location.GoogleMaps.Settings.get("markerClustererImagePath")+"m"}),this._markerSpiderfier=new OverlappingMarkerSpiderfier(this._map,{keepSpiderfied:!0,markersWontHide:!0,markersWontMove:!0}),this._markerSpiderfier.addListener("click",$.proxy(function(t){t.infoWindow&&t.infoWindow.open(this._map,t)},this)),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)}),this._previousNorthEast=null,this._previousSouthWest=null,google.maps.event.addListener(this._map,"idle",$.proxy(this._loadMarkers,this))},_addInfoWindowEventListener:function(t,e){},_centerMap:function(t){this.setCenter(t.location.lat(),t.location.lng()),$(this._locationSearchInputSelector).val(t.label)},_loadMarkers:function(){var t=this._map.getBounds().getNorthEast(),e=this._map.getBounds().getSouthWest();return!(this._previousNorthEast&&this._previousNorthEast.lat()>=t.lat()&&this._previousNorthEast.lng()>=t.lng()&&this._previousSouthWest.lat()<=e.lat()&&this._previousSouthWest.lng()<=e.lng())&&(this._previousNorthEast=t,this._previousSouthWest=e,this._proxy.setOption("data",{actionName:"getMapMarkers",className:this._actionClassName,parameters:$.extend(this._additionalParameters,{excludedObjectIDs:this._stringifyExcludedObjectIds?JSON.stringify(this._objectIDs):this._objectIDs,eastLongitude:t.lng(),northLatitude:t.lat(),southLatitude:e.lat(),westLongitude:e.lng()})}),this._proxy.sendRequest(),!0)},_success:function(t,e,o){if(t.returnValues&&t.returnValues.markers)for(var s in t.returnValues.markers){var i=t.returnValues.markers[s];this.addMarker(i.latitude,i.longitude,i.title,null,i.infoWindow),i.objectID?this._objectIDs.push(i.objectID):i.objectIDs&&(this._objectIDs=this._objectIDs.concat(i.objectIDs))}},addMarker:function(t,e,o,s,i){var a=this._super(t,e,o,s,i);return this._markerClusterer.addMarker(a),this._markerSpiderfier.addMarker(a),a}}),WCF.Location.GoogleMaps.SuggestionMap=WCF.Location.GoogleMaps.LargeMap.extend({_locationSuggestionsButton:null,_suggestionSelectionCallback:null,init:function(t,e,o,s,i){this._super(t,e,o,s,i);var a=$('<div class="gmnoprint googleMapsCustomControlContainer"><div class="gm-style-mtc"><div class="googleMapsCustomControl">'+WCF.Language.get("wcf.map.showLocationSuggestions")+"</div></div></div>");this._locationSuggestionsButton=a.find(".googleMapsCustomControl").click($.proxy(this._toggleLocationSuggestions,this)),this._map.controls[google.maps.ControlPosition.TOP_RIGHT].push(a.get(0))},_loadMarkers:function(){this._locationSuggestionsButton.hasClass("active")&&(this._super()||(this._loadSuggestions=!1))},_success:function(t,e,o){var s=this._markers.length;this._super(t,e,o),this._loadSuggestions&&s==this._markers.length&&(this._loadSuggestions=!1,new WCF.System.Notification(WCF.Language.get("wcf.map.noLocationSuggestions"),"info").show())},_toggleLocationSuggestions:function(){var t=!this._locationSuggestionsButton.hasClass("active");t&&(this._loadSuggestions=!0),this.showSuggestions(t)},addMarker:function(t,e,o,s,i){var a=$(i),n=$('<a class="googleMapsUseLocationSuggestionLink" />').text(WCF.Language.get("wcf.map.useLocationSuggestion")).click(this._suggestionSelectionCallback);a.append($("<p />").append(n));var r=this._super(t,e,o,"//mt.google.com/vt/icon/name=icons/spotlight/spotlight-waypoint-a.png",a.get(0));return n.data("marker",r),r},setSuggestionSelectionCallback:function(t){this._suggestionSelectionCallback=t},showSuggestions:function(t){void 0===t&&(t=!0),this._locationSuggestionsButton.toggleClass("active",t);for(var e=[],o=0,s=this._markers.length;o<s;o++){var i=this._markers[o];i.draggable||(i.setVisible(t),t&&e.push(i))}this._markerClusterer.clearMarkers(),t&&this._markerClusterer.addMarkers(e),this._loadMarkers()}}),WCF.Location.GoogleMaps.LocationSearch=WCF.Search.Base.extend({_geocoder:null,init:function(t,e,o,s,i){this._super(t,e,o,s,i),this.setDelay(500),this._geocoder=new google.maps.Geocoder},_createListItem:function(t){var e=$("<li><span>"+WCF.String.escapeHTML(t.formatted_address)+"</span></li>").appendTo(this._list);return e.data("location",t.geometry.location).data("label",t.formatted_address).click($.proxy(this._executeCallback,this)),this._itemCount++,e},_keyUp:function(t){switch(t.which){case $.ui.keyCode.LEFT:case $.ui.keyCode.RIGHT:return;case $.ui.keyCode.UP:return void this._selectPreviousItem();case $.ui.keyCode.DOWN:return void this._selectNextItem();case $.ui.keyCode.ENTER:return this._selectElement(t)}var e=this._getSearchString(t);""===e?this._clearList(!0):e.length>=this._triggerLength?this._delay?(null!==this._timer&&this._timer.stop(),this._timer=new WCF.PeriodicalExecuter($.proxy(function(){this._geocoder.geocode({address:e},$.proxy(this._success,this)),this._timer.stop(),this._timer=null},this),this._delay)):this._geocoder.geocode({address:e},$.proxy(this._success,this)):this._clearList(!1)},_success:function(t,e){if(this._clearList(!1),e==google.maps.GeocoderStatus.OK){if($.getLength(t)){var o=0;for(var s in t)if(this._createListItem(t[s]),10==++o)break}else if(!this._handleEmptyResult())return;WCF.CloseOverlayHandler.addCallback("WCF.Search.Base",$.proxy(function(){this._clearList()},this));var i=this._searchInput.parents(".dropdown").wcfIdentify();WCF.Dropdown.getDropdownMenu(i).hasClass("dropdownOpen")||WCF.Dropdown.toggleDropdown(i,!0),this._itemIndex=-1,WCF.Dropdown.getDropdown(i).data("disableAutoFocus")||this._selectNextItem()}}}),WCF.Location.GoogleMaps.LocationInput=Class.extend({_locationSearch:null,_map:null,_marker:null,init:function(t,e,o,s,i,a){this._searchInput=o,a?(this._map=new WCF.Location.GoogleMaps.SuggestionMap(t,e,a),this._map.setSuggestionSelectionCallback($.proxy(this._useSuggestion,this))):this._map=new WCF.Location.GoogleMaps.Map(t,e),this._locationSearch=new WCF.Location.GoogleMaps.LocationSearch(o,$.proxy(this._setMarkerByLocation,this)),s&&i?this._marker=this._map.addDraggableMarker(s,i):(this._marker=this._map.addDraggableMarker(WCF.Location.GoogleMaps.Settings.get("defaultLatitude"),WCF.Location.GoogleMaps.Settings.get("defaultLongitude")),WCF.Location.Util.getLocation($.proxy(function(t,e){void 0!==t&&void 0!==e&&(WCF.Location.GoogleMaps.Util.moveMarker(this._marker,t,e),WCF.Location.GoogleMaps.Util.focusMarker(this._marker))},this))),this._marker.addListener("dragend",$.proxy(this._updateLocation,this))},_useSuggestion:function(t){var e=$(t.currentTarget).data("marker");this._marker.setPosition(e.getPosition()),this._updateLocation(),this._map.showSuggestions(!1)},_updateLocation:function(){WCF.Location.GoogleMaps.Util.reverseGeocoding($.proxy(function(t){null!==t&&$(this._searchInput).val(t)},this),this._marker)},_setMarkerByLocation:function(t){this._marker.setPosition(t.location),WCF.Location.GoogleMaps.Util.focusMarker(this._marker),$(this._searchInput).val(t.label)},getMap:function(){return this._map},getMarker:function(){return this._marker}}),WCF.Location.GoogleMaps.Util={_geocoder:null,focusMarker:function(t){t.getMap().setCenter(t.getPosition())},getMarkerPosition:function(t){return{latitude:t.getPosition().lat(),longitude:t.getPosition().lng()}},moveMarker:function(t,e,o,s){t.setPosition(new google.maps.LatLng(e,o)),s&&google.maps.event.trigger(t,"dragend")},reverseGeocoding:function(o,t,e,s,i){t&&(e=t.getPosition().lat(),s=t.getPosition().lng()),null===this._geocoder&&(this._geocoder=new google.maps.Geocoder);var a=new google.maps.LatLng(e,s);this._geocoder.geocode({latLng:a},function(t,e){e==google.maps.GeocoderStatus.OK?o(i?t:t[0].formatted_address):o(null)})}}; })(this);
// WCF.Message.js
-(function (window, undefined) { "use strict";WCF.Message={},WCF.Message.BBCode={},WCF.Message.BBCode.CodeViewer=Class.extend({init:function(){}}),WCF.Message.EditHistory=Class.extend({_oldIDInputs:null,_newIDInputs:null,_containerSelector:"",_buttonSelector:".jsRevertButton",init:function(e,t,s,i,n){this._oldIDInputs=e,this._newIDInputs=t,this._containerSelector=s,this._buttonSelector=i||".jsRevertButton",this._options=$.extend({isVersionTracker:!1,versionTrackerObjectType:"",versionTrackerObjectId:0,redirectUrl:""},n),this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initInputs(),this._initElements()},_initInputs:function(){var t=this;this._newIDInputs.change(function(e){var s=parseInt($(this).val());"current"===$(this).val()&&(s=1/0),t._oldIDInputs.each(function(e){var t=parseInt($(this).val());"current"===$(this).val()&&(t=1/0),s<=t?$(this).disable():$(this).enable()})}),this._oldIDInputs.change(function(e){var s=parseInt($(this).val());"current"===$(this).val()&&(s=1/0),t._newIDInputs.each(function(e){var t=parseInt($(this).val());"current"===$(this).val()&&(t=1/0),t<=s?$(this).disable():$(this).enable()})}),this._oldIDInputs.filter(":checked").change(),this._newIDInputs.filter(":checked").change()},_initElements:function(){var s=this;$(this._containerSelector).each(function(e,t){$(t).find(s._buttonSelector).click($.proxy(s._click,s))})},_click:function(e){var t,s=$(e.currentTarget);e.preventDefault(),s.data("confirmMessage")?(t=this,WCF.System.Confirmation.show(s.data("confirmMessage"),function(e){"cancel"!==e&&t._sendRequest(s)},void 0,void 0,!0)):this._sendRequest(s)},_sendRequest:function(e){this._options.isVersionTracker?(this.proxy.setOption("url",window.WSC_API_URL+"index.php?ajax-invoke/&t="+window.SECURITY_TOKEN),this.proxy.setOption("data",{actionName:"revert",className:"wcf\\system\\version\\VersionTracker",parameters:{objectType:this._options.versionTrackerObjectType,objectID:this._options.versionTrackerObjectId,versionID:$(e).data("objectID")}})):this.proxy.setOption("data",{actionName:"revert",className:"wcf\\data\\edit\\history\\entry\\EditHistoryEntryAction",objectIDs:[$(e).data("objectID")]}),this.proxy.sendRequest()},_success:function(e,t,s){this._options.redirectUrl?(new WCF.System.Notification).show(function(){window.location=this._options.redirectUrl}.bind(this)):window.location.reload(!0)}}),WCF.Message.FormGuard=Class.extend({init:function(){var e=$("form.jsFormGuard").removeClass("jsFormGuard").submit(function(){$(this).find(".formSubmit input[type=submit]").disable()});$(window).on("unload",function(){e.find(".formSubmit input[type=submit]").enable()})}}),WCF.Message.Preview=Class.extend({_className:"",_messageFieldID:"",_messageField:null,_proxy:null,_previewButton:null,_previewButtonLabel:"",init:function(e,t,s){this._className=e,this._messageFieldID=$.wcfEscapeID(t),this._textarea=$("#"+this._messageFieldID),this._textarea.length?(s=$.wcfEscapeID(s),this._previewButton=$("#"+s),this._previewButton.length?(this._previewButton.click($.proxy(this._click,this)),this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)})):console.debug("[WCF.Message.Preview] Unable to find preview button identified by '"+s+"'")):console.debug("[WCF.Message.Preview] Unable to find message field identified by '"+this._messageFieldID+"'")},_click:function(e){var t=this._getMessage();if(null!==t)return this._proxy.setOption("data",{actionName:"getMessagePreview",className:this._className,parameters:this._getParameters(t)}),this._proxy.sendRequest(),this._previewButtonLabel=this._previewButton.html(),this._previewButton.html(WCF.Language.get("wcf.global.loading")).disable(),e.stopPropagation(),!1;console.debug("[WCF.Message.Preview] Unable to access Redactor instance of '"+this._messageFieldID+"'")},_getParameters:function(e){var i={};return $("#settings_"+this._messageFieldID).find("input[type=checkbox]").each(function(e,t){var s=$(t);s.is(":checked")&&(i[s.prop("name")]=s.prop("value"))}),{data:{message:e},options:i}},_getMessage:function(){return this._textarea.redactor("code.get")},_success:function(e,t,s){this._previewButton.html(this._previewButtonLabel).enable(),this._textarea.parent().children("small.innerError").remove(),this._handleResponse(e)},_handleResponse:function(e){},_failure:function(e){if(null===e||void 0===e.returnValues||void 0===e.returnValues.errorType)return!0;this._previewButton.html(this._previewButtonLabel).enable();var t=this._textarea.parent().children("small.innerError").empty();t.length||(t=$('<small class="innerError" />').appendTo(this._textarea.parent()));var s="empty"===e.returnValues.errorType?WCF.Language.get("wcf.global.form.error.empty"):e.returnValues.errorMessage;return e.returnValues.realErrorMessage&&(s=e.returnValues.realErrorMessage),t.html(s),!1}}),WCF.Message.DefaultPreview=WCF.Message.Preview.extend({_dialog:null,_options:{},init:function(e){if(1<arguments.length&&"string"==typeof e)throw new Error("Outdated API call, please update your implementation.");if(this._options=$.extend({disallowedBBCodesPermission:"user.message.disallowedBBCodes",messageFieldID:"",previewButtonID:"",messageObjectType:"",messageObjectID:0},e),!this._options.messageObjectType)throw new Error("Field 'messageObjectType' cannot be empty.");this._super("wcf\\data\\bbcode\\MessagePreviewAction",this._options.messageFieldID,this._options.previewButtonID)},_handleResponse:function(t){require(["WoltLabSuite/Core/Ui/Dialog"],function(e){e.open(this,'<div class="htmlContent">'+t.returnValues.message+"</div>")}.bind(this))},_getParameters:function(e){var t=this._super(e);for(var s in this._options)this._options.hasOwnProperty(s)&&"messageFieldID"!==s&&"previewButtonID"!==s&&(t[s]=this._options[s]);return t},_dialogSetup:function(){return{id:"messagePreview",options:{title:WCF.Language.get("wcf.global.preview")},source:null}}}),WCF.Message.I18nPreview=WCF.Message.Preview.extend({_activeMessageField:"",_dialog:null,_options:{},init:function(e){if(this._activeMessageField="",this._options=$.extend({disallowedBBCodesPermission:"user.message.disallowedBBCodes",messageFields:[],messageObjectType:"",messageObjectID:0},e),!this._options.messageObjectType)throw new Error("Field 'messageObjectType' cannot be empty.");if(this._options.messageFields.length<1)throw new TypeError("Expected a non empty list of message field ids");this._super("wcf\\data\\bbcode\\MessagePreviewAction",this._options.messageFields[0],"buttonMessagePreview")},_click:function(e){for(var t=this._messageFieldID="",s=this._textarea=null,i=0,n=this._options.messageFields.length;i<n;i++)if(t=this._options.messageFields[i],s=elById(t),null!==elBySel('.redactor-layer[data-element-id="'+s.id+'"]').offsetParent){this._messageFieldID=t,this._textarea=$(s);break}if(""===this._messageFieldID)throw new Error("Unable to identify the active message field.");this._super(e)},_getParameters:function(e){var t=this._super(e);for(var s in this._options)this._options.hasOwnProperty(s)&&-1===["messageFields","messageFieldID","previewButtonID"].indexOf(s)&&(t[s]=this._options[s]);return t},_handleResponse:function(t){require(["WoltLabSuite/Core/Ui/Dialog"],function(e){e.open(this,'<div class="htmlContent">'+t.returnValues.message+"</div>")}.bind(this))},_dialogSetup:function(){return{id:"messagePreview",options:{title:WCF.Language.get("wcf.global.preview")},source:null}}}),WCF.Message.Multilingualism=Class.extend({_availableLanguages:{},_languageID:0,_languageInput:null,init:function(e,t,s){var i;this._availableLanguages=t,this._languageID=e||0,this._languageInput=$("#languageID"),this._updateLabel(),this._languageInput.find(".dropdownMenu > li").click($.proxy(this._click,this)),s||(i=this._languageInput.find(".dropdownMenu"),$('<li class="dropdownDivider" />').appendTo(i),$('<li><span><span class="badge">'+this._availableLanguages[0]+"</span></span></li>").click($.proxy(this._disable,this)).appendTo(i)),this._languageInput.parents("form").submit($.proxy(this._submit,this))},_click:function(e){this._languageID=$(e.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(e,t,s){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._wysiwygSelector=e,this._smiliesTabMenuId=t||"smilies-"+this._wysiwygSelector,this._formBuilderUsage=s||!1,$("#"+this._smiliesTabMenuId).on("messagetabmenushow",$.proxy(this._click,this))},_click:function(e,t){if(e.preventDefault(),this._formBuilderUsage){if(!t.activeTab.tab.children("a").prop("href").match(/#([a-zA-Z0-9_-]+)$/))return void console.debug("[WCF.Message.SmileyCategories] Cannot extract category id for tab '"+t.activeTab.tab.wcfIdentify()+"'.");if(!RegExp.$1.match(this._smiliesTabMenuId.replace(/Container$/,"")+"_smileyCategoryTab(\\d+)Container"))return void console.debug("[WCF.Message.SmileyCategories] Cannot extract category id for tab '"+t.activeTab.tab.wcfIdentify()+"'.");var s=parseInt(RegExp.$1)}else s=parseInt(t.activeTab.tab.data("smileyCategoryID"));s&&(t.activeTab.container.children("ul.smileyList").length||(void 0===this._cache[s]?(this._proxy.setOption("data",{actionName:"getSmilies",className:"wcf\\data\\smiley\\category\\SmileyCategoryAction",objectIDs:[s]}),this._proxy.sendRequest()):t.activeTab.container.html(this._cache[s])))},_success:function(e,t,s){var i=parseInt(e.returnValues.smileyCategoryID);this._cache[i]=e.returnValues.template,this._formBuilderUsage?$("#"+this._smiliesTabMenuId.replace(/Container$/,"")+"_smileyCategoryTab"+i+"Container").html(e.returnValues.template):$("#smilies-"+this._wysiwygSelector+"-"+i).html(e.returnValues.template)}}),WCF.Message.Smilies=Class.extend({init:function(t){require(["WoltLabSuite/Core/Ui/Smiley/Insert"],function(e){new e(t)})}}),WCF.Message.InlineEditor=Class.extend({_container:{},_containerID:0,_dropdowns:{},_messageContainerSelector:".jsMessage",_messageEditorIDPrefix:"messageEditor",init:function(t,e,s){require(["WoltLabSuite/Core/Ui/Message/InlineEditor"],function(e){new e({className:this._getClassName(),containerId:t,editorPrefix:this._messageEditorIDPrefix,messageSelector:this._messageContainerSelector,quoteManager:s||null,callbackDropdownInit:this._callbackDropdownInit.bind(this)})}.bind(this))},_click:function(e,t){t=null===e?~~t:~~elData(e.currentTarget,"container-id"),require(["WoltLabSuite/Core/Ui/Message/InlineEditor"],function(e){e.legacyEdit(t)}.bind(this)),e&&e.preventDefault()},_initDropdownMenu:function(e,t){},_callbackDropdownInit:function(e,t){return this._initDropdownMenu($(e).wcfIdentify(),$(t)),null},_getClassName:function(){return""}}),WCF.Message.Submit={_buttons:{},registerButton:function(e,t){WCF.Browser.isChrome()&&(this._buttons[e]=$(t))},execute:function(e){this._buttons[e]&&this._buttons[e].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,_selectionChangeTimer:null,_isMouseDown:!1,init:function(e,t,s,i,n,a,o){var r;this._className=t,""!==this._className?(this._objectType=s,""!==this._objectType?(this._containerSelector=i,this._message="",this._messageBodySelector=n,this._objectID=0,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._selectionChangeTimer=null,this._isMouseDown=!1,this._initContainers(),o=o&&e.supportPaste(),this._initCopyQuote(o),$(document).mouseup($.proxy(this._mouseUp,this)),document.addEventListener("selectionchange",this._selectionchange.bind(this)),this._quoteManager=e,this._quoteManager.register(this._objectType,this),WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Quote.Handler"+s.hashCode(),$.proxy(this._initContainers,this)),r=this._copyQuote[0],document.addEventListener("touchstart",function(e){var t;r.classList.contains("active")&&((t=e.target)===r||r.contains(t)||(r.classList.add("touchForceInaccessible"),document.addEventListener("touchend",function(){r.classList.remove("touchForceInaccessible")},{once:!0})))},{passive:!0})):console.debug("[WCF.Message.QuoteManager] Empty object type name given, aborting.")):console.debug("[WCF.Message.QuoteManager] Empty class name given, aborting.")},_initContainers:function(){var n=this;$(this._containerSelector).each(function(e,t){var s=$(t),i=s.wcfIdentify();if(!n._containers[i]){if((n._containers[i]=s).hasClass("jsInvalidQuoteTarget"))return!0;n._messageBodySelector&&s.data("body",s.find(n._messageBodySelector).data("containerID",i)),s.mousedown($.proxy(n._mouseDown,n)),s[0].classList.add("jsQuoteMessageContainer"),n._containers[i].find(".jsQuoteMessage").click($.proxy(n._saveFullQuote,n))}})},_selectionchange:function(){if(!this._isMouseDown){if(""===this._activeContainerID){var e=window.getSelection();if(1!==e.rangeCount||e.isCollapsed)return;var t=e.getRangeAt(0),s=elClosest(t.startContainer,".jsQuoteMessageContainer"),i=elClosest(t.endContainer,".jsQuoteMessageContainer");if(s&&s===i&&!s.classList.contains("jsInvalidQuoteTarget")){var n=t.commonAncestorContainer;n.nodeType!==Node.ELEMENT_NODE&&(n=n.parentNode);var a=n.offsetParent;if(s.contains(a)&&a.scrollTop+a.clientHeight<n.offsetTop)return;this._activeContainerID=s.id}}null!==this._selectionChangeTimer&&window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=window.setTimeout(this._mouseUp.bind(this),100)}},_mouseDown:function(e){this._copyQuote.removeClass("active"),this._activeContainerID=e.currentTarget.classList.contains("jsInvalidQuoteTarget")?"":e.currentTarget.id,null!==this._selectionChangeTimer&&(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),this._isMouseDown=!0},_getNodeText:function(e){function t(e){switch(e.tagName){case"BLOCKQUOTE":case"SCRIPT":return NodeFilter.FILTER_REJECT;case"IMG":if(!e.classList.contains("smiley")||0===e.alt.length)return NodeFilter.FILTER_REJECT;default:return NodeFilter.FILTER_ACCEPT}}t.acceptNode=t;for(var s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,t,!0),i="",n=[];s.nextNode();){var a,o,r,l=s.currentNode;if(l.nodeType===Node.ELEMENT_NODE)switch(l.tagName){case"A":0<(r=l.textContent).indexOf("…")&&(2!==(a=r.split(/\u2026/)).length||0===(o=l.href).indexOf(a[0])&&o.substr(-1*a[1].length)===a[1]&&(i+=o,n.push(l)));break;case"BR":case"LI":case"UL":i+="\n";break;case"TD":$.browser.msie||(i+="\n");break;case"P":i+="\n\n";break;case"IMG":i+=" "+l.alt+" ";break;case"DIV":(l.classList.contains("codeBoxHeadline")||l.classList.contains("codeBoxLine"))&&(i+="\n")}else{if("A"===l.parentNode.nodeName&&-1!==n.indexOf(l.parentNode))continue;i+=l.nodeValue.replace(/\n/g," ")}}return i},_mouseUp:function(e){if(e&&e.originalEvent instanceof Event&&(null!==this._selectionChangeTimer&&(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),this._isMouseDown=!1),""!==this._activeContainerID){var t=window.getSelection();if(1!==t.rangeCount||t.isCollapsed)this._copyQuote.removeClass("active");else{for(var s,i,n,a,o,r,l,c,u,h,d,_=(g=this._containers[this._activeContainerID]).data("objectID"),g=g.data("body")||g,p=t.anchorNode;p&&p!==g[0];)p=p.parentNode;p===g[0]?(s=this._getSelectedText(),""!==(i=$.trim(s))?(a=(n=t.getRangeAt(0)).startContainer.nodeType===Node.TEXT_NODE?n.startContainer.parentNode:n.startContainer,o=n.endContainer.nodeType===Node.TEXT_NODE?n.endContainer.parentNode:n.endContainer,a.closest("blockquote")||o.closest("blockquote")?this._copyQuote.removeClass("active"):(r=this._getNodeText(g[0]),-1!==this._normalize(r).indexOf(this._normalize(i))&&(this._copyQuote.addClass("active"),l=this._getBoundingRectangle(g,window.getSelection()),c=this._copyQuote.getDimensions("outer"),(u=(l.right-l.left)/2-c.width/2+l.left)<(h=g[0].getBoundingClientRect()).left?u=h.left:u+c.width>h.right&&(u=h.right-c.width),this._copyQuote.css({top:l.bottom+7+"px",left:u+"px"}),this._copyQuote.removeClass("active"),null===this._selectionChangeTimer?this._activeContainerID="":(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),d=this,window.setTimeout(function(){var e=$.trim(d._getSelectedText());""!==e&&(d._copyQuote.addClass("active"),d._message=e,d._objectID=_)},10)))):this._copyQuote.removeClass("active")):this._copyQuote.removeClass("active")}}else this._copyQuote.removeClass("active")},_normalize:function(e){return e.replace(/\r?\n|\r/g,"\n").replace(/\s/g," ").replace(/\s{2,}/g," ")},_getBoundingRectangle:function(e,t){var s,i,n=null;return 0<t.rangeCount&&(s=t.getRangeAt(0).getBoundingClientRect(),i=$(document).scrollTop(),n={bottom:s.bottom+i,left:s.left,right:s.right,top:s.top+i}),n},_initCopyQuote:function(e){var t;this._copyQuote=$("#quoteManagerCopy"),this._copyQuote.length||(this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip interactive"><span class="jsQuoteManagerStore">'+WCF.Language.get("wcf.message.quote.quoteSelected")+"</span></div>").appendTo(document.body),t=this._copyQuote.children("span.jsQuoteManagerStore").click($.proxy(this._saveQuote,this)),e&&$('<span class="jsQuoteManagerQuoteAndInsert">'+WCF.Language.get("wcf.message.quote.quoteAndReply")+"</span>").click($.proxy(this._saveAndInsertQuote,this)).insertAfter(t))},_getSelectedText:function(){var e=window.getSelection();return e.rangeCount?this._getNodeText(e.getRangeAt(0).cloneContents()):""},_saveFullQuote:function(e){e.preventDefault();var t=$(e.currentTarget);this._proxy.setOption("data",{actionName:"saveFullQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[t.data("objectID")]}),this._proxy.sendRequest(),t.data("isQuoted")?t.data("isQuoted",!1).children("a").removeClass("active"):t.data("isQuoted",!0).children("a").addClass("active");var s=t.parents(".buttonGroupNavigation");s.hasClass("jsMobileButtonGroupNavigation")&&s.children(".dropdownLabel").trigger("click")},_saveQuote:function(e){this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message,renderQuote:!0===e}}),this._proxy.sendRequest();var t=window.getSelection();t.rangeCount&&(t.removeAllRanges(),this._copyQuote[0].classList.remove("active"))},_saveAndInsertQuote:function(){this._saveQuote(!0)},_success:function(e){var t;switch(void 0!==e.returnValues.count&&(void 0!==e.returnValues.fullQuoteMessageIDs&&(e.returnValues.fullQuoteObjectIDs=e.returnValues.fullQuoteMessageIDs),t=void 0!==e.returnValues.fullQuoteObjectIDs?e.returnValues.fullQuoteObjectIDs:{},this._quoteManager.updateCount(e.returnValues.count,t)),e.actionName){case"saveQuote":case"saveFullQuote":e.returnValues.renderedQuote&&WCF.System.Event.fireEvent("com.woltlab.wcf.message.quote","insert",{forceInsert:"saveQuote"===e.actionName,quote:e.returnValues.renderedQuote})}},updateFullQuoteObjectIDs:function(i){for(var e in this._containers)this._containers[e].find(".jsQuoteMessage").each(function(e,t){var s=$(t).data("isQuoted",0);s.children("a").removeClass("active"),WCF.inArray(s.data("objectID"),i)&&s.data("isQuoted",1).children("a").addClass("active")})}}),WCF.Message.Quote.Manager=Class.extend({_buttons:{},_count:0,_dialog:null,_editorId:"",_editorIdAlternative:"",_form:null,_handlers:{},_hasTemplate:!1,_insertQuotes:!0,_proxy:null,_removeOnSubmit:[],_supportPaste:!1,_supportPasteOverride:!1,init:function(e,t,s,i){var n;this._buttons={insert:null,remove:null},this._count=parseInt(e)||0,this._dialog=null,this._editorId="",this._editorIdAlternative="",this._form=null,this._handlers={},this._hasTemplate=!1,this._insertQuotes=!0,this._removeOnSubmit=[],this._supportPaste=!1,this._supportPasteOverride=!1,!t||(n=$("#"+t)).length&&(this._editorId=t,this._supportPaste=!0,this._form=n.parents("form:eq(0)"),this._form.length?(this._form.submit(this._submit.bind(this)),this._removeOnSubmit=i||[]):(this._form=null,this._supportPaste=!0===s)),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this),url:"index.php?message-quote/&t="+SECURITY_TOKEN}),this._toggleShowQuotes(),WCF.System.Event.addListener("com.woltlab.wcf.quote","reload",this.countQuotes.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.message.quote","insert",function(e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:e.quote.username,content:e.quote.text,isText:!e.quote.isFullQuote,link:e.quote.link})}.bind(this))},setAlternativeEditor:function(e){this._editorIdAlternative||this._supportPaste||(this._hasTemplate=!1,this._supportPaste=!0,this._supportPasteOverride=!0),"object"==typeof e&&(e=e[0].id),this._editorIdAlternative=e},clearAlternativeEditor:function(){this._supportPasteOverride&&(this._hasTemplate=!1,this._supportPaste=!1,this._supportPasteOverride=!1),this._editorIdAlternative=""},register:function(e,t){this._handlers[e]=t},updateCount:function(e,t){for(var s in this._count=parseInt(e)||0,this._toggleShowQuotes(),this._handlers){var i;this._handlers.hasOwnProperty(s)&&(i=t[s]||[],this._handlers[s].updateFullQuoteObjectIDs(i))}},insertQuotes:function(e,t,s){this._insertQuotes?new WCF.Action.Proxy({autoSend:!0,data:{actionName:"getRenderedQuotes",className:e,interfaceName:"wcf\\data\\IMessageQuoteAction",parameters:{parentObjectID:t}},success:s}):this._insertQuotes=!0},_toggleShowQuotes:function(){require(["WoltLabSuite/Core/Ui/Page/Action"],function(e){var t,s="showQuotes";this._count?(void 0===(t=e.get(s))&&((t=elCreate("a")).addEventListener("mousedown",this._click.bind(this)),e.add(s,t)),t.textContent=WCF.Language.get("wcf.message.quote.showQuotes",{count:this._count}),e.show(s)):e.remove(s),this._hasTemplate=!1}.bind(this))},_click:function(){var e=document.activeElement;e.classList.contains("redactor-layer")&&$("#"+elData(e,"element-id")).redactor("selection.save"),this._hasTemplate?this._dialog.wcfDialog("open"):(this._proxy.showLoadingOverlayOnce(),this._proxy.setOption("data",{actionName:"getQuotes",supportPaste:this._supportPaste}),this._proxy.sendRequest())},renderDialog:function(e){null===this._dialog&&(this._dialog=$("#messageQuoteList"),this._dialog.length||(this._dialog=$('<div id="messageQuoteList" />').hide().appendTo(document.body))),this._dialog.html(e);var t=$('<div class="formSubmit" />').appendTo(this._dialog);this._supportPaste&&(this._buttons.insert=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.message.quote.insertAllQuotes")+"</button>").click($.proxy(this._insertSelected,this)).appendTo(t)),this._buttons.remove=$("<button>"+WCF.Language.get("wcf.message.quote.removeAllQuotes")+"</button>").click($.proxy(this._removeSelected,this)).appendTo(t),this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.quote.manageQuotes")}),this._dialog.wcfDialog("render"),this._hasTemplate=!0;var i,s=this._dialog.find(".jsInsertQuote");this._supportPaste?s.click($.proxy(this._insertQuote,this)):s.hide(),this._dialog.find("input.jsCheckbox").change($.proxy(this._changeButtons,this)),this._removeOnSubmit.length&&(i=this)._dialog.find("input.jsRemoveQuote").each(function(e,t){var s=$(t).change($.proxy(this._change,this));WCF.inArray(s.parent("li").attr("data-quote-id"),i._removeOnSubmit)&&s.attr("checked","checked")})},_changeButtons:function(){this._dialog.find("input.jsCheckbox:checked").length?(this._supportPaste&&this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertSelectedQuotes")),this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeSelectedQuotes"))):(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(e){var t,s=$(e.currentTarget),i=s.parent("li").attr("data-quote-id");s.prop("checked")?this._removeOnSubmit.push(i):-1!==(t=this._removeOnSubmit.indexOf(i))&&this._removeOnSubmit.splice(t,1)},_insertSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked"),this._dialog.find("input.jsCheckbox:checked").each($.proxy(function(e,t){this._insertQuote(null,t)},this)),this._dialog.wcfDialog("close")},_insertQuote:function(e,t){var s=$(e?e.currentTarget:t).parents("li:eq(0)"),i=s.children(".jsFullQuote")[0].textContent.trim(),n=s.parents(".message:eq(0)"),a=n.data("username"),o=n.data("link"),r=!elDataBool(s[0],"is-full-quote");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:a,content:i,isText:r,link:o}),this._removeOnSubmit.push(s.data("quote-id")),null!==e&&this._dialog.wcfDialog("close")},_removeSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked");var s=[];if(this._dialog.find("input.jsCheckbox:checked").each(function(e,t){s.push($(t).parents("li").attr("data-quote-id"))}),s.length){var e=[];for(var t in this._handlers)this._handlers.hasOwnProperty(t)&&e.push(t);this._proxy.setOption("data",{actionName:"remove",getFullQuoteObjectIDs:0<this._handlers.length,objectTypes:e,quoteIDs:s}),this._proxy.sendRequest(),this._dialog.wcfDialog("close")}},_submit:function(){if(this._supportPaste&&0<this._removeOnSubmit.length)for(var e=this._form.find(".formSubmit"),t=0,s=this._removeOnSubmit.length;t<s;t++)$('<input type="hidden" name="__removeQuoteIDs[]" value="'+this._removeOnSubmit[t]+'" />').appendTo(e)},getQuotesMarkedForRemoval:function(){return this._removeOnSubmit},markQuotesForRemoval:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"markForRemoval",quoteIDs:this._removeOnSubmit}),this._proxy.suppressErrors(),this._proxy.sendRequest())},removeMarkedQuotes:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"removeMarkedQuotes",getFullQuoteObjectIDs:0<this._handlers.length}),this._proxy.sendRequest())},countQuotes:function(){var e=[];for(var t in this._handlers)this._handlers.hasOwnProperty(t)&&e.push(t);this._proxy.setOption("data",{actionName:"count",getFullQuoteObjectIDs:0<e.length,objectTypes:e}),this._proxy.sendRequest()},_success:function(e){var t;null!==e&&(void 0!==e.count&&(t=void 0!==e.fullQuoteObjectIDs?e.fullQuoteObjectIDs:{},this.updateCount(e.count,t)),void 0!==e.template&&(""==$.trim(e.template)?this.updateCount(0,{}):this.renderDialog(e.template)))},supportPaste:function(){return this._supportPaste}}),WCF.Message.Share={},WCF.Message.Share.Content=Class.extend({_cache:{},_dialog:null,_shareButtonsTemplate:"",init:function(e){this._shareButtonsTemplate=e||"",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 t,s,i=$(e.currentTarget),n=i.prop("href"),a=i.data("linkTitle")?i.data("linkTitle"):n,o=n.hashCode();void 0===this._cache[o]?(t=!1,null===this._dialog?(this._dialog=$('<div id="shareContentDialog" />').hide().appendTo(document.body),t=!0):this._dialog.empty(),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalink">'+WCF.Language.get("wcf.message.share.permalink")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalink" class="long" readonly />').attr("value",n).appendTo(s),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalinkBBCode">'+WCF.Language.get("wcf.message.share.permalink.bbcode")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalinkBBCode" class="long" readonly />').attr("value","[url='"+n+"']"+a+"[/url]").appendTo(s),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalinkHTML">'+WCF.Language.get("wcf.message.share.permalink.html")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalinkHTML" class="long" readonly />').attr("value",'<a href="'+n+'">'+WCF.String.escapeHTML(a)+"</a>").appendTo(s),""!==this._shareButtonsTemplate&&(s=$('<section class="section"><h2 class="sectionTitle">'+WCF.Language.get("wcf.message.share")+"</h2>"+this._shareButtonsTemplate+"</section>").appendTo(this._dialog),elData(s.children(".jsMessageShareButtons")[0],"url",WCF.String.escapeHTML(n))),this._cache[o]=this._dialog.html(),t?this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share")}):this._dialog.wcfDialog("open")):this._dialog.html(this._cache[o]).wcfDialog("open"),this._enableSelection()},_enableSelection:function(){var e=this._dialog.find("input").click(function(){$(this).select()});navigator.userAgent.match(/iP(ad|hone|od)/)&&e.keydown(function(){return!1}).removeAttr("readonly").click(function(){this.setSelectionRange(0,9999)})}}),WCF.Message.Share.Page=Class.extend({init:function(){require(["WoltLabSuite/Core/Ui/Message/Share"],function(e){e.init()})}}),WCF.Message.UserMention=Class.extend({init:function(){throw new Error("Support for mentions in Redactor are now enabled by adding the attribute 'data-support-mention=\"true\"' to the textarea element.")}}),$.widget("wcf.messageTabMenu",{_tabs:[],_tabsByName:{},options:{collapsible:!0},_create:function(){var s=this.element.find("> nav").find("> ul > li:not(.jsFlexibleMenuDropdown)"),e=this.element.find("> div, > fieldset");if(s.length==e.length){var i=this.element.data("preselect");e.each(function(e,t){if(null!==elBySel(".innerError",t))return i=$(s[e]).data("name"),!1}),"true"===i&&(i=!0),this._tabs=[],this._tabsByName={};for(var t=0;t<s.length;t++){var n,a=$(s[t]),o=$(e[t]),r=a.data("name");void 0===r&&(void 0!==(n=a.children("a").prop("href"))&&n.match(/#([a-zA-Z_-]+)$/)&&(r=RegExp.$1),void 0===r&&(r=a.wcfIdentify())),this._tabs.push({container:o,name:r,tab:a}),this._tabsByName[r]=t;var l=a.children("a").data("index",t).on("mousedown",this._showTab.bind(this));l.attr("role","button").attr("tabindex","0").attr("aria-haspopup",!0).attr("aria-expanded",!1).attr("aria-controls",o[0].id),l.on("keydown",function(e){13!==e.which&&32!==e.which||(e.preventDefault(),this._showTab(e))}.bind(this)),(i===r||!0===i&&0===t)&&l.trigger("mousedown")}!0===i&&this._tabs.length&&!window.matchMedia("(max-width: 544px)").matches&&this._tabs[0].tab.children("a").trigger("click");var c=this.element.data("collapsible");void 0!==c&&(this.options.collapsible=c);var u=elData(this.element[0],"wysiwyg-container-id");u&&WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+u,function(){for(var e=0,t=this._tabs.length;e<t;e++)this._tabs[e].container.removeClass("active"),this._tabs[e].tab.removeClass("active")}.bind(this))}else console.debug("[wcf.messageTabMenu] Amount of tabs does not equal amount of tab containers, aborting.")},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments),this.element.remove()},_showTab:function(e,t,s){var i=null===e?t:$(e.currentTarget).data("index");s=!this.options.collapsible||!0===s;for(var n=null,a=0;a<this._tabs.length;a++){var o=this._tabs[a];if(a==i){if(!o.tab.hasClass("active")){o.tab.addClass("active"),o.container.addClass("active"),(n=o).tab.children("a").attr("aria-expanded",!0);var r,l=o.container[0];null!==elBySel(".messageTabMenuContent.active",l)||null===elBySel(".messageTabMenuContent",l)||null!==(r=elBySel("nav > ul > li[data-name] > a",l))&&$(r).trigger("mousedown");continue}if(!0===s)continue}o.tab.removeClass("active"),o.container.removeClass("active"),o.tab.children("a").attr("aria-expanded",!1)}null!==e&&(e.preventDefault(),e.stopPropagation()),null!==n&&this._trigger("show",{},{activeTab:n}),$(window).trigger("resize")},showTab:function(e,t){$.isNumeric(e)||void 0!==this._tabsByName[e]&&(e=this._tabsByName[e]),void 0!==this._tabs[e]?this._showTab(null,e,t):console.debug("[wcf.messageTabMenu] Cannot locate tab identified by '"+e+"'")},getTab:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].tab:null},getContainer:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].container:null}}); })(this);
+(function (window, undefined) { "use strict";WCF.Message={},WCF.Message.BBCode={},WCF.Message.BBCode.CodeViewer=Class.extend({init:function(){}}),WCF.Message.EditHistory=Class.extend({_oldIDInputs:null,_newIDInputs:null,_containerSelector:"",_buttonSelector:".jsRevertButton",init:function(e,t,s,i,n){this._oldIDInputs=e,this._newIDInputs=t,this._containerSelector=s,this._buttonSelector=i||".jsRevertButton",this._options=$.extend({isVersionTracker:!1,versionTrackerObjectType:"",versionTrackerObjectId:0,redirectUrl:""},n),this.proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initInputs(),this._initElements()},_initInputs:function(){var t=this;this._newIDInputs.change(function(e){var s=parseInt($(this).val());"current"===$(this).val()&&(s=1/0),t._oldIDInputs.each(function(e){var t=parseInt($(this).val());"current"===$(this).val()&&(t=1/0),s<=t?$(this).disable():$(this).enable()})}),this._oldIDInputs.change(function(e){var s=parseInt($(this).val());"current"===$(this).val()&&(s=1/0),t._newIDInputs.each(function(e){var t=parseInt($(this).val());"current"===$(this).val()&&(t=1/0),t<=s?$(this).disable():$(this).enable()})}),this._oldIDInputs.filter(":checked").change(),this._newIDInputs.filter(":checked").change()},_initElements:function(){var s=this;$(this._containerSelector).each(function(e,t){$(t).find(s._buttonSelector).click($.proxy(s._click,s))})},_click:function(e){var t,s=$(e.currentTarget);e.preventDefault(),s.data("confirmMessage")?(t=this,WCF.System.Confirmation.show(s.data("confirmMessage"),function(e){"cancel"!==e&&t._sendRequest(s)},void 0,void 0,!0)):this._sendRequest(s)},_sendRequest:function(e){this._options.isVersionTracker?(this.proxy.setOption("url",window.WSC_API_URL+"index.php?ajax-invoke/&t="+window.SECURITY_TOKEN),this.proxy.setOption("data",{actionName:"revert",className:"wcf\\system\\version\\VersionTracker",parameters:{objectType:this._options.versionTrackerObjectType,objectID:this._options.versionTrackerObjectId,versionID:$(e).data("objectID")}})):this.proxy.setOption("data",{actionName:"revert",className:"wcf\\data\\edit\\history\\entry\\EditHistoryEntryAction",objectIDs:[$(e).data("objectID")]}),this.proxy.sendRequest()},_success:function(e,t,s){this._options.redirectUrl?(new WCF.System.Notification).show(function(){window.location=this._options.redirectUrl}.bind(this)):window.location.reload(!0)}}),WCF.Message.FormGuard=Class.extend({init:function(){var e=$("form.jsFormGuard").removeClass("jsFormGuard").submit(function(){$(this).find(".formSubmit input[type=submit]").disable()});$(window).on("unload",function(){e.find(".formSubmit input[type=submit]").enable()})}}),WCF.Message.Preview=Class.extend({_className:"",_messageFieldID:"",_messageField:null,_proxy:null,_previewButton:null,_previewButtonLabel:"",init:function(e,t,s){this._className=e,this._messageFieldID=$.wcfEscapeID(t),this._textarea=$("#"+this._messageFieldID),this._textarea.length?(s=$.wcfEscapeID(s),this._previewButton=$("#"+s),this._previewButton.length?(this._previewButton.click($.proxy(this._click,this)),this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)})):console.debug("[WCF.Message.Preview] Unable to find preview button identified by '"+s+"'")):console.debug("[WCF.Message.Preview] Unable to find message field identified by '"+this._messageFieldID+"'")},_click:function(e){e.preventDefault();var t=this._getMessage();if(null!==t)return this._proxy.setOption("data",{actionName:"getMessagePreview",className:this._className,parameters:this._getParameters(t)}),this._proxy.sendRequest(),this._previewButtonLabel=this._previewButton.html(),this._previewButton.html(WCF.Language.get("wcf.global.loading")).disable(),e.stopPropagation(),!1;console.debug("[WCF.Message.Preview] Unable to access Redactor instance of '"+this._messageFieldID+"'")},_getParameters:function(e){var i={};return $("#settings_"+this._messageFieldID).find("input[type=checkbox]").each(function(e,t){var s=$(t);s.is(":checked")&&(i[s.prop("name")]=s.prop("value"))}),{data:{message:e},options:i}},_getMessage:function(){return this._textarea.redactor("code.get")},_success:function(e,t,s){this._previewButton.html(this._previewButtonLabel).enable(),this._textarea.parent().children("small.innerError").remove(),this._handleResponse(e)},_handleResponse:function(e){},_failure:function(e){if(null===e||void 0===e.returnValues||void 0===e.returnValues.errorType)return!0;this._previewButton.html(this._previewButtonLabel).enable();var t=this._textarea.parent().children("small.innerError").empty();t.length||(t=$('<small class="innerError" />').appendTo(this._textarea.parent()));var s="empty"===e.returnValues.errorType?WCF.Language.get("wcf.global.form.error.empty"):e.returnValues.errorMessage;return e.returnValues.realErrorMessage&&(s=e.returnValues.realErrorMessage),t.html(s),!1}}),WCF.Message.DefaultPreview=WCF.Message.Preview.extend({_dialog:null,_options:{},init:function(e){if(1<arguments.length&&"string"==typeof e)throw new Error("Outdated API call, please update your implementation.");if(this._options=$.extend({disallowedBBCodesPermission:"user.message.disallowedBBCodes",messageFieldID:"",previewButtonID:"",messageObjectType:"",messageObjectID:0},e),!this._options.messageObjectType)throw new Error("Field 'messageObjectType' cannot be empty.");this._super("wcf\\data\\bbcode\\MessagePreviewAction",this._options.messageFieldID,this._options.previewButtonID)},_handleResponse:function(t){require(["WoltLabSuite/Core/Ui/Dialog"],function(e){e.open(this,'<div class="htmlContent">'+t.returnValues.message+"</div>")}.bind(this))},_getParameters:function(e){var t=this._super(e);for(var s in this._options)this._options.hasOwnProperty(s)&&"messageFieldID"!==s&&"previewButtonID"!==s&&(t[s]=this._options[s]);return t},_dialogSetup:function(){return{id:"messagePreview",options:{title:WCF.Language.get("wcf.global.preview")},source:null}}}),WCF.Message.I18nPreview=WCF.Message.Preview.extend({_activeMessageField:"",_dialog:null,_options:{},init:function(e){if(this._activeMessageField="",this._options=$.extend({disallowedBBCodesPermission:"user.message.disallowedBBCodes",messageFields:[],messageObjectType:"",messageObjectID:0},e),!this._options.messageObjectType)throw new Error("Field 'messageObjectType' cannot be empty.");if(this._options.messageFields.length<1)throw new TypeError("Expected a non empty list of message field ids");this._super("wcf\\data\\bbcode\\MessagePreviewAction",this._options.messageFields[0],"buttonMessagePreview")},_click:function(e){for(var t=this._messageFieldID="",s=this._textarea=null,i=0,n=this._options.messageFields.length;i<n;i++)if(t=this._options.messageFields[i],s=elById(t),null!==elBySel('.redactor-layer[data-element-id="'+s.id+'"]').offsetParent){this._messageFieldID=t,this._textarea=$(s);break}if(""===this._messageFieldID)throw new Error("Unable to identify the active message field.");this._super(e)},_getParameters:function(e){var t=this._super(e);for(var s in this._options)this._options.hasOwnProperty(s)&&-1===["messageFields","messageFieldID","previewButtonID"].indexOf(s)&&(t[s]=this._options[s]);return t},_handleResponse:function(t){require(["WoltLabSuite/Core/Ui/Dialog"],function(e){e.open(this,'<div class="htmlContent">'+t.returnValues.message+"</div>")}.bind(this))},_dialogSetup:function(){return{id:"messagePreview",options:{title:WCF.Language.get("wcf.global.preview")},source:null}}}),WCF.Message.Multilingualism=Class.extend({_availableLanguages:{},_languageID:0,_languageInput:null,init:function(e,t,s){var i;this._availableLanguages=t,this._languageID=e||0,this._languageInput=$("#languageID"),this._updateLabel(),this._languageInput.find(".dropdownMenu > li").click($.proxy(this._click,this)),s||(i=this._languageInput.find(".dropdownMenu"),$('<li class="dropdownDivider" />').appendTo(i),$('<li><span><span class="badge">'+this._availableLanguages[0]+"</span></span></li>").click($.proxy(this._disable,this)).appendTo(i)),this._languageInput.parents("form").submit($.proxy(this._submit,this))},_click:function(e){this._languageID=$(e.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(e,t,s){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._wysiwygSelector=e,this._smiliesTabMenuId=t||"smilies-"+this._wysiwygSelector,this._formBuilderUsage=s||!1,$("#"+this._smiliesTabMenuId).on("messagetabmenushow",$.proxy(this._click,this))},_click:function(e,t){if(e.preventDefault(),this._formBuilderUsage){if(!t.activeTab.tab.children("a").prop("href").match(/#([a-zA-Z0-9_-]+)$/))return void console.debug("[WCF.Message.SmileyCategories] Cannot extract category id for tab '"+t.activeTab.tab.wcfIdentify()+"'.");if(!RegExp.$1.match(this._smiliesTabMenuId.replace(/Container$/,"")+"_smileyCategoryTab(\\d+)Container"))return void console.debug("[WCF.Message.SmileyCategories] Cannot extract category id for tab '"+t.activeTab.tab.wcfIdentify()+"'.");var s=parseInt(RegExp.$1)}else s=parseInt(t.activeTab.tab.data("smileyCategoryID"));s&&(t.activeTab.container.children("ul.smileyList").length||(void 0===this._cache[s]?(this._proxy.setOption("data",{actionName:"getSmilies",className:"wcf\\data\\smiley\\category\\SmileyCategoryAction",objectIDs:[s]}),this._proxy.sendRequest()):t.activeTab.container.html(this._cache[s])))},_success:function(e,t,s){var i=parseInt(e.returnValues.smileyCategoryID);this._cache[i]=e.returnValues.template,this._formBuilderUsage?$("#"+this._smiliesTabMenuId.replace(/Container$/,"")+"_smileyCategoryTab"+i+"Container").html(e.returnValues.template):$("#smilies-"+this._wysiwygSelector+"-"+i).html(e.returnValues.template)}}),WCF.Message.Smilies=Class.extend({init:function(t){require(["WoltLabSuite/Core/Ui/Smiley/Insert"],function(e){new e(t)})}}),WCF.Message.InlineEditor=Class.extend({_container:{},_containerID:0,_dropdowns:{},_messageContainerSelector:".jsMessage",_messageEditorIDPrefix:"messageEditor",init:function(t,e,s){require(["WoltLabSuite/Core/Ui/Message/InlineEditor"],function(e){new e({className:this._getClassName(),containerId:t,editorPrefix:this._messageEditorIDPrefix,messageSelector:this._messageContainerSelector,quoteManager:s||null,callbackDropdownInit:this._callbackDropdownInit.bind(this)})}.bind(this))},_click:function(e,t){t=null===e?~~t:~~elData(e.currentTarget,"container-id"),require(["WoltLabSuite/Core/Ui/Message/InlineEditor"],function(e){e.legacyEdit(t)}.bind(this)),e&&e.preventDefault()},_initDropdownMenu:function(e,t){},_callbackDropdownInit:function(e,t){return this._initDropdownMenu($(e).wcfIdentify(),$(t)),null},_getClassName:function(){return""}}),WCF.Message.Submit={_buttons:{},registerButton:function(e,t){WCF.Browser.isChrome()&&(this._buttons[e]=$(t))},execute:function(e){this._buttons[e]&&this._buttons[e].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,_selectionChangeTimer:null,_isMouseDown:!1,init:function(e,t,s,i,n,a,o){var r;this._className=t,""!==this._className?(this._objectType=s,""!==this._objectType?(this._containerSelector=i,this._message="",this._messageBodySelector=n,this._objectID=0,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._selectionChangeTimer=null,this._isMouseDown=!1,this._initContainers(),o=o&&e.supportPaste(),this._initCopyQuote(o),$(document).mouseup($.proxy(this._mouseUp,this)),document.addEventListener("selectionchange",this._selectionchange.bind(this)),this._quoteManager=e,this._quoteManager.register(this._objectType,this),WCF.DOMNodeInsertedHandler.addCallback("WCF.Message.Quote.Handler"+s.hashCode(),$.proxy(this._initContainers,this)),r=this._copyQuote[0],document.addEventListener("touchstart",function(e){var t;r.classList.contains("active")&&((t=e.target)===r||r.contains(t)||(r.classList.add("touchForceInaccessible"),document.addEventListener("touchend",function(){r.classList.remove("touchForceInaccessible")},{once:!0})))},{passive:!0})):console.debug("[WCF.Message.QuoteManager] Empty object type name given, aborting.")):console.debug("[WCF.Message.QuoteManager] Empty class name given, aborting.")},_initContainers:function(){var n=this;$(this._containerSelector).each(function(e,t){var s=$(t),i=s.wcfIdentify();if(!n._containers[i]){if((n._containers[i]=s).hasClass("jsInvalidQuoteTarget"))return!0;n._messageBodySelector&&s.data("body",s.find(n._messageBodySelector).data("containerID",i)),s.mousedown($.proxy(n._mouseDown,n)),s[0].classList.add("jsQuoteMessageContainer"),n._containers[i].find(".jsQuoteMessage").click($.proxy(n._saveFullQuote,n))}})},_selectionchange:function(){if(!this._isMouseDown){if(""===this._activeContainerID){var e=window.getSelection();if(1!==e.rangeCount||e.isCollapsed)return;var t=e.getRangeAt(0),s=elClosest(t.startContainer,".jsQuoteMessageContainer"),i=elClosest(t.endContainer,".jsQuoteMessageContainer");if(s&&s===i&&!s.classList.contains("jsInvalidQuoteTarget")){var n=t.commonAncestorContainer;n.nodeType!==Node.ELEMENT_NODE&&(n=n.parentNode);var a=n.offsetParent;if(s.contains(a)&&a.scrollTop+a.clientHeight<n.offsetTop)return;this._activeContainerID=s.id}}null!==this._selectionChangeTimer&&window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=window.setTimeout(this._mouseUp.bind(this),100)}},_mouseDown:function(e){this._copyQuote.removeClass("active"),this._activeContainerID=e.currentTarget.classList.contains("jsInvalidQuoteTarget")?"":e.currentTarget.id,null!==this._selectionChangeTimer&&(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),this._isMouseDown=!0},_getNodeText:function(e){function t(e){switch(e.tagName){case"BLOCKQUOTE":case"SCRIPT":return NodeFilter.FILTER_REJECT;case"IMG":if(!e.classList.contains("smiley")||0===e.alt.length)return NodeFilter.FILTER_REJECT;default:return NodeFilter.FILTER_ACCEPT}}t.acceptNode=t;for(var s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_TEXT,t,!0),i="",n=[];s.nextNode();){var a,o,r,l=s.currentNode;if(l.nodeType===Node.ELEMENT_NODE)switch(l.tagName){case"A":0<(r=l.textContent).indexOf("…")&&(2!==(a=r.split(/\u2026/)).length||0===(o=l.href).indexOf(a[0])&&o.substr(-1*a[1].length)===a[1]&&(i+=o,n.push(l)));break;case"BR":case"LI":case"UL":i+="\n";break;case"TD":$.browser.msie||(i+="\n");break;case"P":i+="\n\n";break;case"IMG":i+=" "+l.alt+" ";break;case"DIV":(l.classList.contains("codeBoxHeadline")||l.classList.contains("codeBoxLine"))&&(i+="\n")}else{if("A"===l.parentNode.nodeName&&-1!==n.indexOf(l.parentNode))continue;i+=l.nodeValue.replace(/\n/g," ")}}return i},_mouseUp:function(e){if(e&&e.originalEvent instanceof Event&&(null!==this._selectionChangeTimer&&(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),this._isMouseDown=!1),""!==this._activeContainerID){var t=window.getSelection();if(1!==t.rangeCount||t.isCollapsed)this._copyQuote.removeClass("active");else{for(var s,i,n,a,o,r,l,c,u,h,d,_=(g=this._containers[this._activeContainerID]).data("objectID"),g=g.data("body")||g,p=t.anchorNode;p&&p!==g[0];)p=p.parentNode;p===g[0]?(s=this._getSelectedText(),""!==(i=$.trim(s))?(a=(n=t.getRangeAt(0)).startContainer.nodeType===Node.TEXT_NODE?n.startContainer.parentNode:n.startContainer,o=n.endContainer.nodeType===Node.TEXT_NODE?n.endContainer.parentNode:n.endContainer,a.closest("blockquote")||o.closest("blockquote")?this._copyQuote.removeClass("active"):(r=this._getNodeText(g[0]),-1!==this._normalize(r).indexOf(this._normalize(i))&&(this._copyQuote.addClass("active"),l=this._getBoundingRectangle(g,window.getSelection()),c=this._copyQuote.getDimensions("outer"),(u=(l.right-l.left)/2-c.width/2+l.left)<(h=g[0].getBoundingClientRect()).left?u=h.left:u+c.width>h.right&&(u=h.right-c.width),this._copyQuote.css({top:l.bottom+7+"px",left:u+"px"}),this._copyQuote.removeClass("active"),null===this._selectionChangeTimer?this._activeContainerID="":(window.clearTimeout(this._selectionChangeTimer),this._selectionChangeTimer=null),d=this,window.setTimeout(function(){var e=$.trim(d._getSelectedText());""!==e&&(d._copyQuote.addClass("active"),d._message=e,d._objectID=_)},10)))):this._copyQuote.removeClass("active")):this._copyQuote.removeClass("active")}}else this._copyQuote.removeClass("active")},_normalize:function(e){return e.replace(/\r?\n|\r/g,"\n").replace(/\s/g," ").replace(/\s{2,}/g," ")},_getBoundingRectangle:function(e,t){var s,i,n=null;return 0<t.rangeCount&&(s=t.getRangeAt(0).getBoundingClientRect(),i=$(document).scrollTop(),n={bottom:s.bottom+i,left:s.left,right:s.right,top:s.top+i}),n},_initCopyQuote:function(e){var t;this._copyQuote=$("#quoteManagerCopy"),this._copyQuote.length||(this._copyQuote=$('<div id="quoteManagerCopy" class="balloonTooltip interactive"><span class="jsQuoteManagerStore">'+WCF.Language.get("wcf.message.quote.quoteSelected")+"</span></div>").appendTo(document.body),t=this._copyQuote.children("span.jsQuoteManagerStore").click($.proxy(this._saveQuote,this)),e&&$('<span class="jsQuoteManagerQuoteAndInsert">'+WCF.Language.get("wcf.message.quote.quoteAndReply")+"</span>").click($.proxy(this._saveAndInsertQuote,this)).insertAfter(t))},_getSelectedText:function(){var e=window.getSelection();return e.rangeCount?this._getNodeText(e.getRangeAt(0).cloneContents()):""},_saveFullQuote:function(e){e.preventDefault();var t=$(e.currentTarget);this._proxy.setOption("data",{actionName:"saveFullQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[t.data("objectID")]}),this._proxy.sendRequest(),t.data("isQuoted")?t.data("isQuoted",!1).children("a").removeClass("active"):t.data("isQuoted",!0).children("a").addClass("active");var s=t.parents(".buttonGroupNavigation");s.hasClass("jsMobileButtonGroupNavigation")&&s.children(".dropdownLabel").trigger("click")},_saveQuote:function(e){this._proxy.setOption("data",{actionName:"saveQuote",className:this._className,interfaceName:"wcf\\data\\IMessageQuoteAction",objectIDs:[this._objectID],parameters:{message:this._message,renderQuote:!0===e}}),this._proxy.sendRequest();var t=window.getSelection();t.rangeCount&&(t.removeAllRanges(),this._copyQuote[0].classList.remove("active"))},_saveAndInsertQuote:function(){this._saveQuote(!0)},_success:function(e){var t;switch(void 0!==e.returnValues.count&&(void 0!==e.returnValues.fullQuoteMessageIDs&&(e.returnValues.fullQuoteObjectIDs=e.returnValues.fullQuoteMessageIDs),t=void 0!==e.returnValues.fullQuoteObjectIDs?e.returnValues.fullQuoteObjectIDs:{},this._quoteManager.updateCount(e.returnValues.count,t)),e.actionName){case"saveQuote":case"saveFullQuote":e.returnValues.renderedQuote&&WCF.System.Event.fireEvent("com.woltlab.wcf.message.quote","insert",{forceInsert:"saveQuote"===e.actionName,quote:e.returnValues.renderedQuote})}},updateFullQuoteObjectIDs:function(i){for(var e in this._containers)this._containers[e].find(".jsQuoteMessage").each(function(e,t){var s=$(t).data("isQuoted",0);s.children("a").removeClass("active"),WCF.inArray(s.data("objectID"),i)&&s.data("isQuoted",1).children("a").addClass("active")})}}),WCF.Message.Quote.Manager=Class.extend({_buttons:{},_count:0,_dialog:null,_editorId:"",_editorIdAlternative:"",_form:null,_handlers:{},_hasTemplate:!1,_insertQuotes:!0,_proxy:null,_removeOnSubmit:[],_supportPaste:!1,_supportPasteOverride:!1,init:function(e,t,s,i){var n;this._buttons={insert:null,remove:null},this._count=parseInt(e)||0,this._dialog=null,this._editorId="",this._editorIdAlternative="",this._form=null,this._handlers={},this._hasTemplate=!1,this._insertQuotes=!0,this._removeOnSubmit=[],this._supportPaste=!1,this._supportPasteOverride=!1,!t||(n=$("#"+t)).length&&(this._editorId=t,this._supportPaste=!0,this._form=n.parents("form:eq(0)"),this._form.length?(this._form.submit(this._submit.bind(this)),this._removeOnSubmit=i||[]):(this._form=null,this._supportPaste=!0===s)),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this),url:"index.php?message-quote/&t="+SECURITY_TOKEN}),this._toggleShowQuotes(),WCF.System.Event.addListener("com.woltlab.wcf.quote","reload",this.countQuotes.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.message.quote","insert",function(e){WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:e.quote.username,content:e.quote.text,isText:!e.quote.isFullQuote,link:e.quote.link})}.bind(this))},setAlternativeEditor:function(e){this._editorIdAlternative||this._supportPaste||(this._hasTemplate=!1,this._supportPaste=!0,this._supportPasteOverride=!0),"object"==typeof e&&(e=e[0].id),this._editorIdAlternative=e},clearAlternativeEditor:function(){this._supportPasteOverride&&(this._hasTemplate=!1,this._supportPaste=!1,this._supportPasteOverride=!1),this._editorIdAlternative=""},register:function(e,t){this._handlers[e]=t},updateCount:function(e,t){for(var s in this._count=parseInt(e)||0,this._toggleShowQuotes(),this._handlers){var i;this._handlers.hasOwnProperty(s)&&(i=t[s]||[],this._handlers[s].updateFullQuoteObjectIDs(i))}},insertQuotes:function(e,t,s){this._insertQuotes?new WCF.Action.Proxy({autoSend:!0,data:{actionName:"getRenderedQuotes",className:e,interfaceName:"wcf\\data\\IMessageQuoteAction",parameters:{parentObjectID:t}},success:s}):this._insertQuotes=!0},_toggleShowQuotes:function(){require(["WoltLabSuite/Core/Ui/Page/Action"],function(e){var t,s="showQuotes";this._count?(void 0===(t=e.get(s))&&((t=elCreate("a")).addEventListener("mousedown",this._click.bind(this)),e.add(s,t)),t.textContent=WCF.Language.get("wcf.message.quote.showQuotes",{count:this._count}),e.show(s)):e.remove(s),this._hasTemplate=!1}.bind(this))},_click:function(){var e=document.activeElement;e.classList.contains("redactor-layer")&&$("#"+elData(e,"element-id")).redactor("selection.save"),this._hasTemplate?this._dialog.wcfDialog("open"):(this._proxy.showLoadingOverlayOnce(),this._proxy.setOption("data",{actionName:"getQuotes",supportPaste:this._supportPaste}),this._proxy.sendRequest())},renderDialog:function(e){null===this._dialog&&(this._dialog=$("#messageQuoteList"),this._dialog.length||(this._dialog=$('<div id="messageQuoteList" />').hide().appendTo(document.body))),this._dialog.html(e);var t=$('<div class="formSubmit" />').appendTo(this._dialog);this._supportPaste&&(this._buttons.insert=$('<button class="buttonPrimary">'+WCF.Language.get("wcf.message.quote.insertAllQuotes")+"</button>").click($.proxy(this._insertSelected,this)).appendTo(t)),this._buttons.remove=$("<button>"+WCF.Language.get("wcf.message.quote.removeAllQuotes")+"</button>").click($.proxy(this._removeSelected,this)).appendTo(t),this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.quote.manageQuotes")}),this._dialog.wcfDialog("render"),this._hasTemplate=!0;var i,s=this._dialog.find(".jsInsertQuote");this._supportPaste?s.click($.proxy(this._insertQuote,this)):s.hide(),this._dialog.find("input.jsCheckbox").change($.proxy(this._changeButtons,this)),this._removeOnSubmit.length&&(i=this)._dialog.find("input.jsRemoveQuote").each(function(e,t){var s=$(t).change($.proxy(this._change,this));WCF.inArray(s.parent("li").attr("data-quote-id"),i._removeOnSubmit)&&s.attr("checked","checked")})},_changeButtons:function(){this._dialog.find("input.jsCheckbox:checked").length?(this._supportPaste&&this._buttons.insert.html(WCF.Language.get("wcf.message.quote.insertSelectedQuotes")),this._buttons.remove.html(WCF.Language.get("wcf.message.quote.removeSelectedQuotes"))):(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(e){var t,s=$(e.currentTarget),i=s.parent("li").attr("data-quote-id");s.prop("checked")?this._removeOnSubmit.push(i):-1!==(t=this._removeOnSubmit.indexOf(i))&&this._removeOnSubmit.splice(t,1)},_insertSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked"),this._dialog.find("input.jsCheckbox:checked").each($.proxy(function(e,t){this._insertQuote(null,t)},this)),this._dialog.wcfDialog("close")},_insertQuote:function(e,t){var s=$(e?e.currentTarget:t).parents("li:eq(0)"),i=s.children(".jsFullQuote")[0].textContent.trim(),n=s.parents(".message:eq(0)"),a=n.data("username"),o=n.data("link"),r=!elDataBool(s[0],"is-full-quote");WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","insertQuote_"+(this._editorIdAlternative?this._editorIdAlternative:this._editorId),{author:a,content:i,isText:r,link:o}),this._removeOnSubmit.push(s.data("quote-id")),null!==e&&this._dialog.wcfDialog("close")},_removeSelected:function(){this._dialog.find("input.jsCheckbox:checked").length||this._dialog.find("input.jsCheckbox").prop("checked","checked");var s=[];if(this._dialog.find("input.jsCheckbox:checked").each(function(e,t){s.push($(t).parents("li").attr("data-quote-id"))}),s.length){var e=[];for(var t in this._handlers)this._handlers.hasOwnProperty(t)&&e.push(t);this._proxy.setOption("data",{actionName:"remove",getFullQuoteObjectIDs:0<this._handlers.length,objectTypes:e,quoteIDs:s}),this._proxy.sendRequest(),this._dialog.wcfDialog("close")}},_submit:function(){if(this._supportPaste&&0<this._removeOnSubmit.length)for(var e=this._form.find(".formSubmit"),t=0,s=this._removeOnSubmit.length;t<s;t++)$('<input type="hidden" name="__removeQuoteIDs[]" value="'+this._removeOnSubmit[t]+'" />').appendTo(e)},getQuotesMarkedForRemoval:function(){return this._removeOnSubmit},markQuotesForRemoval:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"markForRemoval",quoteIDs:this._removeOnSubmit}),this._proxy.suppressErrors(),this._proxy.sendRequest())},removeMarkedQuotes:function(){this._removeOnSubmit.length&&(this._proxy.setOption("data",{actionName:"removeMarkedQuotes",getFullQuoteObjectIDs:0<this._handlers.length}),this._proxy.sendRequest())},countQuotes:function(){var e=[];for(var t in this._handlers)this._handlers.hasOwnProperty(t)&&e.push(t);this._proxy.setOption("data",{actionName:"count",getFullQuoteObjectIDs:0<e.length,objectTypes:e}),this._proxy.sendRequest()},_success:function(e){var t;null!==e&&(void 0!==e.count&&(t=void 0!==e.fullQuoteObjectIDs?e.fullQuoteObjectIDs:{},this.updateCount(e.count,t)),void 0!==e.template&&(""==$.trim(e.template)?this.updateCount(0,{}):this.renderDialog(e.template)))},supportPaste:function(){return this._supportPaste}}),WCF.Message.Share={},WCF.Message.Share.Content=Class.extend({_cache:{},_dialog:null,_shareButtonsTemplate:"",init:function(e){this._shareButtonsTemplate=e||"",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 t,s,i=$(e.currentTarget),n=i.prop("href"),a=i.data("linkTitle")?i.data("linkTitle"):n,o=n.hashCode();void 0===this._cache[o]?(t=!1,null===this._dialog?(this._dialog=$('<div id="shareContentDialog" />').hide().appendTo(document.body),t=!0):this._dialog.empty(),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalink">'+WCF.Language.get("wcf.message.share.permalink")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalink" class="long" readonly />').attr("value",n).appendTo(s),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalinkBBCode">'+WCF.Language.get("wcf.message.share.permalink.bbcode")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalinkBBCode" class="long" readonly />').attr("value","[url='"+n+"']"+a+"[/url]").appendTo(s),s=$('<section class="section"><h2 class="sectionTitle"><label for="__sharePermalinkHTML">'+WCF.Language.get("wcf.message.share.permalink.html")+"</label></h2></section>").appendTo(this._dialog),$('<input type="text" id="__sharePermalinkHTML" class="long" readonly />').attr("value",'<a href="'+n+'">'+WCF.String.escapeHTML(a)+"</a>").appendTo(s),""!==this._shareButtonsTemplate&&(s=$('<section class="section"><h2 class="sectionTitle">'+WCF.Language.get("wcf.message.share")+"</h2>"+this._shareButtonsTemplate+"</section>").appendTo(this._dialog),elData(s.children(".jsMessageShareButtons")[0],"url",WCF.String.escapeHTML(n))),this._cache[o]=this._dialog.html(),t?this._dialog.wcfDialog({title:WCF.Language.get("wcf.message.share")}):this._dialog.wcfDialog("open")):this._dialog.html(this._cache[o]).wcfDialog("open"),this._enableSelection()},_enableSelection:function(){var e=this._dialog.find("input").click(function(){$(this).select()});navigator.userAgent.match(/iP(ad|hone|od)/)&&e.keydown(function(){return!1}).removeAttr("readonly").click(function(){this.setSelectionRange(0,9999)})}}),WCF.Message.Share.Page=Class.extend({init:function(){require(["WoltLabSuite/Core/Ui/Message/Share"],function(e){e.init()})}}),WCF.Message.UserMention=Class.extend({init:function(){throw new Error("Support for mentions in Redactor are now enabled by adding the attribute 'data-support-mention=\"true\"' to the textarea element.")}}),$.widget("wcf.messageTabMenu",{_tabs:[],_tabsByName:{},options:{collapsible:!0},_create:function(){var s=this.element.find("> nav").find("> ul > li:not(.jsFlexibleMenuDropdown)"),e=this.element.find("> div, > fieldset");if(s.length==e.length){var i=this.element.data("preselect");e.each(function(e,t){if(null!==elBySel(".innerError",t))return i=$(s[e]).data("name"),!1}),"true"===i&&(i=!0),this._tabs=[],this._tabsByName={};for(var t=0;t<s.length;t++){var n,a=$(s[t]),o=$(e[t]),r=a.data("name");void 0===r&&(void 0!==(n=a.children("a").prop("href"))&&n.match(/#([a-zA-Z_-]+)$/)&&(r=RegExp.$1),void 0===r&&(r=a.wcfIdentify())),this._tabs.push({container:o,name:r,tab:a}),this._tabsByName[r]=t;var l=a.children("a").data("index",t).on("mousedown",this._showTab.bind(this));l.attr("role","button").attr("tabindex","0").attr("aria-haspopup",!0).attr("aria-expanded",!1).attr("aria-controls",o[0].id),l.on("keydown",function(e){13!==e.which&&32!==e.which||(e.preventDefault(),this._showTab(e))}.bind(this)),(i===r||!0===i&&0===t)&&l.trigger("mousedown")}!0===i&&this._tabs.length&&!window.matchMedia("(max-width: 544px)").matches&&this._tabs[0].tab.children("a").trigger("click");var c=this.element.data("collapsible");void 0!==c&&(this.options.collapsible=c);var u=elData(this.element[0],"wysiwyg-container-id");u&&WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+u,function(){for(var e=0,t=this._tabs.length;e<t;e++)this._tabs[e].container.removeClass("active"),this._tabs[e].tab.removeClass("active")}.bind(this))}else console.debug("[wcf.messageTabMenu] Amount of tabs does not equal amount of tab containers, aborting.")},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments),this.element.remove()},_showTab:function(e,t,s){var i=null===e?t:$(e.currentTarget).data("index");s=!this.options.collapsible||!0===s;for(var n=null,a=0;a<this._tabs.length;a++){var o=this._tabs[a];if(a==i){if(!o.tab.hasClass("active")){o.tab.addClass("active"),o.container.addClass("active"),(n=o).tab.children("a").attr("aria-expanded",!0);var r,l=o.container[0];null!==elBySel(".messageTabMenuContent.active",l)||null===elBySel(".messageTabMenuContent",l)||null!==(r=elBySel("nav > ul > li[data-name] > a",l))&&$(r).trigger("mousedown");continue}if(!0===s)continue}o.tab.removeClass("active"),o.container.removeClass("active"),o.tab.children("a").attr("aria-expanded",!1)}null!==e&&(e.preventDefault(),e.stopPropagation()),null!==n&&this._trigger("show",{},{activeTab:n}),$(window).trigger("resize")},showTab:function(e,t){$.isNumeric(e)||void 0!==this._tabsByName[e]&&(e=this._tabsByName[e]),void 0!==this._tabs[e]?this._showTab(null,e,t):console.debug("[wcf.messageTabMenu] Cannot locate tab identified by '"+e+"'")},getTab:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].tab:null},getContainer:function(e){return void 0!==this._tabsByName[e]?this._tabs[this._tabsByName[e]].container:null}}); })(this);
// WCF.Poll.js
(function (window, undefined) { "use strict";WCF.Poll={},WCF.Poll.Management=Class.extend({_container:null,_count:0,_editorId:"",_maxOptions:0,init:function(e,t,i,n,o){this._count=0,this._maxOptions=i||-1,this._container=$("#"+e).children("ol:eq(0)"),this._fieldName=o||"pollOptions",this._container.length?(t=t||[],this._createOptionList(t),n?(this._editorId=n,WCF.System.Event.addListener("com.woltlab.wcf.redactor2","reset_"+n,this._reset.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","submit_"+n,this._submit.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","validate_"+n,this._validate.bind(this)),WCF.System.Event.addListener("com.woltlab.wcf.redactor2","handleError_"+n,this._handleError.bind(this))):this._container.closest("form").submit($.proxy(this._submit,this)),require(["WoltLabSuite/Core/Ui/Sortable/List"],function(t){new t({containerId:e,options:{toleranceElement:"> div"}})})):console.debug("[WCF.Poll.Management] Invalid container id given, aborting.")},_createOptionList:function(t){for(var e=0,i=t.length;e<i;e++){var n=t[e];this._createOption(n.optionValue,n.optionID)}t.length<this._maxOptions&&this._createOption()},_createOption:function(t,e,i){t=t||"",e=parseInt(e)||0,i=i||null;var n=$('<li class="sortableNode" />').data("optionID",e);null===i?n.appendTo(this._container):n.insertAfter(i);var o=$('<div class="pollOptionInput" />').appendTo(n);$('<span class="icon icon16 fa-arrows sortableNodeHandle" />').appendTo(o),$('<a role="button" href="#" class="icon icon16 fa-plus jsTooltip jsAddOption pointer" title="'+WCF.Language.get("wcf.poll.button.addOption")+'" />').click($.proxy(this._addOption,this)).appendTo(o),$('<a role="button" href="#" class="icon icon16 fa-times jsTooltip jsDeleteOption pointer" title="'+WCF.Language.get("wcf.poll.button.removeOption")+'" />').click($.proxy(this._removeOption,this)).appendTo(o);var s=$('<input type="text" value="'+t+'" maxlength="255" />').keydown($.proxy(this._keyDown,this)).appendTo(o);s.click(function(){document.activeElement!==this&&this.focus()}),null!==i&&s.focus(),WCF.DOMNodeInsertedHandler.execute(),this._count++,this._count===this._maxOptions&&this._container.find("span.jsAddOption").removeClass("pointer").addClass("disabled")},_keyDown:function(t){13===t.which&&($(t.currentTarget).parent().children(".jsAddOption").trigger("click"),t.preventDefault())},_addOption:function(t){if(t.preventDefault(),this._count===this._maxOptions)return!1;var e=$(t.currentTarget).closest("li",this._container[0]);this._createOption(void 0,void 0,e)},_removeOption:function(t){t.preventDefault(),$(t.currentTarget).closest("li",this._container[0]).remove(),this._count--,this._container.find("span.jsAddOption").addClass("pointer").removeClass("disabled"),0==this._container.children("li").length&&this._createOption()},_submit:function(i){var o=[];if(this._container.children("li").each(function(t,e){var i=$(e),n=$.trim(i.find("input").val());""!=n&&o.push(i.data("optionID")+"_"+n)}),"object"==typeof i.originalEvent&&i.originalEvent instanceof Event){if(o.length)for(var t=this._container.parents("form").find(".formSubmit"),e=0,n=o.length;e<n;e++)$('<input type="hidden" name="'+this._fieldName+"["+e+']">').val(o[e]).appendTo(t)}else i.poll={pollOptions:o},this._container.parents(".messageTabMenuContent:eq(0)").find("input").each(function(t,e){e.name&&("checkbox"===e.type&&!e.checked||(i.poll[e.name]=e.value))})},_reset:function(){for(var t=this._container[0];1<t.childElementCount;)t.removeChild(t.children[1]);elBySel("input",t.children[0]).value="",this._container.parents(".messageTabMenuContent:eq(0)").find("input").each(function(t,e){e.name&&("checkbox"===e.type?e.checked=!1:"text"===e.type?e.value="":"number"===e.type&&(e.value=e.min))}),require(["WoltLabSuite/Core/Date/Picker"],function(t){t.clear("pollEndTime_"+this._editorId)}.bind(this))},_validate:function(t){var e,i,n;""!==elById("pollQuestion_"+this._editorId).value.trim()&&(e=0,elBySelAll('li input[type="text"]',this._container[0],function(t){""!==t.value.trim()&&e++}),0===e?(t.api.throwError(this._container[0],WCF.Language.get("wcf.global.form.error.empty")),t.valid=!1):(n=~~(i=elById("pollMaxVotes_"+this._editorId)).value)&&e<n&&(t.api.throwError(i,WCF.Language.get("wcf.poll.maxVotes.error.invalid")),t.valid=!1))},_handleError:function(t){switch(t.returnValues.fieldName){case"pollEndTime":case"pollMaxVotes":var e="pollEndTime"===t.returnValues.fieldName?"endTime":"maxVotes",i=elCreate("small");i.className="innerError",i.innerHTML=WCF.Language.get("wcf.poll."+e+".error."+t.returnValues.errorType);var n=elById(t.returnValues.fieldName+"_"+this._editorId),o=n.parentElement;o.classList.contains("inputAddon")&&(o=(n=o).parentElement),o.insertBefore(i,n.nextSibling),t.cancel=!0}}}),WCF.Poll.Manager=Class.extend({_cache:{},_canViewParticipants:{},_canViewResult:{},_canVote:{},_inputElements:{},_participants:{},_polls:{},_proxy:null,init:function(t){var o,e=$(t);e.length?(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}),o=this,e.each(function(t,e){var i=$(e),n=i.data("pollID");void 0===o._polls[n]&&(o._cache[n]={result:"",vote:""},o._polls[n]=i,o._canViewParticipants[n]=!!i.data("canViewParticipants"),o._canViewResult[n]=!!i.data("canViewResult"),o._canVote[n]=!!i.data("canVote"),o._bindListeners(n),i.data("inVote")&&o._prepareVote(n),o._toggleButtons(n))})):console.debug("[WCF.Poll.Manager] Given selector '"+t+"' does not match, aborting.")},_bindListeners:function(t){this._polls[t].find(".jsButtonPollShowParticipants").data("pollID",t).click($.proxy(this._showParticipants,this)),this._polls[t].find(".jsButtonPollShowResult").data("pollID",t).click($.proxy(this._showResult,this)),this._polls[t].find(".jsButtonPollShowVote").data("pollID",t).click($.proxy(this._showVote,this)),this._polls[t].find(".jsButtonPollVote").data("pollID",t).click($.proxy(this._vote,this))},_showResult:function(t,e){var i=null===t?e:$(t.currentTarget).data("pollID");this._canViewResult[i]&&this._polls[i].data("inVote")&&(this._cache[i].result?(this._polls[i].find(".pollInnerContainer").html(this._cache[i].result),this._polls[i].data("inVote",!1),this._toggleButtons(i)):(this._proxy.setOption("data",{actionName:"getResult",pollID:i}),this._proxy.sendRequest()))},_showParticipants:function(t){var e=$(t.currentTarget).data("pollID");this._participants[e]||(this._participants[e]=new WCF.User.List("wcf\\data\\poll\\PollAction",this._polls[e].data("question"),{pollID:e})),this._participants[e].open()},_showVote:function(t,e){var i=null===t?e:$(t.currentTarget).data("pollID");this._canVote[i]&&(this._polls[i].data("inVote")||(this._cache[i].vote?(this._polls[i].find(".pollInnerContainer").html(this._cache[i].vote),this._polls[i].data("inVote",!0),this._prepareVote(i),this._toggleButtons(i)):(this._proxy.setOption("data",{actionName:"getVote",pollID:i}),this._proxy.sendRequest())))},_success:function(t,e,i){if(t&&t.actionName){var n=t.pollID;switch(t.resultTemplate&&(this._cache[n].result=t.resultTemplate),t.voteTemplate&&(this._cache[n].vote=t.voteTemplate),t.actionName){case"getResult":this._showResult(null,n);break;case"getVote":this._showVote(null,n);break;case"vote":this._canViewResult[n]=!0,this._canVote[n]=!!t.canVote,this._polls[n].data("isPublic")&&(this._canViewParticipants[n]=!0);var o=elBySel(".jsPollTotalVotes",this._polls[n][0]);o.textContent=WCF.String.formatNumeric(t.totalVotes),elData(o,"tooltip",t.totalVotesTooltip),this._showResult(null,n)}}},_prepareVote:function(t){this._polls[t].find(".jsButtonPollVote").disable();var e=this._polls[t].find(".pollInnerContainer > .jsPollVote"),i=this;this._inputElements[t]=e.find("input").change(function(){i._handleVoteButton(t)}),this._handleVoteButton(t);var n=e.data("maxVotes");this._inputElements[t].filter("[type=checkbox]").length&&(this._inputElements[t].change(function(){i._enforceMaxVotes(t,n)}),this._enforceMaxVotes(t,n))},_enforceMaxVotes:function(t,e){var i=this._inputElements[t];i.filter(":checked").length==e?i.filter(":not(:checked)").disable():i.enable()},_handleVoteButton:function(t){var e=this._inputElements[t],i=this._polls[t].find(".jsButtonPollVote");e.filter(":checked").length?i.enable():i.disable()},_toggleButtons:function(t){var e=this._polls[t].children(".formSubmit");e.find(".jsButtonPollShowParticipants, .jsButtonPollShowResult, .jsButtonPollShowVote, .jsButtonPollVote").hide();var i=!0;this._polls[t].data("inVote")?(i=!1,e.find(".jsButtonPollVote").show(),this._canViewResult[t]&&e.find(".jsButtonPollShowResult").show()):(this._canVote[t]&&(i=!1,e.find(".jsButtonPollShowVote").show()),this._canViewParticipants[t]&&(i=!1,e.find(".jsButtonPollShowParticipants").show())),i&&e.hide()},_vote:function(t){var n,e=$(t.currentTarget).data("pollID");this._canVote[e]&&(n=[],this._inputElements[e].each(function(t,e){var i=$(e);i.is(":checked")&&n.push(i.data("optionID"))}),n.length&&(this._proxy.setOption("data",{actionName:"vote",optionIDs:n,pollID:e}),this._proxy.sendRequest()))}}); })(this);
(function (window, undefined) { "use strict";WCF.Search.Message={},WCF.Search.Message.KeywordList=WCF.Search.Base.extend({_className:"wcf\\data\\search\\keyword\\SearchKeywordAction",_divider:null,_forceSubmit:!1,init:function(e,i,s){var t,r;$.isFunction(i)?(this._callback=i,this._excludedSearchValues=[],s&&(this._excludedSearchValues=s),this._searchInput=$(e).keyup($.proxy(this._keyUp,this)).keydown($.proxy(function(e){13===e.which&&this._itemCount&&-1!==this._itemIndex&&e.preventDefault()},this)),r=(t=WCF.Dropdown.getDropdownMenu(this._searchInput.parents(".dropdown").wcfIdentify())).find("li.dropdownDivider").last(),this._divider=$('<li class="dropdownDivider" />').hide().insertBefore(r),this._list=$('<li class="dropdownList"><ul /></li>').hide().insertBefore(r).children("ul"),t.find("input, label").on("click",function(e){e.stopPropagation()}),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)})):console.debug("[WCF.Search.Message.KeywordList] The given callback is invalid, aborting.")},_createListItem:function(e){this._divider.show(),this._list.parent().show(),this._super(e)},_clearList:function(e){e&&this._searchInput.val(""),this._divider.hide(),this._list.empty().parent().hide(),WCF.CloseOverlayHandler.removeCallback("WCF.Search.Base"),this._itemCount=0,this._itemIndex=-1}}); })(this);
// WCF.User.js
-(function (window, undefined) { "use strict";WCF.User.Login=Class.extend({_loginSubmitButton:null,_password:null,_passwordContainer:null,_useCookies:null,_useCookiesContainer:null,init:function(t){this._loginSubmitButton=$("#loginSubmitButton"),this._password=$("#password"),this._passwordContainer=this._password.parents("dl"),this._useCookies=$("#useCookies"),this._useCookiesContainer=this._useCookies.parents("dl"),$("#loginForm").find("input[name=action]").change($.proxy(this._change,this)),t&&WCF.User.QuickLogin.init()},_change:function(t){"register"===$(t.currentTarget).val()?this._setState(!1,WCF.Language.get("wcf.user.button.register")):this._setState(!0,WCF.Language.get("wcf.user.button.login"))},_setState:function(t,e){t?(this._password.enable(),this._passwordContainer.removeClass("disabled"),this._useCookies.enable(),this._useCookiesContainer.removeClass("disabled")):(this._password.disable(),this._passwordContainer.addClass("disabled"),this._useCookies.disable(),this._useCookiesContainer.addClass("disabled")),this._loginSubmitButton.val(e)}}),WCF.User.Panel={},WCF.User.Panel.Abstract=Class.extend({_badge:null,_dropdown:null,_identifier:"",_loadData:!0,_markAllAsReadLink:null,_options:{},_proxy:null,_triggerElement:null,_button:null,_callbackFocus:null,_callbackCloseUuid:"",_wasInsideDropdown:!1,init:function(t,e,i){var s;this._dropdown=null,this._loadData=!0,this._identifier=e,this._triggerElement=t,this._options=i,this._callbackFocus=null,this._callbackCloseUuid="",this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)}),this._triggerElement.click($.proxy(this.toggle,this)),this._button=elBySel("a",this._triggerElement[0]),this._button&&(elAttr(this._button,"role","button"),elAttr(this._button,"tabindex","0"),elAttr(this._button,"aria-haspopup",!0),elAttr(this._button,"aria-expanded",!1)),this._options.showAllLink&&this._triggerElement.dblclick($.proxy(this._dblClick,this)),!0===this._options.staticDropdown?this._loadData=!1:(s=this._triggerElement.find("span.badge")).length&&(this._badge=s)},toggle:function(t){return t instanceof Event&&t.preventDefault(),null===this._dropdown&&(this._dropdown=this._initDropdown()),this._dropdown.toggle()?(this._loadData||null===this._badge||!parseInt(this._badge.text())||this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding").length||(this._loadData=!0),this._loadData&&(this._loadData=!1,this._load()),elAttr(this._button,"aria-expanded",!0),null===this._callbackFocus&&(this._callbackFocus=this._maintainFocus.bind(this)),document.body.addEventListener("focus",this._callbackFocus,{capture:!0}),this._callbackCloseUuid=WCF.System.Event.addListener("WCF.Dropdown.Interactive.Instance","close",function(t){t.instance===this._dropdown&&(WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0}))}.bind(this))):(elAttr(this._button,"aria-expanded",!1),WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0})),!1},_dblClick:function(t){return t.preventDefault(),window.location=this._options.showAllLink,!1},_initDropdown:function(){var t=WCF.Dropdown.Interactive.Handler.create(this._triggerElement,this._identifier,this._options);return $('<li class="loading"><span class="icon icon24 fa-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(t.getItemList()),t},_load:function(){},_success:function(t){var e,i,s;void 0!==t.returnValues.template&&(e=this._dropdown.getItemList().empty(),$(t.returnValues.template).appendTo(e),e.children().length||$('<li class="noItems">'+this._options.noItems+"</li>").appendTo(e),this._options.enableMarkAsRead&&(i=this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding"),null===this._markAllAsReadLink&&i.length&&(this._markAllAsReadLink=$('<li class="interactiveDropdownItemMarkAllAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAllAsRead")+'" class="jsTooltip"><span class="icon icon24 fa-check" /></a></li>').appendTo(this._dropdown.getLinkList())).click(function(t){return this._dropdown.close(),this._markAllAsRead(),!1}.bind(this)),i.each(function(t,e){var i=$(e).addClass("interactiveDropdownItemOutstandingIcon"),s=i.data("objectID");$('<div class="interactiveDropdownItemMarkAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></div>').appendTo(i).click(function(t){return this._markAsRead(t,s),!1}.bind(this))}.bind(this))),this._dropdown.getItemList().children().each(function(t,e){var i=$(e),s=i.data("link");s&&($.browser.msie?i.click(function(t){if("A"!==t.target.tagName)return window.location=s,!1}):(i.addClass("interactiveDropdownItemShadow"),$('<a href="'+s+'" class="interactiveDropdownItemShadowLink" />').appendTo(i)),i.data("linkReplaceAll")&&i.find("> .box48 a:not(.userLink)").prop("href",s))}),this._dropdown.rebuildScrollbar()),void 0!==t.returnValues.totalCount&&this.updateBadge(t.returnValues.totalCount),this._options.enableMarkAsRead&&(t.returnValues.markAsRead?(s=this._dropdown.getItemList().children("li[data-object-id="+t.returnValues.markAsRead+"]")).length&&(s.removeClass("interactiveDropdownItemOutstanding").data("isRead",!0),s.children(".interactiveDropdownItemMarkAsRead").remove()):t.returnValues.markAllAsRead&&(this.resetItems(),this.updateBadge(0)))},_markAsRead:function(t,e){},_markAllAsRead:function(){},updateBadge:function(t){(t=parseInt(t)||0)?(null===this._badge&&(this._badge=$('<span class="badge badgeUpdate" />').appendTo(this._triggerElement.children("a")),this._badge.before(" ")),this._badge.text(t)):null!==this._badge&&(this._badge.remove(),this._badge=null),this._options.enableMarkAsRead&&(t||null===this._markAllAsReadLink||(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)),WCF.System.Event.fireEvent("com.woltlab.wcf.userMenu","updateBadge",{count:t,identifier:this._identifier})},resetItems:function(){null!==this._dropdown&&(this._dropdown.resetItems(),this._loadData=!0)},_maintainFocus:function(t){var e;document.activeElement&&!document.activeElement.classList.contains("focus-visible")||((e=this._dropdown.getContainer()[0]).contains(t.target)?this._wasInsideDropdown=!0:this._wasInsideDropdown?(this._button.focus(),this._wasInsideDropdown=!1):elBySel("a",e).focus())}}),WCF.User.Panel.Notification=WCF.User.Panel.Abstract.extend({_favico:null,init:function(t){t.enableMarkAsRead=!0,this._super($("#userNotifications"),"userNotifications",t);try{var e;this._favico=new Favico({animation:"none",type:"circle"}),null!==this._badge&&(e=parseInt(this._badge.text())||0,this._favico.badge(e))}catch(t){console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: "+t.message)}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this)),require(["EventHandler"],function(t){t.add("com.woltlab.wcf.UserMenuMobile","more",function(t){"com.woltlab.wcf.notifications"===t.identifier&&this.toggle()}.bind(this))}.bind(this))},_initDropdown:function(){var t=this._super();return $('<li><a href="'+this._options.settingsLink+'" title="'+WCF.Language.get("wcf.user.panel.settings")+'" class="jsTooltip"><span class="icon icon24 fa-cog" /></a></li>').appendTo(t.getLinkList()),t},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},_markAsRead:function(t,e){this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest()},_markAllAsRead:function(t){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},resetItems:function(){this._super(),this._markAllAsReadLink&&(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)},updateBadge:function(t){t=parseInt(t)||0,$("#userNotifications").attr("data-count",t),null!==this._favico&&this._favico.badge(t),this._super(t)},updateUserNotificationCount:function(t){null!==this._dropdown&&this._dropdown.resetItems(),this.updateBadge(t)},_success:function(t){this._super(t),elBySelAll(".interactiveDropdownItemShadowLink",this._dropdown.getItemList()[0],function(t){t.addEventListener("click",function(t){t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||this._dropdown.close()}.bind(this))}.bind(this))}}),WCF.User.Panel.UserMenu=WCF.User.Panel.Abstract.extend({init:function(){this._super($("#userMenu"),"userMenu",{pointerOffset:"13px",staticDropdown:!0})}}),WCF.User.QuickLogin={init:function(){require(["EventHandler","Ui/Dialog"],function(t,s){var a=elById("loginForm"),n=elBySel(".loginFormLogin",a);n&&!n.nextElementSibling&&a.classList.add("loginFormLoginOnly");for(var o=elBySel(".loginFormRegister",a),e=function(t){if(t instanceof Event&&(t.preventDefault(),t.stopPropagation()),a.style.removeProperty("display"),s.openStatic("loginForm",null,{title:WCF.Language.get("wcf.user.login")}),null!==n&&null!==o){var e=n.offsetTop,i=0;if(a.clientWidth>2*n.clientWidth)for(;e<o.offsetTop-50;)i+=100,n.style.setProperty("margin-bottom",i+"px","")}},i=document.getElementsByClassName("loginLink"),r=0,l=i.length;r<l;r++)i[r].addEventListener(WCF_CLICK_EVENT,e);var c=a.querySelector("#loginForm input[name=url]");null===c||c.value.match(/^https?:\/\//)||c.setAttribute("value",window.location.protocol+"//"+window.location.host+c.getAttribute("value")),t.add("com.woltlab.wcf.UserMenuMobile","more",function(t){"com.woltlab.wcf.login"===t.identifier&&(t.handler.close(!0),e())})})}},WCF.User.Profile={},WCF.User.Profile.ActivityPointList={_cache:{},_dialog:null,_didInit:!1,_proxy:null,init:function(){this._didInit||(this._cache={},this._dialog=null,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._init(),WCF.DOMNodeInsertedHandler.addCallback("WCF.User.Profile.ActivityPointList",$.proxy(this._init,this)),this._didInit=!0)},_init:function(){$(".activityPointsDisplay").removeClass("activityPointsDisplay").click($.proxy(this._click,this))},_click:function(t){t.preventDefault();var e=$(t.currentTarget).data("userID");void 0===this._cache[e]?(this._proxy.setOption("data",{actionName:"getDetailedActivityPointList",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[e]}),this._proxy.sendRequest()):this._show(e)},_show:function(t){null===this._dialog?(this._dialog=$("<div>"+this._cache[t]+"</div>").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})):(this._dialog.html(this._cache[t]),this._dialog.wcfDialog("open"))},_success:function(t,e,i){this._cache[t.returnValues.userID]=t.returnValues.template,this._show(t.returnValues.userID)}},WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(t){this._profileContent=$("#profileContent"),this._userID=t;var s=this._profileContent.data("active"),a=!1;this._profileContent.find("div.tabMenuContent").each($.proxy(function(t,e){var i=$(e).wcfIdentify();s===i?this._hasContent[i]=!0:(this._hasContent[i]=!1,a=!0)},this)),a&&(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this)),this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(t,e){var i=$(e);if(i.hasClass("ui-state-active"))return t&&this._loadContent(null,{newPanel:$("#"+i.attr("aria-controls"))}),!1},this))),$('.userProfileUser .contentDescription a[href$="#likes"]').click(function(t){t.preventDefault(),require(["Ui/TabMenu"],function(t){t.getTabMenu("profileContent").select("likes")})}.bind(this))},_loadContent:function(t,e){var i=$(e.newPanel),s=i.attr("id");this._hasContent[s]||(this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:s,menuItem:i.data("menuItem"),userID:this._userID}}}),this._proxy.sendRequest())},_success:function(i,t,e){var s=i.returnValues.containerID;this._hasContent[s]=!0,require(["Dom/ChangeListener","Dom/Util"],function(t,e){e.insertHtml(i.returnValues.template,elById(s),"append"),t.trigger()})}}),WCF.User.Profile.Editor=Class.extend({_actionName:"",_active:!1,_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(t,e){this._actionName="",this._active=!1,this._cachedTemplate="",this._tab=$("#about"),this._userID=t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),e&&this._beginEdit()},_initButtons:function(){this._buttons={beginEdit:$(".jsButtonEditProfile:eq(0)").click(this._beginEdit.bind(this))}},_beginEdit:function(t){t&&t.preventDefault(),this._active||(this._active=!0,this._actionName="beginEdit",this._buttons.beginEdit.parent().addClass("active"),$("#profileContent").wcfTabs("select","about"),this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]}),this._proxy.sendRequest())},_save:function(){var r,l,i=null;elBySelAll(".redactor-layer",this._tab[0],function(t){var e={api:{throwError:elInnerError},valid:!0};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","validate_"+elData(t,"element-id"),e),e.valid||null!==i||(i=t.parentNode)}),i?i.scrollIntoView({behavior:"smooth"}):(this._actionName="save",r=/values\[([a-zA-Z0-9._-]+)\]/,l={},this._tab.find("input, textarea, select").each(function(t,e){var i=$(e),s=null;switch(i.getTagName()){case"input":var a=i.attr("type");if(("radio"===a||"checkbox"===a)&&!i.prop("checked"))return;break;case"textarea":i.data("redactor")&&(s=i.redactor("code.get"))}var n,o=i.attr("name");r.test(o)&&(n=RegExp.$1,null===s&&(s=i.val()),"checkbox"===i.attr("type")&&/\[\]$/.test(o)?(Array.isArray(l[n])||(l[n]=[]),l[n].push(s)):l[n]=s)}),this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:l}}),this._proxy.sendRequest())},_restore:function(){this._actionName="restore",this._active=!1,this._buttons.beginEdit.parent().removeClass("active"),this._destroyEditor(),this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(t,e,i){switch(this._actionName){case"beginEdit":this._prepareEdit(t);break;case"save":t.returnValues.success?(this._cachedTemplate=t.returnValues.template,this._restore()):this._prepareEdit(t,!0)}},_prepareEdit:function(i,s){this._destroyEditor();var a=this;this._tab.html(function(t,e){return!0!==s&&(a._cachedTemplate=e),i.returnValues.template}),this._tab.find("input[type=text]").attr("autocomplete","off"),this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this)),this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this)),this._tab.find("input").keyup(function(t){if(t.which===$.ui.keyCode.ENTER)return a._save(),t.preventDefault(),!1})},_destroyEditor:function(){this._tab.find("textarea").each(function(t,e){var i=$(e);i.data("redactor")&&i.redactor("core.destroy")})}}),WCF.User.Registration={},WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(t,e,i){this._element=t,this._element.blur($.proxy(this._blur,this)),this._confirmElement=e||null,null!==this._confirmElement&&this._confirmElement.blur($.proxy(this._blurConfirm,this)),i=i||{},this._setOptions(i),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:!1}),this._setErrorMessages()},_setOptions:function(t){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(t){var e=this._element.val();if(!e)return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"));if(null!==this._confirmElement){var i=this._confirmElement.val();if(""!=i&&e!=i)return this._showError(this._confirmElement,this._errorMessages.notEqual)}this._validateOptions()&&(this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()}),this._proxy.sendRequest())},_getParameters:function(){return{}},_validateOptions:function(){return!0},_blurConfirm:function(t){if(!this._confirmElement.val())return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"));this._blur(t)},_success:function(t,e,i){t.returnValues.isValid?(this._showSuccess(this._element),null!==this._confirmElement&&this._confirmElement.val()&&this._showSuccess(this._confirmElement)):this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+t.returnValues.error))},_showError:function(t,e){t.parent().parent().addClass("formError").removeClass("formSuccess");var i=t.parent().find("small.innerError");i.length||(i=$("<small />").addClass("innerError").insertAfter(t)),i.text(e)},_showSuccess:function(t){t.parent().parent().addClass("formSuccess").removeClass("formError"),t.next("small.innerError").remove()}}),WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(t){this._options=$.extend(!0,{minlength:3,maxlength:25},t)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var t=this._element.val();return!(t.length<this._options.minlength||t.length>this._options.maxlength)||(this._showError(this._element,WCF.Language.get("wcf.user.username.error.invalid")),!1)},_getParameters:function(){return{username:this._element.val()}}}),WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}}),WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}}),WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput"),this._username=$("#usernameInput"),this._email.keyup($.proxy(this._checkEmail,this)),this._username.keyup($.proxy(this._checkUsername,this)),$.browser.mozilla&&$.browser.touch&&(this._email.on("input",$.proxy(this._checkEmail,this)),this._username.on("input",$.proxy(this._checkUsername,this))),this._checkEmail(),this._checkUsername()},_checkEmail:function(){""==this._email.val()?(this._username.enable(),this._username.parents("dl:eq(0)").removeClass("disabled")):(this._username.disable(),this._username.parents("dl:eq(0)").addClass("disabled"),this._username.val(""))},_checkUsername:function(){""==this._username.val()?(this._email.enable(),this._email.parents("dl:eq(0)").removeClass("disabled")):(this._email.disable(),this._email.parents("dl:eq(0)").addClass("disabled"),this._email.val(""))}}),WCF.Notification={},WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".contentHeaderNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})})}),this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each(function(t,e){var i=$(e);i.data("isRead")||(i.find("a:not(.userLink)").prop("href",i.data("link")),$('<a href="#" class="icon icon24 fa-check notificationItemMarkAsConfirmed jsTooltip" title="'+WCF.Language.get("wcf.user.notification.markAsConfirmed")+'" />').appendTo(i).click($.proxy(this._markAsConfirmed,this)));var s=e.querySelector(".details > p:first-child");s.classList.add("pointer"),s.addEventListener("click",function(t){window.location.href=i.data("link")})}.bind(this)),WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(t){t.preventDefault();var e=$(t.currentTarget).parents(".notificationItem:eq(0)").data("objectID");return this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest(),!1},_success:function(t,e,i){var s=$(".userNotificationItemList > .notificationItem[data-object-id="+t.returnValues.markAsRead+"]");s.data("isRead",!0),s.find(".newContentBadge").remove(),s.find(".notificationItemMarkAsConfirmed").remove(),s.removeClass("notificationUnconfirmed")}}),WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(t){var e=$("#previewContainer");e.length||(e=$('<section class="section" id="previewContainer"><h2 class="sectionTitle">'+WCF.Language.get("wcf.global.preview")+'</h2><div class="htmlContent messageSignatureConstraints"></div></section>').insertBefore($("#signatureContainer")).wcfFadeIn()),e.children("div").first().html(t.returnValues.message)}}),WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:!1,_loadButton:null,_proxy:null,_userID:0,init:function(t,e){this._container=$("#recentActivities"),this._filteredByFollowedUsers=!0===e,this._userID=t,null===this._userID||this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._container.children("li").length?(this._loadButton=$('<li class="showMore"><button class="small">'+WCF.Language.get("wcf.user.recentActivity.more")+"</button></li>").appendTo(this._container),this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))):$('<li class="showMore"><small>'+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small></li>").appendTo(this._container),WCF.User.userID&&$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_click:function(){this._loadButton.enable();var t={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};this._userID?t.userID=this._userID:this._filteredByFollowedUsers&&(t.filteredByFollowedUsers=1),this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:t}),this._proxy.sendRequest()},_switchContext:function(t){t.preventDefault(),$(t.currentTarget).hasClass("active")||new WCF.Action.Proxy({autoSend:!0,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity",window.location.reload()}})},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastEventTime",t.returnValues.lastEventTime),this._container.data("lastEventID",t.returnValues.lastEventID),this._loadButton.enable()):($("<small>"+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small>").appendTo(this._loadButton.parent()),this._loadButton.remove())}}),WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(t){var e;this._container=$("#likeList"),this._userID=t,this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),e=$('<li class="likeListMore showMore"><button class="small">'+WCF.Language.get("wcf.like.likes.more")+"</button><small>"+WCF.Language.get("wcf.like.likes.noMoreEntries")+"</small></li>").appendTo(this._container),this._loadButton=e.children("button").click($.proxy(this._click,this)),this._noMoreEntries=e.children("small").hide(),2==this._container.find("> li").length&&(this._loadButton.hide(),this._noMoreEntries.show()),$("#likeType .button").click($.proxy(this._clickLikeType,this)),$("#likeValue .button").click($.proxy(this._clickLikeValue,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_clickLikeType:function(t){var e=$(t.currentTarget);this._likeType!=e.data("likeType")&&(this._likeType=e.data("likeType"),$("#likeType .button").removeClass("active"),e.addClass("active"),this._reload())},_clickLikeValue:function(t){var e=$(t.currentTarget);this._likeValue!=e.data("likeValue")&&(this._likeValue=e.data("likeValue"),$("#likeValue .button").removeClass("active"),e.addClass("active"),$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesReceived")),$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesGiven")),this._container.find("> li.likeListMore button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.more")),this._container.find("> li.likeListMore small").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.noMoreEntries")),this._reload())},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove(),this._container.data("lastLikeTime",0),this._click()},_click:function(){this._loadButton.enable();var t={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:t}),this._proxy.sendRequest()},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastLikeTime",t.returnValues.lastLikeTime),this._noMoreEntries.hide(),this._loadButton.show().enable()):(this._noMoreEntries.show(),this._loadButton.hide())}}),WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink"),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1}),WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a,n,o=$("#"+this._activeElementID).data("userID");this._userProfiles[o]?this._insertContent(this._activeElementID,this._userProfiles[o],!0):(this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[o]}),a=this._activeElementID,(n=this)._proxy.setOption("success",function(t,e,i){n._userProfiles[o]=t.returnValues.template,n._insertContent(a,t.returnValues.template,!0)}),this._proxy.setOption("failure",function(t,e,i,s){return n._userProfiles[o]=t.message,n._insertContent(a,t.message,!0),!1}),this._proxy.sendRequest())},purge:function(t){delete this._userProfiles[t],this._data={}}}),WCF.User.Action={},WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._followButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._followButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._followButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.following?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("fa-plus").addClass("fa-minus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unfollow"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("fa-minus").addClass("fa-plus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.follow"))),i.data("following",s.returnValues.following),!1},this)),(new WCF.System.Notification).show()}}),WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._ignoreButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._ignoreButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.isIgnoredUser?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("fa-ban").addClass("fa-circle-o"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unignore"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("fa-circle-o").addClass("fa-ban"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.ignore"))),i.data("ignored",s.returnValues.isIgnoredUser),!1},this)),(new WCF.System.Notification).show();var i=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(t){t.purge(i._userID)})}}),WCF.User.Avatar={},WCF.User.Avatar.Upload=WCF.Upload.extend({_userID:0,init:function(t){this._super($("#avatarUpload > dd > div"),void 0,"wcf\\data\\user\\avatar\\UserAvatarAction"),this._userID=t||0,$("#avatarForm input[type=radio]").change(function(){"custom"==$(this).val()?$("#avatarUpload > dd > div").show():$("#avatarUpload > dd > div").hide()}),$("#avatarForm input[type=radio][value=custom]:checked").length||$("#avatarUpload > dd > div").hide()},_initFile:function(t){return $("#avatarUpload > dt > img")},_success:function(t,e){e.returnValues.url?(this._updateImage(e.returnValues.url),$("#avatarUpload > dd > .innerError").remove(),new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success")).show()):e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+e.returnValues.errorType))},_updateImage:function(t){$("#avatarUpload > dt > img").remove();var e=$('<img src="'+t+'" class="userAvatarImage" alt="" />').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});$("#avatarUpload > dt").prepend(e),WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var t=$("#avatarUpload > dd > .innerError");return t.length||(t=$('<small class="innerError"></span>'),$("#avatarUpload > dd").append(t)),t},_getParameters:function(){return{userID:this._userID}}}),WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(t,e,i){this._additionalParameters=i||{},this._cache={},this._className=t,this._dialog=null,this._dialogTitle=e,this._pageCount=0,this._pageNo=1,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1,this._showPage()},_showPage:function(t,e){var i;e&&e.activePage&&(this._pageNo=e.activePage),0!=this._pageCount&&(this._pageNo<1||this._pageNo>this._pageCount)?console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount):this._cache[this._pageNo]?(i=!1,null===this._dialog&&(this._dialog=$("#userList"+this._className.hashCode()),0===this._dialog.length&&(this._dialog=$('<div id="userList'+this._className.hashCode()+'" />').hide().appendTo(document.body),i=!0)),this._dialog.empty(),this._dialog.html(this._cache[this._pageNo]),1<this._pageCount?this._dialog.find(".jsPagination").wcfPages({activePage:this._pageNo,maxPage:this._pageCount}).on("wcfpagesswitched",$.proxy(this._showPage,this)):this._dialog.find(".jsPagination").hide(),i?this._dialog.wcfDialog({title:this._dialogTitle}):(this._dialog.wcfDialog("option","title",this._dialogTitle),this._dialog.wcfDialog("open").wcfDialog("render")),WCF.DOMNodeInsertedHandler.execute()):(this._additionalParameters.pageNo=this._pageNo,this._proxy.setOption("data",{actionName:"getGroupedUserList",className:this._className,interfaceName:"wcf\\data\\IGroupedUserListAction",parameters:this._additionalParameters}),this._proxy.sendRequest())},_success:function(t,e,i){t.returnValues.pageCount&&(this._pageCount=t.returnValues.pageCount),this._cache[this._pageNo]=t.returnValues.template,this._showPage()}}),WCF.User.ObjectWatch={},WCF.User.ObjectWatch.Subscribe=Class.extend({_buttonSelector:".jsSubscribeButton",_buttons:{},_dialog:null,_notification:null,_reloadOnUnsubscribe:!1,init:function(t){this._buttons={},this._notification=null,this._reloadOnUnsubscribe=!0===t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(this._buttonSelector).each($.proxy(function(t,e){var i=$(e);i.addClass("pointer");var s=i.data("objectType"),a=i.data("objectID");void 0===this._buttons[s]&&(this._buttons[s]={}),this._buttons[s][a]=i.click($.proxy(this._click,this))},this)),WCF.System.Event.addListener("com.woltlab.wcf.objectWatch","update",$.proxy(this._updateSubscriptionStatus,this))},_click:function(t){t.preventDefault();var e=$(t.currentTarget);this._proxy.setOption("data",{actionName:"manageSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{objectID:e.data("objectID"),objectType:e.data("objectType")}}),this._proxy.sendRequest()},_success:function(t,e,i){var s,a;"manageSubscription"===t.actionName?(null===this._dialog?(this._dialog=$("<div>"+t.returnValues.template+"</div>").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})):(this._dialog.html(t.returnValues.template),this._dialog.wcfDialog("open")),this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",t.returnValues.objectID).data("objectType",t.returnValues.objectType).click($.proxy(this._save,this)),s=this._dialog.find("input[name=enableNotification]").disable(),this._dialog.find("input[name=subscribe]").change(function(t){1==$(t.currentTarget).val()?s.enable():s.disable()}),(a=this._dialog.find("input[name=subscribe]:checked")).length&&1==a.val()&&s.enable()):"saveSubscription"===t.actionName&&this._dialog.is(":visible")&&(this._dialog.wcfDialog("close"),this._updateSubscriptionStatus({isSubscribed:t.returnValues.subscribe,objectID:t.returnValues.objectID}),null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._notification.show())},_save:function(t){var e=this._buttons[$(t.currentTarget).data("objectType")][$(t.currentTarget).data("objectID")],i=this._dialog.find("input[name=subscribe]:checked").val(),s=this._dialog.find("input[name=enableNotification]").is(":checked")?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:s,objectID:e.data("objectID"),objectType:e.data("objectType"),subscribe:i}}),this._proxy.sendRequest()},_updateSubscriptionStatus:function(t){var e=$(this._buttonSelector+"[data-object-id="+t.objectID+"]"),i=e.children(".icon");if(t.isSubscribed)i.removeClass("fa-bookmark-o").addClass("fa-bookmark"),e.data("isSubscribed",!0);else if(e.data("removeOnUnsubscribe")?e.parent().remove():(i.removeClass("fa-bookmark").addClass("fa-bookmark-o"),e.data("isSubscribed",!1)),this._reloadOnUnsubscribe)return void window.location.reload();WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",t)}}); })(this);
+(function (window, undefined) { "use strict";WCF.User.Login=Class.extend({_loginSubmitButton:null,_password:null,_passwordContainer:null,_useCookies:null,_useCookiesContainer:null,init:function(t){this._loginSubmitButton=$("#loginSubmitButton"),this._password=$("#password"),this._passwordContainer=this._password.parents("dl"),this._useCookies=$("#useCookies"),this._useCookiesContainer=this._useCookies.parents("dl"),$("#loginForm").find("input[name=action]").change($.proxy(this._change,this)),t&&WCF.User.QuickLogin.init()},_change:function(t){"register"===$(t.currentTarget).val()?this._setState(!1,WCF.Language.get("wcf.user.button.register")):this._setState(!0,WCF.Language.get("wcf.user.button.login"))},_setState:function(t,e){t?(this._password.enable(),this._passwordContainer.removeClass("disabled"),this._useCookies.enable(),this._useCookiesContainer.removeClass("disabled")):(this._password.disable(),this._passwordContainer.addClass("disabled"),this._useCookies.disable(),this._useCookiesContainer.addClass("disabled")),this._loginSubmitButton.val(e)}}),WCF.User.Panel={},WCF.User.Panel.Abstract=Class.extend({_badge:null,_dropdown:null,_identifier:"",_loadData:!0,_markAllAsReadLink:null,_options:{},_proxy:null,_triggerElement:null,_button:null,_callbackFocus:null,_callbackCloseUuid:"",_wasInsideDropdown:!1,init:function(t,e,i){var s;this._dropdown=null,this._loadData=!0,this._identifier=e,this._triggerElement=t,this._options=i,this._callbackFocus=null,this._callbackCloseUuid="",this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1,success:$.proxy(this._success,this)}),this._triggerElement.click($.proxy(this.toggle,this)),this._button=elBySel("a",this._triggerElement[0]),this._button&&(elAttr(this._button,"role","button"),elAttr(this._button,"tabindex","0"),elAttr(this._button,"aria-haspopup",!0),elAttr(this._button,"aria-expanded",!1)),this._options.showAllLink&&this._triggerElement.dblclick($.proxy(this._dblClick,this)),!0===this._options.staticDropdown?this._loadData=!1:(s=this._triggerElement.find("span.badge")).length&&(this._badge=s)},toggle:function(t){return t instanceof Event&&t.preventDefault(),null===this._dropdown&&(this._dropdown=this._initDropdown()),this._dropdown.toggle()?(this._loadData||null===this._badge||!parseInt(this._badge.text())||this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding").length||(this._loadData=!0),this._loadData&&(this._loadData=!1,this._load()),elAttr(this._button,"aria-expanded",!0),null===this._callbackFocus&&(this._callbackFocus=this._maintainFocus.bind(this)),document.body.addEventListener("focus",this._callbackFocus,{capture:!0}),this._callbackCloseUuid=WCF.System.Event.addListener("WCF.Dropdown.Interactive.Instance","close",function(t){t.instance===this._dropdown&&(WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0}))}.bind(this))):(elAttr(this._button,"aria-expanded",!1),WCF.System.Event.removeListener("WCF.Dropdown.Interactive.Instance","close",this._callbackCloseUuid),document.body.removeEventListener("focus",this._callbackFocus,{capture:!0})),!1},_dblClick:function(t){return t.preventDefault(),window.location=this._options.showAllLink,!1},_initDropdown:function(){var t=WCF.Dropdown.Interactive.Handler.create(this._triggerElement,this._identifier,this._options);return $('<li class="loading"><span class="icon icon24 fa-spinner" /> <span>'+WCF.Language.get("wcf.global.loading")+"</span></li>").appendTo(t.getItemList()),t},_load:function(){},_success:function(t){var e,i,s;void 0!==t.returnValues.template&&(e=this._dropdown.getItemList().empty(),$(t.returnValues.template).appendTo(e),e.children().length||$('<li class="noItems">'+this._options.noItems+"</li>").appendTo(e),this._options.enableMarkAsRead&&(i=this._dropdown.getItemList().children(".interactiveDropdownItemOutstanding"),null===this._markAllAsReadLink&&i.length&&(this._markAllAsReadLink=$('<li class="interactiveDropdownItemMarkAllAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAllAsRead")+'" class="jsTooltip"><span class="icon icon24 fa-check" /></a></li>').appendTo(this._dropdown.getLinkList())).click(function(t){return this._dropdown.close(),this._markAllAsRead(),!1}.bind(this)),i.each(function(t,e){var i=$(e).addClass("interactiveDropdownItemOutstandingIcon"),s=i.data("objectID");$('<div class="interactiveDropdownItemMarkAsRead"><a href="#" title="'+WCF.Language.get("wcf.user.panel.markAsRead")+'" class="jsTooltip"><span class="icon icon16 fa-check" /></a></div>').appendTo(i).click(function(t){return this._markAsRead(t,s),!1}.bind(this))}.bind(this))),this._dropdown.getItemList().children().each(function(t,e){var i=$(e),s=i.data("link");s&&($.browser.msie?i.click(function(t){if("A"!==t.target.tagName)return window.location=s,!1}):(i.addClass("interactiveDropdownItemShadow"),$('<a href="'+s+'" class="interactiveDropdownItemShadowLink" />').appendTo(i)),i.data("linkReplaceAll")&&i.find("> .box48 a:not(.userLink)").prop("href",s))}),this._dropdown.rebuildScrollbar()),void 0!==t.returnValues.totalCount&&this.updateBadge(t.returnValues.totalCount),this._options.enableMarkAsRead&&(t.returnValues.markAsRead?(s=this._dropdown.getItemList().children("li[data-object-id="+t.returnValues.markAsRead+"]")).length&&(s.removeClass("interactiveDropdownItemOutstanding").data("isRead",!0),s.children(".interactiveDropdownItemMarkAsRead").remove()):t.returnValues.markAllAsRead&&(this.resetItems(),this.updateBadge(0)))},_markAsRead:function(t,e){},_markAllAsRead:function(){},updateBadge:function(t){(t=parseInt(t)||0)?(null===this._badge&&(this._badge=$('<span class="badge badgeUpdate" />').appendTo(this._triggerElement.children("a")),this._badge.before(" ")),this._badge.text(t)):null!==this._badge&&(this._badge.remove(),this._badge=null),this._options.enableMarkAsRead&&(t||null===this._markAllAsReadLink||(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)),WCF.System.Event.fireEvent("com.woltlab.wcf.userMenu","updateBadge",{count:t,identifier:this._identifier})},resetItems:function(){null!==this._dropdown&&(this._dropdown.resetItems(),this._loadData=!0)},_maintainFocus:function(t){var e;document.activeElement&&!document.activeElement.classList.contains("focus-visible")||((e=this._dropdown.getContainer()[0]).contains(t.target)?this._wasInsideDropdown=!0:this._wasInsideDropdown?(this._button.focus(),this._wasInsideDropdown=!1):elBySel("a",e).focus())}}),WCF.User.Panel.Notification=WCF.User.Panel.Abstract.extend({_favico:null,init:function(t){t.enableMarkAsRead=!0,this._super($("#userNotifications"),"userNotifications",t);try{var e;this._favico=new Favico({animation:"none",type:"circle"}),null!==this._badge&&(e=parseInt(this._badge.text())||0,this._favico.badge(e))}catch(t){console.debug("[WCF.User.Panel.Notification] Failed to initialized Favico: "+t.message)}WCF.System.PushNotification.addCallback("userNotificationCount",$.proxy(this.updateUserNotificationCount,this)),require(["EventHandler"],function(t){t.add("com.woltlab.wcf.UserMenuMobile","more",function(t){"com.woltlab.wcf.notifications"===t.identifier&&this.toggle()}.bind(this))}.bind(this))},_initDropdown:function(){var t=this._super();return $('<li><a href="'+this._options.settingsLink+'" title="'+WCF.Language.get("wcf.user.panel.settings")+'" class="jsTooltip"><span class="icon icon24 fa-cog" /></a></li>').appendTo(t.getLinkList()),t},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingNotifications",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},_markAsRead:function(t,e){this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest()},_markAllAsRead:function(t){this._proxy.setOption("data",{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"}),this._proxy.sendRequest()},resetItems:function(){this._super(),this._markAllAsReadLink&&(this._markAllAsReadLink.remove(),this._markAllAsReadLink=null)},updateBadge:function(t){t=parseInt(t)||0,$("#userNotifications").attr("data-count",t),null!==this._favico&&this._favico.badge(t),this._super(t)},updateUserNotificationCount:function(t){null!==this._dropdown&&this._dropdown.resetItems(),this.updateBadge(t)},_success:function(t){this._super(t),elBySelAll(".interactiveDropdownItemShadowLink",this._dropdown.getItemList()[0],function(t){t.addEventListener("click",function(t){t.altKey||t.ctrlKey||t.metaKey||t.shiftKey||(this._dropdown.close(),WCF.System.Event.fireEvent("com.woltlab.wcf.UserMenuMobile","close"))}.bind(this))}.bind(this))}}),WCF.User.Panel.UserMenu=WCF.User.Panel.Abstract.extend({init:function(){this._super($("#userMenu"),"userMenu",{pointerOffset:"13px",staticDropdown:!0})}}),WCF.User.QuickLogin={init:function(){require(["EventHandler","Ui/Dialog"],function(t,s){var a=elById("loginForm"),n=elBySel(".loginFormLogin",a);n&&!n.nextElementSibling&&a.classList.add("loginFormLoginOnly");for(var o=elBySel(".loginFormRegister",a),e=function(t){if(t instanceof Event&&(t.preventDefault(),t.stopPropagation()),a.style.removeProperty("display"),s.openStatic("loginForm",null,{title:WCF.Language.get("wcf.user.login")}),null!==n&&null!==o){var e=n.offsetTop,i=0;if(a.clientWidth>2*n.clientWidth)for(;e<o.offsetTop-50;)i+=100,n.style.setProperty("margin-bottom",i+"px","")}},i=document.getElementsByClassName("loginLink"),r=0,l=i.length;r<l;r++)i[r].addEventListener(WCF_CLICK_EVENT,e);var c=a.querySelector("#loginForm input[name=url]");null===c||c.value.match(/^https?:\/\//)||c.setAttribute("value",window.location.protocol+"//"+window.location.host+c.getAttribute("value")),t.add("com.woltlab.wcf.UserMenuMobile","more",function(t){"com.woltlab.wcf.login"===t.identifier&&(t.handler.close(!0),e())})})}},WCF.User.Profile={},WCF.User.Profile.ActivityPointList={_cache:{},_dialog:null,_didInit:!1,_proxy:null,init:function(){this._didInit||(this._cache={},this._dialog=null,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._init(),WCF.DOMNodeInsertedHandler.addCallback("WCF.User.Profile.ActivityPointList",$.proxy(this._init,this)),this._didInit=!0)},_init:function(){$(".activityPointsDisplay").removeClass("activityPointsDisplay").click($.proxy(this._click,this))},_click:function(t){t.preventDefault();var e=$(t.currentTarget).data("userID");void 0===this._cache[e]?(this._proxy.setOption("data",{actionName:"getDetailedActivityPointList",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[e]}),this._proxy.sendRequest()):this._show(e)},_show:function(t){null===this._dialog?(this._dialog=$("<div>"+this._cache[t]+"</div>").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.activityPoint")})):(this._dialog.html(this._cache[t]),this._dialog.wcfDialog("open"))},_success:function(t,e,i){this._cache[t.returnValues.userID]=t.returnValues.template,this._show(t.returnValues.userID)}},WCF.User.Profile.TabMenu=Class.extend({_hasContent:{},_profileContent:null,_proxy:null,_userID:0,init:function(t){this._profileContent=$("#profileContent"),this._userID=t;var s=this._profileContent.data("active"),a=!1;this._profileContent.find("div.tabMenuContent").each($.proxy(function(t,e){var i=$(e).wcfIdentify();s===i?this._hasContent[i]=!0:(this._hasContent[i]=!1,a=!0)},this)),a&&(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._profileContent.on("wcftabsbeforeactivate",$.proxy(this._loadContent,this)),this._profileContent.find("> nav.tabMenu > ul > li").each($.proxy(function(t,e){var i=$(e);if(i.hasClass("ui-state-active"))return t&&this._loadContent(null,{newPanel:$("#"+i.attr("aria-controls"))}),!1},this))),$('.userProfileUser .contentDescription a[href$="#likes"]').click(function(t){t.preventDefault(),require(["Ui/TabMenu"],function(t){t.getTabMenu("profileContent").select("likes")})}.bind(this))},_loadContent:function(t,e){var i=$(e.newPanel),s=i.attr("id");this._hasContent[s]||(this._proxy.setOption("data",{actionName:"getContent",className:"wcf\\data\\user\\profile\\menu\\item\\UserProfileMenuItemAction",parameters:{data:{containerID:s,menuItem:i.data("menuItem"),userID:this._userID}}}),this._proxy.sendRequest())},_success:function(i,t,e){var s=i.returnValues.containerID;this._hasContent[s]=!0,require(["Dom/ChangeListener","Dom/Util"],function(t,e){e.insertHtml(i.returnValues.template,elById(s),"append"),t.trigger()})}}),WCF.User.Profile.Editor=Class.extend({_actionName:"",_active:!1,_buttons:{},_cachedTemplate:"",_proxy:null,_tab:null,_userID:0,init:function(t,e){this._actionName="",this._active=!1,this._cachedTemplate="",this._tab=$("#about"),this._userID=t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),e&&this._beginEdit()},_initButtons:function(){this._buttons={beginEdit:$(".jsButtonEditProfile:eq(0)").click(this._beginEdit.bind(this))}},_beginEdit:function(t){t&&t.preventDefault(),this._active||(this._active=!0,this._actionName="beginEdit",this._buttons.beginEdit.parent().addClass("active"),$("#profileContent").wcfTabs("select","about"),this._proxy.setOption("data",{actionName:"beginEdit",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID]}),this._proxy.sendRequest())},_save:function(){var r,l,i=null;elBySelAll(".redactor-layer",this._tab[0],function(t){var e={api:{throwError:elInnerError},valid:!0};WCF.System.Event.fireEvent("com.woltlab.wcf.redactor2","validate_"+elData(t,"element-id"),e),e.valid||null!==i||(i=t.parentNode)}),i?i.scrollIntoView({behavior:"smooth"}):(this._actionName="save",r=/values\[([a-zA-Z0-9._-]+)\]/,l={},this._tab.find("input, textarea, select").each(function(t,e){var i=$(e),s=null;switch(i.getTagName()){case"input":var a=i.attr("type");if(("radio"===a||"checkbox"===a)&&!i.prop("checked"))return;break;case"textarea":i.data("redactor")&&(s=i.redactor("code.get"))}var n,o=i.attr("name");r.test(o)&&(n=RegExp.$1,null===s&&(s=i.val()),"checkbox"===i.attr("type")&&/\[\]$/.test(o)?(Array.isArray(l[n])||(l[n]=[]),l[n].push(s)):l[n]=s)}),this._proxy.setOption("data",{actionName:"save",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[this._userID],parameters:{values:l}}),this._proxy.sendRequest())},_restore:function(){this._actionName="restore",this._active=!1,this._buttons.beginEdit.parent().removeClass("active"),this._destroyEditor(),this._tab.html(this._cachedTemplate).children().css({height:"auto"})},_success:function(t,e,i){switch(this._actionName){case"beginEdit":this._prepareEdit(t);break;case"save":t.returnValues.success?(this._cachedTemplate=t.returnValues.template,this._restore()):this._prepareEdit(t,!0)}},_prepareEdit:function(i,s){this._destroyEditor();var a=this;this._tab.html(function(t,e){return!0!==s&&(a._cachedTemplate=e),i.returnValues.template}),this._tab.find("input[type=text]").attr("autocomplete","off"),this._tab.find(".formSubmit > button[data-type=save]").click($.proxy(this._save,this)),this._tab.find(".formSubmit > button[data-type=restore]").click($.proxy(this._restore,this)),this._tab.find("input").keyup(function(t){if(t.which===$.ui.keyCode.ENTER)return a._save(),t.preventDefault(),!1})},_destroyEditor:function(){this._tab.find("textarea").each(function(t,e){var i=$(e);i.data("redactor")&&i.redactor("core.destroy")})}}),WCF.User.Registration={},WCF.User.Registration.Validation=Class.extend({_actionName:"",_className:"",_confirmElement:null,_element:null,_errorMessages:{},_options:{},_proxy:null,init:function(t,e,i){this._element=t,this._element.blur($.proxy(this._blur,this)),this._confirmElement=e||null,null!==this._confirmElement&&this._confirmElement.blur($.proxy(this._blurConfirm,this)),i=i||{},this._setOptions(i),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this),showLoadingOverlay:!1}),this._setErrorMessages()},_setOptions:function(t){},_setErrorMessages:function(){this._errorMessages={ajaxError:"",notEqual:""}},_blur:function(t){var e=this._element.val();if(!e)return this._showError(this._element,WCF.Language.get("wcf.global.form.error.empty"));if(null!==this._confirmElement){var i=this._confirmElement.val();if(""!=i&&e!=i)return this._showError(this._confirmElement,this._errorMessages.notEqual)}this._validateOptions()&&(this._proxy.setOption("data",{actionName:this._actionName,className:this._className,parameters:this._getParameters()}),this._proxy.sendRequest())},_getParameters:function(){return{}},_validateOptions:function(){return!0},_blurConfirm:function(t){if(!this._confirmElement.val())return this._showError(this._confirmElement,WCF.Language.get("wcf.global.form.error.empty"));this._blur(t)},_success:function(t,e,i){t.returnValues.isValid?(this._showSuccess(this._element),null!==this._confirmElement&&this._confirmElement.val()&&this._showSuccess(this._confirmElement)):this._showError(this._element,WCF.Language.get(this._errorMessages.ajaxError+t.returnValues.error))},_showError:function(t,e){t.parent().parent().addClass("formError").removeClass("formSuccess");var i=t.parent().find("small.innerError");i.length||(i=$("<small />").addClass("innerError").insertAfter(t)),i.text(e)},_showSuccess:function(t){t.parent().parent().addClass("formSuccess").removeClass("formError"),t.next("small.innerError").remove()}}),WCF.User.Registration.Validation.Username=WCF.User.Registration.Validation.extend({_actionName:"validateUsername",_className:"wcf\\data\\user\\UserRegistrationAction",_setOptions:function(t){this._options=$.extend(!0,{minlength:3,maxlength:25},t)},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.username.error."}},_validateOptions:function(){var t=this._element.val();return!(t.length<this._options.minlength||t.length>this._options.maxlength)||(this._showError(this._element,WCF.Language.get("wcf.user.username.error.invalid")),!1)},_getParameters:function(){return{username:this._element.val()}}}),WCF.User.Registration.Validation.EmailAddress=WCF.User.Registration.Validation.extend({_actionName:"validateEmailAddress",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{email:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.email.error.",notEqual:WCF.Language.get("wcf.user.confirmEmail.error.notEqual")}}}),WCF.User.Registration.Validation.Password=WCF.User.Registration.Validation.extend({_actionName:"validatePassword",_className:"wcf\\data\\user\\UserRegistrationAction",_getParameters:function(){return{password:this._element.val()}},_setErrorMessages:function(){this._errorMessages={ajaxError:"wcf.user.password.error.",notEqual:WCF.Language.get("wcf.user.confirmPassword.error.notEqual")}}}),WCF.User.Registration.LostPassword=Class.extend({_email:null,_username:null,init:function(){this._email=$("#emailInput"),this._username=$("#usernameInput"),this._email.keyup($.proxy(this._checkEmail,this)),this._username.keyup($.proxy(this._checkUsername,this)),$.browser.mozilla&&$.browser.touch&&(this._email.on("input",$.proxy(this._checkEmail,this)),this._username.on("input",$.proxy(this._checkUsername,this))),this._checkEmail(),this._checkUsername()},_checkEmail:function(){""==this._email.val()?(this._username.enable(),this._username.parents("dl:eq(0)").removeClass("disabled")):(this._username.disable(),this._username.parents("dl:eq(0)").addClass("disabled"),this._username.val(""))},_checkUsername:function(){""==this._username.val()?(this._email.enable(),this._email.parents("dl:eq(0)").removeClass("disabled")):(this._email.disable(),this._email.parents("dl:eq(0)").addClass("disabled"),this._email.val(""))}}),WCF.Notification={},WCF.Notification.List=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".contentHeaderNavigation .jsMarkAllAsConfirmed").click(function(){WCF.System.Confirmation.show(WCF.Language.get("wcf.user.notification.markAllAsConfirmed.confirmMessage"),function(t){"confirm"===t&&new WCF.Action.Proxy({autoSend:!0,data:{actionName:"markAllAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction"},success:function(){window.location.reload()}})})}),this._convertList()},_convertList:function(){$(".userNotificationItemList > .notificationItem").each(function(t,e){var i=$(e);i.data("isRead")||(i.find("a:not(.userLink)").prop("href",i.data("link")),$('<a href="#" class="icon icon24 fa-check notificationItemMarkAsConfirmed jsTooltip" title="'+WCF.Language.get("wcf.user.notification.markAsConfirmed")+'" />').appendTo(i).click($.proxy(this._markAsConfirmed,this)));var s=e.querySelector(".details > p:first-child");s.classList.add("pointer"),s.addEventListener("click",function(t){window.location.href=i.data("link")})}.bind(this)),WCF.DOMNodeInsertedHandler.execute()},_markAsConfirmed:function(t){t.preventDefault();var e=$(t.currentTarget).parents(".notificationItem:eq(0)").data("objectID");return this._proxy.setOption("data",{actionName:"markAsConfirmed",className:"wcf\\data\\user\\notification\\UserNotificationAction",objectIDs:[e]}),this._proxy.sendRequest(),!1},_success:function(t,e,i){var s=$(".userNotificationItemList > .notificationItem[data-object-id="+t.returnValues.markAsRead+"]");s.data("isRead",!0),s.find(".newContentBadge").remove(),s.find(".notificationItemMarkAsConfirmed").remove(),s.removeClass("notificationUnconfirmed")}}),WCF.User.SignaturePreview=WCF.Message.Preview.extend({_handleResponse:function(t){var e=$("#previewContainer");e.length||(e=$('<section class="section" id="previewContainer"><h2 class="sectionTitle">'+WCF.Language.get("wcf.global.preview")+'</h2><div class="htmlContent messageSignatureConstraints"></div></section>').insertBefore($("#signatureContainer")).wcfFadeIn()),e.children("div").first().html(t.returnValues.message)}}),WCF.User.RecentActivityLoader=Class.extend({_container:null,_filteredByFollowedUsers:!1,_loadButton:null,_proxy:null,_userID:0,init:function(t,e){this._container=$("#recentActivities"),this._filteredByFollowedUsers=!0===e,this._userID=t,null===this._userID||this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._container.children("li").length?(this._loadButton=$('<li class="showMore"><button class="small">'+WCF.Language.get("wcf.user.recentActivity.more")+"</button></li>").appendTo(this._container),this._loadButton=this._loadButton.children("button").click($.proxy(this._click,this))):$('<li class="showMore"><small>'+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small></li>").appendTo(this._container),WCF.User.userID&&$(".jsRecentActivitySwitchContext .button").click($.proxy(this._switchContext,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_click:function(){this._loadButton.enable();var t={lastEventID:this._container.data("lastEventID"),lastEventTime:this._container.data("lastEventTime")};this._userID?t.userID=this._userID:this._filteredByFollowedUsers&&(t.filteredByFollowedUsers=1),this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction",parameters:t}),this._proxy.sendRequest()},_switchContext:function(t){t.preventDefault(),$(t.currentTarget).hasClass("active")||new WCF.Action.Proxy({autoSend:!0,data:{actionName:"switchContext",className:"wcf\\data\\user\\activity\\event\\UserActivityEventAction"},success:function(){window.location.hash="#dashboardBoxRecentActivity",window.location.reload()}})},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastEventTime",t.returnValues.lastEventTime),this._container.data("lastEventID",t.returnValues.lastEventID),this._loadButton.enable()):($("<small>"+WCF.Language.get("wcf.user.recentActivity.noMoreEntries")+"</small>").appendTo(this._loadButton.parent()),this._loadButton.remove())}}),WCF.User.LikeLoader=Class.extend({_container:null,_likeType:"received",_likeValue:1,_loadButton:null,_noMoreEntries:null,_proxy:null,_userID:0,init:function(t){var e;this._container=$("#likeList"),this._userID=t,this._userID?(this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),e=$('<li class="likeListMore showMore"><button class="small">'+WCF.Language.get("wcf.like.likes.more")+"</button><small>"+WCF.Language.get("wcf.like.likes.noMoreEntries")+"</small></li>").appendTo(this._container),this._loadButton=e.children("button").click($.proxy(this._click,this)),this._noMoreEntries=e.children("small").hide(),2==this._container.find("> li").length&&(this._loadButton.hide(),this._noMoreEntries.show()),$("#likeType .button").click($.proxy(this._clickLikeType,this)),$("#likeValue .button").click($.proxy(this._clickLikeValue,this))):console.debug("[WCF.User.RecentActivityLoader] Invalid parameter 'userID' given.")},_clickLikeType:function(t){var e=$(t.currentTarget);this._likeType!=e.data("likeType")&&(this._likeType=e.data("likeType"),$("#likeType .button").removeClass("active"),e.addClass("active"),this._reload())},_clickLikeValue:function(t){var e=$(t.currentTarget);this._likeValue!=e.data("likeValue")&&(this._likeValue=e.data("likeValue"),$("#likeValue .button").removeClass("active"),e.addClass("active"),$("#likeType > li:first-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesReceived")),$("#likeType > li:last-child > .button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likesGiven")),this._container.find("> li.likeListMore button").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.more")),this._container.find("> li.likeListMore small").text(WCF.Language.get("wcf.like."+(-1==this._likeValue?"dis":"")+"likes.noMoreEntries")),this._reload())},_reload:function(){this._container.find("> li:not(:first-child):not(:last-child)").remove(),this._container.data("lastLikeTime",0),this._click()},_click:function(){this._loadButton.enable();var t={lastLikeTime:this._container.data("lastLikeTime"),userID:this._userID,likeType:this._likeType,likeValue:this._likeValue};this._proxy.setOption("data",{actionName:"load",className:"wcf\\data\\like\\LikeAction",parameters:t}),this._proxy.sendRequest()},_success:function(t,e,i){t.returnValues.template?($(t.returnValues.template).insertBefore(this._loadButton.parent()),this._container.data("lastLikeTime",t.returnValues.lastLikeTime),this._noMoreEntries.hide(),this._loadButton.show().enable()):(this._noMoreEntries.show(),this._loadButton.hide())}}),WCF.User.ProfilePreview=WCF.Popover.extend({_proxy:null,_userProfiles:{},init:function(){this._super(".userLink"),this._proxy=new WCF.Action.Proxy({showLoadingOverlay:!1}),WCF.System.ObjectStore.add("WCF.User.ProfilePreview",this)},_loadContent:function(){var a,n,o=$("#"+this._activeElementID).data("userID");this._userProfiles[o]?this._insertContent(this._activeElementID,this._userProfiles[o],!0):(this._proxy.setOption("data",{actionName:"getUserProfile",className:"wcf\\data\\user\\UserProfileAction",objectIDs:[o]}),a=this._activeElementID,(n=this)._proxy.setOption("success",function(t,e,i){n._userProfiles[o]=t.returnValues.template,n._insertContent(a,t.returnValues.template,!0)}),this._proxy.setOption("failure",function(t,e,i,s){return n._userProfiles[o]=t.message,n._insertContent(a,t.message,!0),!1}),this._proxy.sendRequest())},purge:function(t){delete this._userProfiles[t],this._data={}}}),WCF.User.Action={},WCF.User.Action.Follow=Class.extend({_containerList:null,_followButtonSelector:".jsFollowButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._followButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._followButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("following")?"unfollow":"follow",className:"wcf\\data\\user\\follow\\UserFollowAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._followButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.following?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unfollow")).children(".icon").removeClass("fa-plus").addClass("fa-minus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unfollow"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.follow")).children(".icon").removeClass("fa-minus").addClass("fa-plus"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.follow"))),i.data("following",s.returnValues.following),!1},this)),(new WCF.System.Notification).show()}}),WCF.User.Action.Ignore=Class.extend({_containerList:null,_ignoreButtonSelector:".jsIgnoreButton",_userID:0,init:function(t,e){t.length&&(this._containerList=t,e&&(this._ignoreButtonSelector=e),this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._containerList.each($.proxy(function(t,e){$(e).find(this._ignoreButtonSelector).click($.proxy(this._click,this))},this)))},_click:function(t){t.preventDefault();var e=$(t.target);e.is("a")||(e=e.closest("a")),this._userID=e.data("objectID"),this._proxy.setOption("data",{actionName:e.data("ignored")?"unignore":"ignore",className:"wcf\\data\\user\\ignore\\UserIgnoreAction",parameters:{data:{userID:this._userID}}}),this._proxy.sendRequest()},_success:function(s,t,e){this._containerList.each($.proxy(function(t,e){var i=$(e).find(this._ignoreButtonSelector).get(0);if(i&&$(i).data("objectID")==this._userID)return i=$(i),s.returnValues.isIgnoredUser?(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.unignore")).children(".icon").removeClass("fa-ban").addClass("fa-circle-o"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.unignore"))):(i.attr("data-tooltip",WCF.Language.get("wcf.user.button.ignore")).children(".icon").removeClass("fa-circle-o").addClass("fa-ban"),i.children(".invisible").text(WCF.Language.get("wcf.user.button.ignore"))),i.data("ignored",s.returnValues.isIgnoredUser),!1},this)),(new WCF.System.Notification).show();var i=this;WCF.System.ObjectStore.invoke("WCF.User.ProfilePreview",function(t){t.purge(i._userID)})}}),WCF.User.Avatar={},WCF.User.Avatar.Upload=WCF.Upload.extend({_userID:0,init:function(t){this._super($("#avatarUpload > dd > div"),void 0,"wcf\\data\\user\\avatar\\UserAvatarAction"),this._userID=t||0,$("#avatarForm input[type=radio]").change(function(){"custom"==$(this).val()?$("#avatarUpload > dd > div").show():$("#avatarUpload > dd > div").hide()}),$("#avatarForm input[type=radio][value=custom]:checked").length||$("#avatarUpload > dd > div").hide()},_initFile:function(t){return $("#avatarUpload > dt > img")},_success:function(t,e){e.returnValues.url?(this._updateImage(e.returnValues.url),$("#avatarUpload > dd > .innerError").remove(),new WCF.System.Notification(WCF.Language.get("wcf.user.avatar.upload.success")).show()):e.returnValues.errorType&&this._getInnerErrorElement().text(WCF.Language.get("wcf.user.avatar.upload.error."+e.returnValues.errorType))},_updateImage:function(t){$("#avatarUpload > dt > img").remove();var e=$('<img src="'+t+'" class="userAvatarImage" alt="" />').css({height:"auto","max-height":"96px","max-width":"96px",width:"auto"});$("#avatarUpload > dt").prepend(e),WCF.DOMNodeInsertedHandler.execute()},_getInnerErrorElement:function(){var t=$("#avatarUpload > dd > .innerError");return t.length||(t=$('<small class="innerError"></span>'),$("#avatarUpload > dd").append(t)),t},_getParameters:function(){return{userID:this._userID}}}),WCF.User.List=Class.extend({_additionalParameters:{},_cache:{},_className:"",_dialog:null,_dialogTitle:"",_pageCount:0,_pageNo:1,_proxy:null,init:function(t,e,i){this._additionalParameters=i||{},this._cache={},this._className=t,this._dialog=null,this._dialogTitle=e,this._pageCount=0,this._pageNo=1,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)})},open:function(){this._pageNo=1,this._showPage()},_showPage:function(t,e){var i;e&&e.activePage&&(this._pageNo=e.activePage),0!=this._pageCount&&(this._pageNo<1||this._pageNo>this._pageCount)?console.debug("[WCF.User.List] Cannot access page "+this._pageNo+" of "+this._pageCount):this._cache[this._pageNo]?(i=!1,null===this._dialog&&(this._dialog=$("#userList"+this._className.hashCode()),0===this._dialog.length&&(this._dialog=$('<div id="userList'+this._className.hashCode()+'" />').hide().appendTo(document.body),i=!0)),this._dialog.empty(),this._dialog.html(this._cache[this._pageNo]),1<this._pageCount?this._dialog.find(".jsPagination").wcfPages({activePage:this._pageNo,maxPage:this._pageCount}).on("wcfpagesswitched",$.proxy(this._showPage,this)):this._dialog.find(".jsPagination").hide(),i?this._dialog.wcfDialog({title:this._dialogTitle}):(this._dialog.wcfDialog("option","title",this._dialogTitle),this._dialog.wcfDialog("open").wcfDialog("render")),WCF.DOMNodeInsertedHandler.execute()):(this._additionalParameters.pageNo=this._pageNo,this._proxy.setOption("data",{actionName:"getGroupedUserList",className:this._className,interfaceName:"wcf\\data\\IGroupedUserListAction",parameters:this._additionalParameters}),this._proxy.sendRequest())},_success:function(t,e,i){t.returnValues.pageCount&&(this._pageCount=t.returnValues.pageCount),this._cache[this._pageNo]=t.returnValues.template,this._showPage()}}),WCF.User.ObjectWatch={},WCF.User.ObjectWatch.Subscribe=Class.extend({_buttonSelector:".jsSubscribeButton",_buttons:{},_dialog:null,_notification:null,_reloadOnUnsubscribe:!1,init:function(t){this._buttons={},this._notification=null,this._reloadOnUnsubscribe=!0===t,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(this._buttonSelector).each($.proxy(function(t,e){var i=$(e);i.addClass("pointer");var s=i.data("objectType"),a=i.data("objectID");void 0===this._buttons[s]&&(this._buttons[s]={}),this._buttons[s][a]=i.click($.proxy(this._click,this))},this)),WCF.System.Event.addListener("com.woltlab.wcf.objectWatch","update",$.proxy(this._updateSubscriptionStatus,this))},_click:function(t){t.preventDefault();var e=$(t.currentTarget);this._proxy.setOption("data",{actionName:"manageSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{objectID:e.data("objectID"),objectType:e.data("objectType")}}),this._proxy.sendRequest()},_success:function(t,e,i){var s,a;"manageSubscription"===t.actionName?(null===this._dialog?(this._dialog=$("<div>"+t.returnValues.template+"</div>").hide().appendTo(document.body),this._dialog.wcfDialog({title:WCF.Language.get("wcf.user.objectWatch.manageSubscription")})):(this._dialog.html(t.returnValues.template),this._dialog.wcfDialog("open")),this._dialog.find(".formSubmit > .jsButtonSave").data("objectID",t.returnValues.objectID).data("objectType",t.returnValues.objectType).click($.proxy(this._save,this)),s=this._dialog.find("input[name=enableNotification]").disable(),this._dialog.find("input[name=subscribe]").change(function(t){1==$(t.currentTarget).val()?s.enable():s.disable()}),(a=this._dialog.find("input[name=subscribe]:checked")).length&&1==a.val()&&s.enable()):"saveSubscription"===t.actionName&&this._dialog.is(":visible")&&(this._dialog.wcfDialog("close"),this._updateSubscriptionStatus({isSubscribed:t.returnValues.subscribe,objectID:t.returnValues.objectID}),null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.global.success.edit"))),this._notification.show())},_save:function(t){var e=this._buttons[$(t.currentTarget).data("objectType")][$(t.currentTarget).data("objectID")],i=this._dialog.find("input[name=subscribe]:checked").val(),s=this._dialog.find("input[name=enableNotification]").is(":checked")?1:0;this._proxy.setOption("data",{actionName:"saveSubscription",className:"wcf\\data\\user\\object\\watch\\UserObjectWatchAction",parameters:{enableNotification:s,objectID:e.data("objectID"),objectType:e.data("objectType"),subscribe:i}}),this._proxy.sendRequest()},_updateSubscriptionStatus:function(t){var e=$(this._buttonSelector+"[data-object-id="+t.objectID+"]"),i=e.children(".icon");if(t.isSubscribed)i.removeClass("fa-bookmark-o").addClass("fa-bookmark"),e.data("isSubscribed",!0);else if(e.data("removeOnUnsubscribe")?e.parent().remove():(i.removeClass("fa-bookmark").addClass("fa-bookmark-o"),e.data("isSubscribed",!1)),this._reloadOnUnsubscribe)return void window.location.reload();WCF.System.Event.fireEvent("com.woltlab.wcf.objectWatch","updatedSubscription",t)}}); })(this);
// WCF.Moderation.js
(function (window, undefined) { "use strict";WCF.Moderation={},WCF.Moderation.Management=Class.extend({_buttonSelector:"",_className:"",_confirmationTemplate:{},_dialog:null,_languageItem:"",_proxy:null,_queueID:0,_redirectURL:"",init:function(e,t,i){this._buttonSelector?this._className?(this._dialog=null,this._queueID=e,this._redirectURL=t,this._languageItem=i,this._proxy=new WCF.Action.Proxy({failure:$.proxy(this._failure,this),success:$.proxy(this._success,this)}),$(this._buttonSelector).click($.proxy(this._click,this)),$("#moderationAssignUser").click($.proxy(this._clickAssignedUser,this))):console.debug("[WCF.Moderation.Management] Missing class name, aborting."):console.debug("[WCF.Moderation.Management] Missing button selector, aborting.")},_click:function(e){var a=$(e.currentTarget).wcfIdentify(),t="";this._confirmationTemplate[a]&&(t=this._confirmationTemplate[a]),WCF.System.Confirmation.show(WCF.Language.get(this._languageItem.replace(/{actionName}/,a)),$.proxy(function(e,t,i){var o;"confirm"===e&&(o={actionName:a,className:this._className,objectIDs:[this._queueID]},this._confirmationTemplate[a]&&(o.parameters={},$(i).find("input, textarea").each(function(e,t){var i=$(t),a=i.val();"input"===i.getTagName()&&"checkbox"===i.attr("type")&&(i.is(":checked")||(a=null)),null!==a&&(o.parameters[i.attr("name")]=a)})),this._proxy.setOption("data",o),this._proxy.sendRequest(),$(this._buttonSelector).disable())},this),{},t)},_clickAssignedUser:function(){this._proxy.setOption("data",{actionName:"getAssignUserForm",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID]}),this._proxy.sendRequest()},_success:function(e,t,i){switch(e.actionName){case"getAssignUserForm":null===this._dialog?(this._dialog=$("<div />").hide().appendTo(document.body),this._dialog.html(e.returnValues.template).wcfDialog({title:WCF.Language.get("wcf.moderation.assignedUser")})):this._dialog.html(e.returnValues.template).wcfDialog("open"),this._dialog.find("button[data-type=submit]").click($.proxy(this._assignUser,this));break;case"assignUser":var a=$("#moderationAssignedUserContainer > dd > span").empty();e.returnValues.userID?$('<a href="'+e.returnValues.link+'" data-object-id="'+e.returnValues.userID+'" class="userLink">'+WCF.String.escapeHTML(e.returnValues.username)+"</a>").appendTo(a):a.append(e.returnValues.username),a.append(" "),e.returnValues.newStatus&&$("#moderationStatusContainer > dd").text(WCF.Language.get("wcf.moderation.status."+e.returnValues.newStatus)),this._dialog.wcfDialog("close"),(new WCF.System.Notification).show();break;default:var o=new WCF.System.Notification(WCF.Language.get("wcf.global.success")),n=this;o.show(function(){window.location=n._redirectURL})}},_failure:function(e,t,i,a){if(e.returnValues&&e.returnValues.fieldName&&"assignedUsername"==e.returnValues.fieldName){this._dialog.find("small.innerError").remove();var o="";switch(e.returnValues.errorType){case"empty":o=WCF.Language.get("wcf.global.form.error.empty");break;case"notAffected":o=WCF.Language.get("wcf.moderation.assignedUser.error.notAffected");break;default:o=WCF.Language.get("wcf.user.username.error."+e.returnValues.errorType,{username:this._dialog.find("#assignedUsername").val()})}return $('<small class="innerError">'+o+"</small>").insertAfter(this._dialog.find("#assignedUsername")),!1}return!0},_assignUser:function(){var e=this._dialog.find("input[name=assignedUserID]:checked").val(),t="";if(-1==e&&(t=$.trim(this._dialog.find("#assignedUsername").val())),-1==e&&0==t.length)return this._dialog.find("small.innerError").remove(),void $('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>").insertAfter(this._dialog.find("#assignedUsername"));this._proxy.setOption("data",{actionName:"assignUser",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[this._queueID],parameters:{assignedUserID:e,assignedUsername:t}}),this._proxy.sendRequest()}}),WCF.Moderation.Queue={},WCF.Moderation.Queue.MarkAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(document).on("dblclick",".moderationList .new .columnAvatar",$.proxy(this._dblclick,this))},_dblclick:function(e){this._proxy.setOption("data",{actionName:"markAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[$(e.currentTarget).parents(".moderationQueueEntry:eq(0)").data("queueID")]}),this._proxy.sendRequest()},_success:function(a,e,t){$(".moderationList .new").each(function(e,t){var i=$(t);WCF.inArray(i.data("queueID"),a.objectIDs)&&(i.removeClass("new"),i.find(".columnAvatar").off("dblclick"))})}}),WCF.Moderation.Queue.MarkAllAsRead=Class.extend({_proxy:null,init:function(){this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),$(".markAllAsReadButton").click($.proxy(this._click,this))},_click:function(e){e.preventDefault(),this._proxy.setOption("data",{actionName:"markAllAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"}),this._proxy.sendRequest()},_success:function(e,t,i){var a=WCF.Dropdown.Interactive.Handler.getDropdown("outstandingModeration");a&&(a.getLinkList().find(".interactiveDropdownItemMarkAllAsRead").remove(),a.getItemList().find(".interactiveDropdownItemMarkAsRead").remove()),$("#outstandingModeration .badgeUpdate").remove();var o=$(".moderationList");o.find(".new").removeClass("new"),o.find(".columnAvatar").off("dblclick")}}),WCF.Moderation.Activation={},WCF.Moderation.Activation.Management=WCF.Moderation.Management.extend({init:function(e,t){this._buttonSelector="#enableContent, #removeContent",this._className="wcf\\data\\moderation\\queue\\ModerationQueueActivationAction",this._super(e,t,"wcf.moderation.activation.{actionName}.confirmMessage")}}),WCF.Moderation.Report={},WCF.Moderation.Report.Content=Class.extend({_buttons:{},_buttonSelector:"",_dialog:null,_notification:null,_objectID:0,_objectType:"",_proxy:null,init:function(e,t){this._objectType=e,this._buttonSelector=t,this._buttons={},this._notification=null,this._objectID=0,this._proxy=new WCF.Action.Proxy({success:$.proxy(this._success,this)}),this._initButtons(),WCF.DOMNodeInsertedHandler.addCallback("WCF.Moderation.Report"+this._objectType.hashCode(),$.proxy(this._initButtons,this))},_initButtons:function(){var o=this;$(this._buttonSelector).each(function(e,t){var i=$(t),a=i.wcfIdentify();o._buttons[a]||(o._buttons[a]=i).click($.proxy(o._click,o))})},_click:function(e){e.preventDefault(),this._objectID=$(e.currentTarget).data("objectID"),this._proxy.setOption("data",{actionName:"prepareReport",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{objectID:this._objectID,objectType:this._objectType}}),this._proxy.sendRequest()},_success:function(e,t,i){e.returnValues.reported?(null===this._notification&&(this._notification=new WCF.System.Notification(WCF.Language.get("wcf.moderation.report.success"))),this._dialog.wcfDialog("close"),this._notification.show()):e.returnValues.template&&(this._showDialog(e.returnValues.template),e.returnValues.alreadyReported||this._dialog.find(".jsSubmitReport").click($.proxy(this._submit,this)))},_showDialog:function(e){null===this._dialog&&(this._dialog=$("#moderationReport"),this._dialog.length||(this._dialog=$('<div id="moderationReport" />').hide().appendTo(document.body))),this._dialog.html(e).wcfDialog({title:WCF.Language.get("wcf.moderation.report.reportContent")}).wcfDialog("render")},_submit:function(){var e=this._dialog.find(".jsReportMessage").val();if(""==$.trim(e))return this._dialog.find(".section > dl").addClass("formError"),void(this._dialog.find(".innerError").length||this._dialog.find(".jsReportMessage").after($('<small class="innerError">'+WCF.Language.get("wcf.global.form.error.empty")+"</small>")));this._proxy.setOption("data",{actionName:"report",className:"wcf\\data\\moderation\\queue\\ModerationQueueReportAction",parameters:{message:e,objectID:this._objectID,objectType:this._objectType}}),this._proxy.sendRequest()}}),WCF.Moderation.Report.Management=WCF.Moderation.Management.extend({init:function(e,t){this._buttonSelector="#removeContent, #removeReport",this._className="wcf\\data\\moderation\\queue\\ModerationQueueReportAction",this._super(e,t,"wcf.moderation.report.{actionName}.confirmMessage"),this._confirmationTemplate.removeContent=$('<div class="section"><dl><dt><label for="message">'+WCF.Language.get("wcf.moderation.report.removeContent.reason")+'</label></dt><dd><textarea name="message" id="message" cols="40" rows="3" /></dd></dl></div>'),this._confirmationTemplate.removeReport=$('<div class="section"><dl><dt></dt><dd><label><input type="checkbox" name="markAsJustified" id="markAsJustified" value="1"> '+WCF.Language.get("wcf.moderation.report.removeReport.markAsJustified")+"</label></dd></dl></div>")}}),WCF.User.Panel.Moderation=WCF.User.Panel.Abstract.extend({init:function(e){e.enableMarkAsRead=!0,this._super($("#outstandingModeration"),"outstandingModeration",e),require(["EventHandler"],function(e){e.add("com.woltlab.wcf.UserMenuMobile","more",function(e){"com.woltlab.wcf.moderation"===e.identifier&&this.toggle()}.bind(this))}.bind(this))},_initDropdown:function(){var e=this._super();return $('<li><a href="'+this._options.deletedContentLink+'" title="'+this._options.deletedContent+'" class="jsTooltip"><span class="icon icon24 fa-trash-o" /></a></li>').appendTo(e.getLinkList()),e},_load:function(){this._proxy.setOption("data",{actionName:"getOutstandingQueues",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"}),this._proxy.sendRequest()},_markAsRead:function(e,t){this._proxy.setOption("data",{actionName:"markAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction",objectIDs:[t]}),this._proxy.sendRequest()},_markAllAsRead:function(e){this._proxy.setOption("data",{actionName:"markAllAsRead",className:"wcf\\data\\moderation\\queue\\ModerationQueueAction"}),this._proxy.sendRequest()},resetItems:function(){this._super(),this._loadData=!0}}); })(this);