!function(e){"use strict";function r(r){var a=e.extend({error:function(e,r,a){gdlr_core_alert_box({status:"failed",head:gdlr_core_sidebar_generator.error_head,message:gdlr_core_sidebar_generator.error_message}),console.log(e,r,a)},success:function(e){"success"==e.status?location.reload():"failed"==e.status&&gdlr_core_alert_box({status:e.status,head:e.head,message:e.message})}},r);e.ajax({type:"POST",url:gdlr_core_sidebar_generator.ajaxurl,data:a.data,dataType:"json",error:a.error,success:a.success})}e(document).ready(function(){var a=e("#widgets-right"),t=e('<form class="gdlr-core-sidebar-generator-wrapper">				<div class="gdlr-core-sidebar-generator-title">'+gdlr_core_sidebar_generator.title_text+'</div>				<input type="text" name="sidebar_name" />				<input type="hidden" name="security" value="'+gdlr_core_sidebar_generator.nonce+'" />				<input type="hidden" name="action" value="gdlr_core_add_sidebar" />				<input type="submit" value="'+gdlr_core_sidebar_generator.add_new_text+'" />			</form>').insertAfter(a);t.submit(function(){return r({data:e(this).serialize()}),!1}),a.find(".sidebar-gdlr-core-dynamic-widget").each(function(){var a=e(this),t=e(this).children().attr("id"),s=e('<div class="gdlr-core-delete-sidebar"></div>');s.click(function(){return gdlr_core_confirm_box({success:function(){r({data:{action:"gdlr_core_remove_sidebar",security:gdlr_core_sidebar_generator.nonce,sidebar_id:t},success:function(r){"success"==r.status?a.slideUp(250,function(){e(this).remove()}):"failed"==r.status&&gdlr_core_alert_box({status:r.status,head:r.head,message:r.message})}})}}),!1}),e(this).find(".sidebar-name").append(s)})})}(jQuery);