An updated theme (based on Atticus Finch) for ClassicPress
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5 KiB

3 years ago
  1. jQuery(function($) {
  2. function runAjaxAction(button, action) {
  3. button = $(button);
  4. var panel = button.closest('.puc-debug-bar-panel-v4');
  5. var responseBox = button.closest('td').find('.puc-ajax-response');
  6. responseBox.text('Processing...').show();
  7. $.post(
  8. ajaxurl,
  9. {
  10. action : action,
  11. uid : panel.data('uid'),
  12. _wpnonce: panel.data('nonce')
  13. },
  14. function(data) {
  15. responseBox.html(data);
  16. },
  17. 'html'
  18. );
  19. }
  20. $('.puc-debug-bar-panel-v4 input[name="puc-check-now-button"]').click(function() {
  21. runAjaxAction(this, 'puc_v4_debug_check_now');
  22. return false;
  23. });
  24. $('.puc-debug-bar-panel-v4 input[name="puc-request-info-button"]').click(function() {
  25. runAjaxAction(this, 'puc_v4_debug_request_info');
  26. return false;
  27. });
  28. // Debug Bar uses the panel class name as part of its link and container IDs. This means we can
  29. // end up with multiple identical IDs if more than one plugin uses the update checker library.
  30. // Fix it by replacing the class name with the plugin slug.
  31. var panels = $('#debug-menu-targets').find('.puc-debug-bar-panel-v4');
  32. panels.each(function() {
  33. var panel = $(this);
  34. var uid = panel.data('uid');
  35. var target = panel.closest('.debug-menu-target');
  36. //Change the panel wrapper ID.
  37. target.attr('id', 'debug-menu-target-puc-' + uid);
  38. //Change the menu link ID as well and point it at the new target ID.
  39. $('#debug-bar-menu').find('.puc-debug-menu-link-' + uid)
  40. .closest('.debug-menu-link')
  41. .attr('id', 'debug-menu-link-puc-' + uid)
  42. .attr('href', '#' + target.attr('id'));
  43. });
  44. });