1 line
3.1 KiB
JavaScript
1 line
3.1 KiB
JavaScript
!function(n){"use strict";window.define=window.define||ace.define,ace.config.set("basePath",window.aceEditorBase),ace.require("ace/ext/language_tools"),n(".yp-code-group li").click(function(e){if("LI"==n(e.target)[0].tagName||n(e.target).hasClass("yp-edited-page-title")){var t=n(this);if(t.hasClass("yp-data-deleted"))return!1;var 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)}}}),n(".yp-button-reset").click(function(){n(this);confirm("Are you sure to want to reset defined CSS comments and all plugin options? (This process does not delete any changes)")&&n.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_options:!0,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){n("#yp-reset-form").submit()})}),n(".yp-delete-page-edits").click(function(){var e,t=n(this).parent("li"),o=n(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]}"lostpassword"!=s&&"register"!=s&&"login"!=s&&"home"!=s||(o="TYPE|"+s),confirm(e)&&(t.addClass("yp-data-deleted"),-1!=o.indexOf("GLOBAL|")?n.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_global:s,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==n(".yp-global-group li:not(.yp-data-deleted)").length&&n(".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|")?n.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_type:s,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==n(".yp-template-group li:not(.yp-data-deleted)").length&&n(".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|")?n.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_reset_id:s,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){0==n(".yp-single-group li:not(.yp-data-deleted)").length&&n(".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")}):n.post(ajaxurl,{action:"yp_delete_stylesheet_live",yp_delete_animate:s,_wpnonce:window.yp_live_styles_delete_nonce}).complete(function(){t.css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow"),t.next().css("background","#ff7474").css("border-color","#ff7474").fadeOut("slow")}),0==n(".yp-code-group ul li:not(.yp-data-deleted)").length&&(n(".yp-tab-section").hide(),n(".yp-no-code,.yp-no-animation").fadeIn(300)))})}(jQuery); |