-
Notifications
You must be signed in to change notification settings - Fork 7
/
wpbutler.js
32 lines (26 loc) · 875 Bytes
/
wpbutler.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// WP Butler
jQuery( function($) {
var openButler = function() {
$( "#wp-butler-dialog" ).dialog({
modal: true,
closeOnEscape: true,
width: 420
}).parent().addClass('butler-ui-widget');
$( "#wp-butler-field" ).focus();
};
// keyboard shortcut to view dialog
$.keyStroke( 66, openButler, { modKeys: [ 'shiftKey', 'altKey' ] } );
// click on button in admin bar to view dialog
$( '#wp-admin-bar-wp-butler' ).click( openButler );
$( "#butler-close-dialog" ).click(function(e) {
e.preventDefault();
$( "#butler-dialog" ).dialog( "close" );
});
$( "#wp-butler-field" ).autocomplete({
source: ajaxurl + '?action=wp_butler_actions&_nonce=' + $.trim( $('#wp-butler-nonce').val() ) + '&_context=' + $.trim( $('#wp-butler-context').val() ),
select: function( event , ui ) {
window.location.href = ui.item.url;
return false;
}
});
});