!function(a){"use strict";ace.config.set("basePath",window.aceEditorBase),ace.require("ace/ext/language_tools"),a(".yp-code-group li").click(function(e){if("LI"==a(e.target)[0].tagName||a(e.target).hasClass("yp-edited-page-title")){var t=a(this),o=t.next(".yp-inline-css");if(t.toggleClass("active"),o.toggleClass("active"),0==o.hasClass("ace_editor")){var s=ace.edit(o.attr("id"));s.setTheme("ace/theme/dawn"),s.getSession().setMode("ace/mode/css"),s.getSession().setUseWorker(!1),s.setOptions({enableBasicAutocompletion:!0,enableSnippets:!1,enableLiveAutocompletion:!0}),s.setOptions({fontSize:"14px"}),s.$blockScrolling=1/0,s.setShowPrintMargin(!1),s.setReadOnly(!0)}}}),a(".yp-button-reset").click(function(){a(this);confirm("Are you sure to want to reset defined labels and all plugin options? (This process does not delete any changes)")&&a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_options:!0}).complete(function(){window.location.href="?page=yellow-pencil-settings&yp_reset=true"})}),a(".yp-delete-page-edits").click(function(){var e,t=a(this).parent("li"),o=a(this).parent("li").attr("data-delete-value");if(-1==o.indexOf("|")){e="Are you sure you want to delete this animation?";var s=o}else{e="Are you sure you want to reset the changes?";s=o.split("|")[1]}confirm(e)&&(t.addClass("yp-data-deleted"),-1!=o.indexOf("GLOBAL|")?a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_global:s}).complete(function(){0==a(".yp-global-group li:not(.yp-data-deleted)").length&&a(".yp-global-group").fadeOut("slow"),t.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),t.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow")}):-1!=o.indexOf("TYPE|")?a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_type:s}).complete(function(){0==a(".yp-template-group li:not(.yp-data-deleted)").length&&a(".yp-template-group").fadeOut("slow"),t.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),t.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow")}):-1!=o.indexOf("ID|")?a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_id:s}).complete(function(){0==a(".yp-single-group li:not(.yp-data-deleted)").length&&a(".yp-single-group").fadeOut("slow"),t.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),t.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow")}):a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_delete_animate:s}).complete(function(){t.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),t.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow")}),0==a(".yp-code-group ul li:not(.yp-data-deleted)").length&&(a(".yp-tab-section").hide(),a(".yp-no-code,.yp-no-animation").fadeIn(300)))})}(jQuery);