| 594 | | $.table_hotkeys( |
| 595 | | $('table.widefat'), |
| 596 | | ['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all], |
| 597 | | ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')], |
| 598 | | ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')], |
| 599 | | ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]], |
| 600 | | { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, |
| 601 | | prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') } |
| 602 | | ); |
| | 595 | function add_hotkeys() { |
| | 596 | if ( keys ) return; |
| | 597 | keys = true; |
| | 598 | $.table_hotkeys( |
| | 599 | $('table.widefat'), |
| | 600 | ['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all], |
| | 601 | ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')], |
| | 602 | ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')], |
| | 603 | ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]], |
| | 604 | { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, |
| | 605 | prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') } |
| | 606 | ); |
| | 607 | } |
| | 608 | |
| | 609 | function remove_hotkeys() { |
| | 610 | var r = $.hotkeys.remove; |
| | 611 | if ( ! keys ) return; |
| | 612 | $('.vim-current').removeClass('vim-current'); |
| | 613 | keys = false; |
| | 614 | r('a'), r('u'), r('s'), r('d'), r('r'), r('q'), r('z'), r('e'), r('shift+x'), |
| | 615 | r('shift+a'), r('shift+s'), r('shift+d'), r('shift+t'), r('shift+z'), r('shift+u'); |
| | 616 | } |
| | 617 | |
| | 618 | shortcuts.change( function(){ |
| | 619 | if ( $(this).prop('checked') ) |
| | 620 | add_hotkeys(); |
| | 621 | else |
| | 622 | remove_hotkeys(); |
| | 623 | }); |
| | 624 | if ( shortcuts.prop('checked') ) { |
| | 625 | add_hotkeys(); |
| | 626 | keys = true; |
| | 627 | } |