;(function($,_,undefined){"use strict";ips.controller.register('core.front.profile.body',{initialize:function(){this.on('click','[data-action="showRecentWarnings"]',this.showRecentWarnings);this.setup();},setup:function(){},showRecentWarnings:function(e){e.preventDefault();this.scope.find('[data-action="showRecentWarnings"]').hide();ips.utils.anim.go('fadeIn fast',this.scope.find('[data-role="recentWarnings"]'));}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.profile.followers',{_feedID:null,initialize:function(){this.on(document,'followingItem',this.followUser);this.on('menuItemSelected',"[data-role='followOption']",this.toggleFollowOption);this.setup();},setup:function(){this._feedID=this.scope.attr('data-feedID');},followUser:function(e,data){if(data.feedID!=this._feedID){return;}
var self=this;var memberID=data.feedID.replace('member-','');ips.getAjax()(ips.getSetting('baseURL')+'index.php?app=core&module=members&controller=profile&do=followers&id='+parseInt(memberID)).done(function(response){self.scope.html(response);}).fail(function(){Debug.log('Error fetching follower HTML');});},toggleFollowOption:function(e,data){data.originalEvent.preventDefault();var url=data.menuElem.find('[data-ipsMenuValue="'+data.selectedItemID+'"] a').attr('href');ips.getAjax()(url).done(function(response){ips.ui.flashMsg.show(ips.getString('followerSettingToggled'));}).fail(function(){window.location=url;});}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.profile.main',{contentArea:null,lastType:null,initialize:function(){this.on('click','[data-action="goToProfile"]',this.changeType);this.on('click','[data-action="browseContent"]',this.changeType);this.on('click','[data-action="repLog"]',this.changeType);this.on('click','[data-action="badgeLog"]',this.changeType);this.on('click','[data-action="solutionLog"]',this.changeType);this.on(window,'historychange',this.stateChange);this.setup();},_getHistoryStateFromPage(){const elem=this.scope.get(0)
const selectorMap={browseContent:'#elUserContent',repLog:'#elUserReputation',badgeLog:'.cProfileBadgeGrid'}
for(const state in selectorMap){if(elem.querySelector(selectorMap[state])){return state}}
return"goToProfile"},setup:function(){this.contentArea=this.scope.find('[data-role="profileContent"]');this.contentHeader=this.scope.find('[data-role="profileHeader"]');if(!ips.utils.history.getState('profile')?.section){ips.utils.history.replaceState({section:this._getHistoryStateFromPage()},'profile',window.location.href);}},stateChange:function(e){if(e.detail?.type==='load'||e.detail?.type==='replace'){return}
const url=window.location.href
const data=ips.utils.history.getState('profile')
if(this._getHistoryStateFromPage()===data.section&&data.section){return}
this.lastType=data.section;e?.stopPropagation?.()
e?.stopImmediatePropagation?.()
switch(data?.section){case'goToProfile':this._showProfile(url);break;case'browseContent':this._showContent(url);break;case'repLog':case'solutionLog':case'badgeLog':this._showGenericLog(url);break;}},changeType:function(e){e.preventDefault();let target=$(e.currentTarget);if(!target.is('a')){target=target.find('a');}
ips.utils.history.pushState({section:$(e.currentTarget).attr('data-action')},'profile',target.attr('href'));document.title=target.attr('title')},_showGenericLog:function(url){var self=this;this._changeContent(true,url);this._showProfileButton();if(ips.utils.responsive.enabled()&&ips.utils.responsive.currentIs('phone')){$('#elProfileStats').addClass('cProfileHeaderContent');}},_showContent:function(url){$('[data-action="goToProfile"]').attr("disabled",true);this._showProfileButton();this._changeContent(true,url);if(ips.utils.responsive.enabled()&&ips.utils.responsive.currentIs('phone')){$('#elProfileStats').addClass('cProfileHeaderContent');}},_showProfileButton:function(){var self=this;this.contentHeader.find('[data-action="browseContent"]').each(function(){var elem=$(this);if(elem.is(':visible')){elem.animationComplete(function(){ips.utils.anim.go('fadeIn fast',self.contentHeader.find('[data-action="goToProfile"][data-type="'+elem.attr('data-type')+'"]'));});ips.utils.anim.go('fadeOut fast',elem);}else{elem.hide();self.contentHeader.find('[data-action="goToProfile"][data-type="'+elem.attr('data-type')+'"]').show();}});},_showProfile:function(url){$('[data-action="browseContent"]').attr("disabled",true);this._showContentButton();this._changeContent(false,url);$('#elProfileStats').removeClass('cProfileHeaderContent');},_showContentButton:function(){var self=this;this.contentHeader.find('[data-action="goToProfile"]').each(function(){var elem=$(this);if(elem.is(':visible')){elem.animationComplete(function(){ips.utils.anim.go('fadeIn fast',self.contentHeader.find('[data-action="browseContent"][data-type="'+elem.attr('data-type')+'"]'));});ips.utils.anim.go('fadeOut fast',elem);}else{elem.hide();self.contentHeader.find('[data-action="browseContent"][data-type="'+elem.attr('data-type')+'"]').show();}});},_changeContent:function(small,url){var self=this;ips.controller.cleanContentsOf(this.contentArea);this.contentArea.css({height:String(this.contentArea.outerHeight())});this.contentArea.html($('<div/>').addClass('ipsLoading').css({height:'300px'}));this.contentHeader.find('#elProfileHeader').toggleClass('cProfileHeaderMinimal',small);url+=(url.includes('?')?'&':'?')+'entireSection=1';ips.getAjax()(url).done(function(response){self.contentArea.hide().html(response).css({height:'auto'});self.contentHeader.find("#elProfileStats a").each(function(){$(this).removeAttr("disabled");});ips.utils.anim.go('fadeIn fast',self.contentArea);$(document).trigger('contentChange',[self.contentArea]);}).fail(function(){window.location=url;});}});}(jQuery,_));;
;(function($,_,undefined){"use strict";ips.controller.register('core.front.profile.toggleBlock',{initialize:function(){this.on('click','[data-action="disable"]',this.toggleBlock);this.on('click','[data-action="enable"]',this.toggleBlock);},toggleBlock:function(e){e.preventDefault();var self=this;this.scope.css({opacity:"0.6"});ips.getAjax()($(e.currentTarget).attr('href'),{showLoading:true}).done(function(response){self.scope.html(response);$(document).trigger('contentChange',[self.scope]);}).fail(function(){window.location=$(e.currentTarget).attr('href');}).always(function(){self.scope.css({opacity:"1"});});}});}(jQuery,_));;