Files
wordpress-dev-env/wordpress_plugins/debug-bar-plugin-activation/js/debug-bar-plugin-activation.min.js
Felix Förtsch 648ded8896 Initial commit
2020-10-20 14:39:50 +02:00

1 line
2.0 KiB
JavaScript

jQuery(window).ready(function(){var dbMenuItem=jQuery("#debug-menu-link-Debug_Bar_Plugin_Activation .debug-bar-issue-count");jQuery("#debug-bar-plugin-activation").find("span.spinner").css({"background-image":'url("'+debugBarPluginActivation.spinner+'")'});jQuery("table.debug-bar-plugin-activation").on("click","a.debug-bar-plugin-activation-delete",function(event){var eventTarget=jQuery(this),rowType,spinner,eventData;event.preventDefault();rowType=eventTarget.attr("data-type");spinner=eventTarget.closest("td").find("span.spinner");spinner.addClass("is-active");eventData={dbpa_nonce:debugBarPluginActivation.dbpa_nonce,type:rowType,plugin:eventTarget.attr("data-plugin"),action:"debug-bar-plugin-activation_delete"};jQuery.post(debugBarPluginActivation.ajaxurl,eventData,function(response){if("number"===typeof response&&1===response){if(1===eventTarget.closest("tbody").prop("rows").length){eventTarget.closest("table").prev("h3").remove();eventTarget.closest("table").remove();jQuery("#debug-bar-plugin-activation span.count."+rowType).text(0)}else{eventTarget.closest("tr").remove();jQuery("#debug-bar-plugin-activation span.count."+rowType).text(function(index,text){text=parseInt(text,10);return(text-1)})}dbMenuItem.text(function(index,text){text=parseInt(text,10);return(text-1)})}spinner.removeClass("is-active")},"json")});jQuery("#debug-bar-plugin-activation-delete-all").on("click",function(event){var eventTarget=jQuery(this),spinner,eventData;event.preventDefault();spinner=eventTarget.closest("h2").find("span.spinner");spinner.addClass("is-active");eventData={dbpa_nonce:debugBarPluginActivation.dbpa_nonce,type:"all",action:"debug-bar-plugin-activation_delete"};jQuery.post(debugBarPluginActivation.ajaxurl,eventData,function(response){if("number"===typeof response&&1===response){jQuery("#debug-bar-plugin-activation h3, #debug-bar-plugin-activation table").remove();jQuery("#debug-bar-plugin-activation span.count").text("0");dbMenuItem.remove()}spinner.removeClass("is-active")},"json")})});