(function(a){"use strict";window.define=window.define||ace.define,ace.config.set("basePath",window.aceEditorBase),ace.require("ace/ext/language_tools"),a("#global-choose-all").click(function(){a(this).prop("checked")?a(".yp-global-group ul li .yp-checkbox input").prop("checked",!0):a(".yp-global-group ul li .yp-checkbox input").prop("checked",!1)}),a("#template-choose-all").click(function(){a(this).prop("checked")?a(".yp-template-group ul li .yp-checkbox input").prop("checked",!0):a(".yp-template-group ul li .yp-checkbox input").prop("checked",!1)}),a("#single-choose-all").click(function(){a(this).prop("checked")?a(".yp-single-group ul li .yp-checkbox input").prop("checked",!0):a(".yp-single-group ul li .yp-checkbox input").prop("checked",!1)}),a("#animation-choose-all").click(function(){a(this).prop("checked")?a(".yp-animations-code-group > ul li .yp-checkbox input").prop("checked",!0):a(".yp-animations-code-group > ul li .yp-checkbox input").prop("checked",!1)}),a(".yp-code-group li").click(function(b){if("LI"==a(b.target)[0].tagName||a(b.target).hasClass("yp-edited-page-title")){var c=a(this);if(c.hasClass("yp-data-deleted"))return!1;var d=c.next(".yp-inline-css");if(c.toggleClass("active"),d.toggleClass("active"),d.next("li").toggleClass("yp-border-top"),!1==d.hasClass("ace_editor")){var e=ace.edit(d.attr("id"));e.setTheme("ace/theme/dawn"),e.getSession().setMode("ace/mode/css"),e.getSession().setUseWorker(!1),e.setOptions({enableBasicAutocompletion:!0,enableSnippets:!1,enableLiveAutocompletion:!0}),e.setOptions({fontSize:"14px"}),e.$blockScrolling=1/0,e.setShowPrintMargin(!1),e.setReadOnly(!0)}}}),a(".yp-button-reset").click(function(){a(this);confirm("Are you sure to want to reset defined CSS comments and all plugin options? (This action does not delete any customizations)")&&a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_options:!0,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){a("#yp-reset-form").submit()})}),a(".yp-delete-page-edits").click(function(){var b,c,d=a(this).parent("li"),e=a(this).parent("li").attr("data-delete-value");if(-1==e.indexOf("|")){b="Are you sure you want to delete this animation?";var c=e}else{b="Are you sure you want to delete the customization?";var c=e.split("|")[1]}("lostpassword"==c||"register"==c||"login"==c||"home"==c)&&(e="TYPE|"+c),confirm(b)&&(d.addClass("yp-data-deleted"),-1==e.indexOf("GLOBAL|")?-1==e.indexOf("TYPE|")?-1==e.indexOf("ID|")?a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_delete_animate:c,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_id:c,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==a(".yp-single-group li:not(.yp-data-deleted)").length&&a(".yp-single-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_type:c,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==a(".yp-template-group li:not(.yp-data-deleted)").length&&a(".yp-template-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}):a.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_global:c,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==a(".yp-global-group li:not(.yp-data-deleted)").length&&a(".yp-global-group").fadeOut("slow"),d.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),d.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),setTimeout(function(){d.next().remove(),d.remove()},600)}),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)))}),a(".yp-disable-license").click(function(){var b=a(this),c=b.attr("data-href"),d=b.attr("data-site"),e=b.attr("data-code");b.addClass("yp-deactivating"),b.text("Processing..."),a.get("https://waspthemes.com/yellow-pencil/auto-update/",{action:"deactivate",site:d,purchase_code:e}).fail(function(){alert("Something went wrong. Please try again.")}).success(function(){window.location.href=c})})})(jQuery);
