Created
June 19, 2012 14:51
-
-
Save thefuxia/2954622 to your computer and use it in GitHub Desktop.
T5 Toolbar hooks: Adds a toolbar item with the current page hooks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php # -*- coding: utf-8 -*- | |
/** | |
* Plugin Name: T5 Toolbar hooks | |
* Description: Adds a toolbar item with the current page hooks. | |
* Version: 2012.06.20 | |
* Author: Thomas Scholz <[email protected]> | |
* Author URI: http://toscho.de | |
* License: MIT | |
* License URI: http://www.opensource.org/licenses/mit-license.php | |
* | |
* Changelog | |
* 2012.06.20 | |
* removed text-shadow from hook box | |
*/ | |
add_action( 'admin_print_footer_scripts', 't5_toolbar_hooks' ); | |
function t5_toolbar_hooks() | |
{ | |
global $hook_suffix, $current_screen; | |
$hooks = array ( | |
"admin_print_styles-$hook_suffix", | |
"admin_print_scripts-$hook_suffix", | |
"admin_head-$hook_suffix", | |
"admin_footer-$hook_suffix" | |
); | |
$vars = array ( | |
'$pagenow: ' . $current_screen->id | |
); | |
$type = empty ( $current_screen->post_type ) | |
? FALSE : $current_screen->post_type; | |
if ( $type ) | |
{ | |
$vars[] = '$typenow: ' . $type; | |
if ( did_action( 'add_meta_boxes_' . $type ) ) | |
{ | |
$hooks[] = 'add_meta_boxes_' . $type; | |
} | |
} | |
?> | |
<script>jQuery(function($) { | |
var linkCss = { | |
'padding': '0 10px', | |
'cursor': 'pointer', | |
}, | |
hookboxcss = { | |
'background': '#fff', | |
'border': '4px solid #080', | |
'color': '#000', | |
'display': 'none', | |
'font': '1em/1.2 monospace', | |
'padding': '5px', | |
'position': 'absolute', | |
'right': '0px', | |
'text-shadow':'none', | |
'top': '28px', | |
'width': '300px' | |
}, | |
hookbox = $('<pre><?php print implode( '\n', $hooks ); ?></pre>') | |
.css(hookboxcss), | |
hooklink = $('<a>Hooks</a>') | |
.click(function(){ hookbox.toggle(); }) | |
.css(linkCss), | |
li = $('<li></li>') | |
.append(hooklink) | |
.append(hookbox); | |
$('#wp-admin-bar-top-secondary').append(li); | |
});</script><?php | |
} |
hover
would hide the box when you try to copy its content or when you have to scroll down. Plus, I don’t use a mouse. :)
jep, or you use .mouseover
; than it is on scroll viewable
A post on WPE would fine?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
great, simple and usefull!
only, maybe
.hover(function(){ hookbox.toggle(); })
is enough and faster for devs.