;(function($){"use strict";ips.controller.register('core.front.ignore.new',{initialize:function(){this.on('submit','#elIgnoreForm',this.addIgnoredUser);this.on('tokenAdded',this.showExtraControls);this.setup();},setup:function(){if(parseInt(this.scope.attr('data-id'))===0){$('#elIgnoreTypes, #elIgnoreSubmitRow').hide();}},addIgnoredUser:function(e){var form=this.scope.find('#elIgnoreForm');if(form.attr('data-bypassValidation')){return;}
e.preventDefault();var self=this;var scope=this.scope;ips.getAjax()(form.attr('action'),{data:form.serialize(),type:'post'}).done(function(response,textStatus,jqXHR){if(jqXHR.responseJSON){ips.utils.anim.go('fadeOut',$('#elIgnoreTypes, #elIgnoreSubmitRow')).then(function(){var field=scope.find('[name="member"]');ips.ui.autocomplete.getObj(field).removeAll();form.find("[type='checkbox']").prop('checked',true).trigger('change');});ips.ui.flashMsg.show(ips.getString('addedIgnore',{user:response.name}));self.triggerOn('core.global.core.table','refreshResults');}else{form.attr('data-bypassValidation',true).trigger('submit');}}).fail(function(jqXHR,textStatus,errorThrown){form.attr('data-bypassValidation',true).trigger('submit');});},showExtraControls:function(e,data){var field=this.scope.find('[name="member"]');var wrapper=$('#'+field.attr('id')+'_wrapper');wrapper.addClass('ipsField_loading');var form=this.scope.find('#elIgnoreForm');ips.getAjax()(form.attr('action'),{type:'post',data:{do:'add',name:this.scope.find('[name="member"]').val()}}).done(function(response){var i;for(i in response){form.find("[name='ignore_"+i+"_checkbox']").prop('checked',response[i]==1).trigger('change');}
ips.utils.anim.go('fadeIn',$('#elIgnoreTypes, #elIgnoreSubmitRow'));}).fail(function(jqXHR,textStatus,errorThrown){ips.ui.alert.show({message:jqXHR.responseJSON['error']});field.data('_autocomplete').removeAll();}).always(function(){wrapper.removeClass('ipsField_loading');});}});}(jQuery));;
;(function($){"use strict";ips.controller.register('core.front.ignore.existing',{initialize:function(){this.on('menuItemSelected','[data-action="ignoreMenu"]',this.ignoreMenu);this.on('submitDialog',this.editedUser);},editedUser:function(e,data){this.trigger('refreshResults');ips.ui.flashMsg.show(ips.getString('editedIgnore'));},ignoreMenu:function(e,data=e.detail){data.originalEvent.preventDefault();switch(data.selectedItemID){case'remove':this._removeIgnore(e,data);break;}},_removeIgnore:function(e,data){var url=$(data.menuElem).find('[data-ipsMenuValue="remove"]').attr('href');var self=this;Debug.log('here');ips.ui.alert.show({type:'confirm',icon:'question',message:ips.getString('confirm_unignore'),subText:ips.getString('confirm_unignore_desc'),callbacks:{ok:function(){ips.getAjax()(url+'&wasConfirmed=1').done(function(response){self.trigger('refreshResults');});}}});}});}(jQuery));;