mirror of
https://github.com/felixfoertsch/wordpress-dev-env.git
synced 2026-04-18 15:28:44 +02:00
Initial commit
This commit is contained in:
1
wordpress_plugins/debug-bar-shortcodes/js/debug-bar-shortcodes.min.js
vendored
Normal file
1
wordpress_plugins/debug-bar-shortcodes/js/debug-bar-shortcodes.min.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
jQuery(document).ready(function(){var dbsTable=jQuery("#debug-bar-shortcodes");dbsTable.find("span.spinner").css({"background-image":'url("'+i18nDbShortcodes.spinner+'")'});dbsTable.on("mouseenter.dbs-action-links","tr",function(){jQuery(this).find("div.row-actions").css({"visibility":"visible"})}).on("mouseleave.dbs-action-links","tr",function(){jQuery(this).find("div.row-actions").css({"visibility":"hidden"})});dbsTable.on("click","a.debug-bar-shortcodes-view-details",function(event){var targetTr=jQuery(this).closest("tr").next("tr.debug-bar-shortcodes-details");event.preventDefault();if(jQuery(this).text()===i18nDbShortcodes.view_details){targetTr.show();jQuery(this).text(i18nDbShortcodes.hide_details)}else{targetTr.hide();jQuery(this).text(i18nDbShortcodes.view_details)}});dbsTable.on("click","a.debug-bar-shortcodes-view-use",function(event){var targetTr;event.preventDefault();targetTr=jQuery(this).closest("tr").next("tr");if(targetTr.hasClass("debug-bar-shortcodes-details")){targetTr=targetTr.next("tr")}if(targetTr.hasClass("debug-bar-shortcodes-uses")){if(jQuery(this).text()===i18nDbShortcodes.view_use){targetTr.show();jQuery(this).text(i18nDbShortcodes.hide_use)}else{targetTr.hide();jQuery(this).text(i18nDbShortcodes.view_use)}}});dbsTable.on("click","a.debug-bar-shortcodes-get-details",function(event){var eventTarget,targetShortcode,spinner;event.preventDefault();eventTarget=jQuery(this);targetShortcode=this.hash.substring(1);spinner=eventTarget.closest("td.column-title").find("span.spinner");spinner.addClass("is-active");jQuery.ajax({url:(ajaxurl)?ajaxurl:i18nDbShortcodes.ajaxurl,type:"post",data:{"action":"debug-bar-shortcodes-retrieve","dbs-nonce":i18nDbShortcodes.nonce,"shortcode":targetShortcode},success:function(response){var resData,nrOfColumns,supplemental;if("string"===typeof(response)){jQuery("a.debug-bar-shortcodes-get-details").remove();alert(i18nDbShortcodes.illegal)}else{resData=wpAjax.parseAjaxResponse(response,"ajax-response");if(!resData.responses||1>resData.responses.length||resData.errors){console.log("Received response: "+response);alert(i18nDbShortcodes.error)}else{if("1"!==resData.responses[0].id||!resData.responses[0].data||0===resData.responses[0].data.length){eventTarget.replaceWith(i18nDbShortcodes.no_details)}else{nrOfColumns=(eventTarget.closest("tr").find("td").length-1);resData=resData.responses[0];supplemental=resData.supplemental;resData=resData.data;resData=resData.replace(/\{colspan\}/g,nrOfColumns);if(eventTarget.closest("tr").hasClass("even")){resData=jQuery(resData).addClass("even")}eventTarget.closest("tr").after(resData);eventTarget.text(i18nDbShortcodes.view_details).removeClass("debug-bar-shortcodes-get-details").addClass("debug-bar-shortcodes-view-details").click();if(supplemental.url_link){eventTarget.closest("div.row-actions").append(supplemental.url_link)}}}}spinner.removeClass("is-active")},error:handleAjaxError})});dbsTable.on("click","a.debug-bar-shortcodes-find",function(event){var eventTarget,targetShortcode,spinner;event.preventDefault();eventTarget=jQuery(this);targetShortcode=this.hash.substring(1);spinner=eventTarget.closest("td.column-title").find("span.spinner");spinner.addClass("is-active");jQuery.ajax({url:(ajaxurl)?ajaxurl:i18nDbShortcodes.ajaxurl,type:"post",data:{"action":"debug-bar-shortcodes-find","dbs-nonce":i18nDbShortcodes.nonce,"shortcode":targetShortcode},success:function(response){var resData,nrOfColumns,nextTr;if("string"===typeof(response)){jQuery("a.debug-bar-shortcodes-find").remove();alert(i18nDbShortcodes.illegal)}else{resData=wpAjax.parseAjaxResponse(response,"ajax-response");if(!resData.responses||1>resData.responses.length||resData.errors){console.log("Received response: "+response);alert(i18nDbShortcodes.error)}else{if("1"!==resData.responses[0].id||!resData.responses[0].data||0===resData.responses[0].data.length){eventTarget.replaceWith(i18nDbShortcodes.not_in_use)}else{nrOfColumns=(eventTarget.closest("tr").find("td").length-1);resData=resData.responses[0];resData=resData.data;resData=resData.replace(/\{colspan\}/g,nrOfColumns);nextTr=eventTarget.closest("tr").next("tr");if(nextTr.hasClass("debug-bar-shortcodes-details")){nextTr=nextTr.next("tr")}if(eventTarget.closest("tr").hasClass("even")){resData=jQuery(resData).addClass("even")}nextTr.before(resData);eventTarget.text(i18nDbShortcodes.hide_use).removeClass("debug-bar-shortcodes-find").addClass("debug-bar-shortcodes-view-use")}}}spinner.removeClass("is-active")},error:handleAjaxError})});function handleAjaxError(response){if("undefined"!==typeof(response)){console.log("Received response: "+response)}dbsTable.find("span.spinner").removeClass("is-active");alert(i18nDbShortcodes.error)}});
|
||||
Reference in New Issue
Block a user