ips.templates.set('follow.frequency',"	{{#hasNotifications}}		<i class='fa-regular fa-bell'></i>	{{/hasNotifications}}	{{^hasNotifications}}		<i class='fa-regular fa-bell-slash'></i>	{{/hasNotifications}}	{{text}}");;
;(function($){"use strict";ips.controller.register('core.front.system.manageFollowed',{initialize:function(){$(document).on('followingItem',this.followingItemChange.bind(this));this.setup();},setup:function(){this._followID=this.scope.attr('data-followID');},followingItemChange:function(e,data){if(data.feedID!=this._followID){return;}
if(data.unfollow!==undefined){this.scope.find('[data-role="followDate"], [data-role="followFrequency"]').html('');this.scope.find('[data-role="followAnonymous"]').prop('hidden',true);this.scope.find('[data-role="followButton"]').addClass('ipsButton--disabled');this.scope.addClass('i-opacity_4');return;}
if(data.anonymous){this.scope.find('[data-role="followAnonymous"]').prop('hidden',false);}else{this.scope.find('[data-role="followAnonymous"]').prop('hidden',true);}
if(data.notificationType){this.scope.find('[data-role="followFrequency"]').html(ips.templates.render('follow.frequency',{hasNotifications:(data.notificationType!=='none'),text:ips.getString('followFrequency_'+data.notificationType)}));}}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.front.system.metaTagEditor',{_changed:false,initialize:function(){this.on('click','[data-action="addMeta"]',this.addMetaBlock);this.on('click','[data-action="deleteMeta"]',this.removeMetaBlock);this.on('click','[data-action="deleteDefaultMeta"]',this.removeDefaultMeta);this.on('click','[data-action="restoreMeta"]',this.restoreDefaultMeta);this.on('change','input, select',this.changed);this.on('submit','form',this.formSubmit);this.on(window,'beforeunload',this.beforeUnload);this.on('change','[data-role="metaTagChooser"]',this.toggleNameField);this.setup();},setup:function(){this.scope.css({zIndex:"10000"});},toggleNameField:function(e){if($(e.currentTarget).val()=='other'){$(e.currentTarget).closest('ul').find('[data-role="metaTagName"]').show();}
else
{$(e.currentTarget).closest('ul').find('[data-role="metaTagName"]').hide();}},restoreDefaultMeta:function(e){var tag=$(e.currentTarget).attr('data-tag');var copy=this.scope.find('[data-role="metaTemplate"]').clone().attr('data-role','metaTagRow').hide();if(tag=='robots'||tag=='keywords'||tag=='description'){copy.find('select[name="meta_tag_name[]"]').val(tag);}
else
{copy.find('select[name="meta_tag_name[]"]').val('other');copy.find('[name="meta_tag_name_other[]"]').val(tag).parent().removeClass('ipsHide');}
if(this.scope.find('input[name="defaultMetaTag['+tag+']"]')){copy.find('[name="meta_tag_content[]"]').val(this.scope.find('input[name="defaultMetaTag['+tag+']"]').val());}
copy.find('[data-action="deleteMeta"]').attr('data-action','deleteDefaultMeta');$('#elMetaTagEditor_defaultTags').append(copy);ips.utils.anim.go('fadeIn',copy);$(document).trigger('contentChange',[this.scope]);this._doMetaRemoval(e);},removeDefaultMeta:function(e){if($(e.currentTarget).siblings('select').first().val()=='other'){var name=$(e.currentTarget).closest('ul').find('input[name="meta_tag_name_other[]"]').val();}
else
{var name=$(e.currentTarget).siblings('select').first().val();}
$(e.currentTarget).closest('form').find('input').first().after("<input type='hidden' name='deleteDefaultMeta[]' value='"+name+"'>");this.removeMetaBlock(e,false);var string=ips.getString('meta_tag_deleted',{tag:name});var copy=this.scope.find('[data-role="metaDefaultDeletedTemplate"]').clone().attr('data-role','metaTagRow').hide();copy.find('[data-role="metaDeleteMessage"]').html(string);copy.find('[data-action="restoreMeta"]').attr('data-tag',name);$('#elMetaTagEditor_defaultTags').find('.i-background_3').after(copy);ips.utils.anim.go('fadeIn',copy);$(document).trigger('contentChange',[this.scope]);this.changed();this._showHideNoTagsMessage();},removeMetaBlock:function(e,restoreDefault){if(restoreDefault===undefined){restoreDefault=true;}
if($(e.currentTarget).siblings('select').first().val()=='other'){var tag=$(e.currentTarget).closest('ul').find('input[name="meta_tag_name_other[]"]').val();}
else
{var tag=$(e.currentTarget).siblings('select').first().val();}
if(this.scope.find('input[name="defaultMetaTag['+tag+']"]').length&&restoreDefault){$(e.currentTarget).attr('data-tag',tag);this.restoreDefaultMeta(e);}
else
{this._doMetaRemoval(e);}},_doMetaRemoval:function(e){e.preventDefault();var elem=$(e.currentTarget).closest('[data-role="metaTagRow"]');elem.remove();ips.utils.anim.go('fadeOut',elem);this.changed();this._showHideNoTagsMessage();},_showHideNoTagsMessage:function(){if($('#elMetaTagEditor_customTags').find('li[data-role="metaTagRow"]').length){$('#elMetaTagEditor_customTags').find('li[data-role="noCustomMetaTagsMessage"]').hide();}
else
{$('#elMetaTagEditor_customTags').find('li[data-role="noCustomMetaTagsMessage"]').show();}},formSubmit:function(e){var form=$(e.currentTarget);if(form.attr('data-noAjax')){return;}
e.preventDefault();var self=this;form.find('.ipsButton').prop('disabled',true).addClass('ipsButton--disabled');ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(){ips.ui.flashMsg.show(ips.getString('metaTagsSaved'));form.find('.ipsButton').prop('disabled',false).removeClass('ipsButton--disabled');self._changed=false;if(form.find('[name="meta_tag_title"]').val()){document.title=form.find('[name="meta_tag_title"]').val();}
else
{document.title=self.scope.attr('data-defaultPageTitle');}}).fail(function(){form.attr('data-noAjax','true');form.trigger('submit');});},beforeUnload:function(){if(this._changed){return ips.getString('metaTagsUnsaved');}},addMetaBlock:function(e){var copy=this.scope.find('[data-role="metaTemplate"]').clone().attr('data-role','metaTagRow').hide();$('#elMetaTagEditor_customTags').append(copy);ips.utils.anim.go('fadeIn',copy);$(document).trigger('contentChange',[copy]);this.changed();this._showHideNoTagsMessage();},changed:function(e){this._changed=true;}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.front.system.notificationSettings',{initialize:function(){this.on('click','[data-action="showNotificationSettings"]',this.showNotificationSettings);this.on('click','[data-action="closeNotificationSettings"]',this.closeNotificationSettings);this.on('change','[data-role="notificationSettingsWindow"]',this.saveNotificationSettings);},showNotificationSettings:function(e){e.preventDefault();var target=$(e.currentTarget);var expandedContainer=target.parent().find('[data-role="notificationSettingsWindow"]');this.scope.find('.cNotificationTypes__row--selected').removeClass('cNotificationTypes__row--selected');this.scope.find('[data-action="showNotificationSettings"]').show();this.scope.find('[data-role="notificationSettingsWindow"]').hide();target.parent().addClass('cNotificationTypes__row--selected');target.find('.cNotificationSettings_expand').addClass('ipsLoading ipsLoading--tiny').find('i').addClass('ipsHide');ips.getAjax()(target.attr('href')).done(function(response){expandedContainer.html(response).show();target.hide();target.find('.cNotificationSettings_expand').removeClass('ipsLoading').find('i').removeClass('ipsHide');}).fail(function(){window.location=target.attr('href');})},closeNotificationSettings:function(e){e.preventDefault();this.scope.find('.cNotificationTypes__row--selected').removeClass('cNotificationTypes__row--selected');this.scope.find('[data-action="showNotificationSettings"]').show();this.scope.find('[data-role="notificationSettingsWindow"]').hide();},saveNotificationSettings:function(e){e.preventDefault();var target=$(e.target);var form=target.closest('form');var container=form.closest('[data-role="notificationSettingsWindow"]');var containerParent=container.closest('.cNotificationTypes__row');var closeIcon=container.find('[data-action="closeNotificationSettings"]');closeIcon.addClass('ipsLoading ipsLoading--tiny').text('');ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response){closeIcon.removeClass('ipsLoading').html('&times;');containerParent.find('[data-action="showNotificationSettings"]').html(response);ips.ui.flashMsg.show(ips.getString('saved'));});}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.front.system.register',{usernameField:null,timers:{'username':null,'email':null},ajax:ips.getAjax(),popup:null,passwordBlurred:true,dirty:false,initialize:function(){this.on('keyup','#elInput_username',this.changeUsername);this.on('blur','#elInput_username',this.changeUsername);this.on('keyup','#elInput_password_confirm',this.confirmPassword);this.on('blur','#elInput_password_confirm',this.confirmPassword);this.on('click','a[data-ipsPbrCancel]',this.cancelPbr);this.setup();},setup:function(){this.usernameField=this.scope.find('#elInput_username');this.passwordField=this.scope.find('#elInput_password');this.confirmPasswordField=this.scope.find('#elInput_password_confirm');this.confirmPasswordError=this.scope.find('#elInput_password_confirm--error');},cancelPbr:function(e){var url=$(e.target).closest('[data-ipsPbrCancel]').attr('href');e.preventDefault();e.stopPropagation();ips.ui.alert.show({type:'confirm',message:ips.getString('pbr_confirm_title'),subText:ips.getString('pbr_confirm_text'),icon:'warn',buttons:{ok:ips.getString('pbr_confirm_ok'),cancel:ips.getString('pbr_confirm_cancel')},callbacks:{ok:function(){window.location=url;},cancel:function(){return false;}}});},changeUsername:function(e){if(this.timers['username']){clearTimeout(this.timers['username']);}
if(this.usernameField.val().length>4||e.type!="keyup"){this.timers['username']=setTimeout(this._doCheck.bind(this,this.usernameField),700);}else{this._clearResult(this.usernameField);}},confirmPassword:function(e){this._clearResult(this.confirmPasswordField);if(this.passwordField.val()&&this.passwordField.val()===this.confirmPasswordField.val()){this.confirmPasswordField.addClass('ipsField_success');this.confirmPasswordError.html('');}else if(e.type==="focusout"){this.confirmPasswordField.addClass('ipsField_error');this.confirmPasswordError.html(ips.getString('password_mismatch'));document.getElementById('ipsAriaLive').innerHTML=ips.getString('password_mismatch');}},_clearResult:function(field){field.removeClass('ipsField_error').removeClass('ipsField_success').next('.ipsFieldRow__warning').html('');field.closest('.ipsFieldRow').removeClass('ipsFieldRow_error');},_doCheck:function(field){var value=field.val();var resultElem=field.next('.ipsFieldRow__warning');if(this.ajax&&this.ajax.abort){this.ajax.abort();}
field.addClass('ipsField_loading');this.ajax(ips.getSetting('baseURL')+'?app=core&module=system&controller=ajax&do=usernameExists',{dataType:'json',data:{input:encodeURIComponent(value)}}).done(function(response){if(response.result=='ok'){resultElem.html('');field.removeClass('ipsField_error').addClass('ipsField_success').removeAttr('aria-invalid');field.closest(".ipsFieldRow_error").removeClass("ipsFieldRow_error");}else{resultElem.html(response.message);document.getElementById('ipsAriaLive').innerHTML=response.message;field.removeClass('ipsField_success').addClass('ipsField_error').attr('aria-invalid','true');field.closest(".ipsFieldRow").addClass("ipsFieldRow_error");}}).fail(function(){}).always(function(){field.removeClass('ipsField_loading');});}});}(jQuery));;