Updating minified JavaScript files
authorwoltlab.com <woltlab@woltlab.com>
Fri, 12 Dec 2014 17:56:45 +0000 (18:56 +0100)
committerwoltlab.com <woltlab@woltlab.com>
Fri, 12 Dec 2014 17:56:45 +0000 (18:56 +0100)
wcfsetup/install/files/js/WCF.Combined.min.js

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