PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/polo-family.com/wp-content/themes/emallshop/inc/admin/assets/js/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/polo-family.com/wp-content/themes/emallshop/inc/admin/assets/js/custom_sidebar.js

(function ($, window) {

	function MAD_SIDEBAR () {
		var base = this;
			base.widgetArea = $('#widgets-right');
			base.widgetTemplate  = $('#tmpl-add-widget');
			base.widgetLiquid = $('.widget-liquid-right');

			base.createForm();
			base.createRemoveButton();
			base.eventListeners();
	}

	MAD_SIDEBAR.prototype = {
		createForm: function ()  {
            this.widgetLiquid.append(this.widgetTemplate.html());
            this.nonce = this.widgetLiquid.find('input[name="custom-sidebar-nonce"]').val();
        },
		createRemoveButton: function () {
            this.widgetArea.find('.sidebar-emallshop-custom').append('<span class="custom-sidebar-delete dashicons-trash"></span>');
        },
        eventListeners: function () {
            this.widgetLiquid.on('click', '.custom-sidebar-delete', $.proxy(this, 'deleteSidebar'));
        },
        deleteSidebar: function (e) {
        	var deleteWidget = confirm("Do you really want to delete this Widget Area?");
			if (deleteWidget) {
				var base = this,
					widget = $(e.currentTarget).parents('.widgets-holder-wrap:eq(0)'),
					title = widget.find('.sidebar-name h2'),
					widgetName = $.trim(title.text());
				$.ajax({
					type: "POST",
					url: window.ajaxurl,
					data: {
						action: 'delete_custom_sidebar',
						name: widgetName,
						_wpnonce: base.nonce
					},
					success: function (response) {
						if (response == 'widget-deleted')  {
							widget.slideUp(250, function(){
								widget.remove();
								wpWidgets.saveOrder();
							});
						}
					}
				});
			}
        }
    
    }
	
	$(function () {
		new MAD_SIDEBAR();
 	});

})(jQuery, window);