Changeset 26889
- Timestamp:
- 01/02/2014 12:10:20 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/common.js
r26785 r26889 1 /* global setUserSetting, ajaxurl, commonL10n, alert, confirm, toggleWithKeyboard,pagenow */1 /* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */ 2 2 var showNotice, adminMenu, columns, validateForm, screenMeta; 3 3 ( function( $, window, undefined ) { … … 347 347 }); 348 348 349 $('thead, tfoot').find('.check-column :checkbox').click( function(e) { 350 var c = $(this).prop('checked'), 351 kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard, 352 toggle = e.shiftKey || kbtoggle; 353 354 $(this).closest( 'table' ).children( 'tbody' ).filter(':visible') 355 .children().children('.check-column').find(':checkbox') 356 .prop('checked', function() { 357 if ( $(this).is(':hidden') ) 349 $('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) { 350 var $this = $(this), 351 $table = $this.closest( 'table' ), 352 controlChecked = $this.prop('checked'), 353 toggle = event.shiftKey || $this.data('wp-toggle'); 354 355 $table.children( 'tbody' ).filter(':visible') 356 .children().children('.check-column').find(':checkbox') 357 .prop('checked', function() { 358 if ( $(this).is(':hidden') ) { 359 return false; 360 } 361 362 if ( toggle ) { 363 return ! $(this).prop( 'checked' ); 364 } else if ( controlChecked ) { 365 return true; 366 } 367 358 368 return false; 359 if ( toggle )360 return $(this).prop( 'checked' ); 361 else if (c)362 return true;363 return false;364 });365 366 $(this).closest('table').children('thead, tfoot').filter(':visible')367 .children().children('.check-column').find(':checkbox')368 .prop('checked', function() {369 if ( toggle ) 369 }); 370 371 $table.children('thead, tfoot').filter(':visible') 372 .children().children('.check-column').find(':checkbox') 373 .prop('checked', function() { 374 if ( toggle ) { 375 return false; 376 } else if ( controlChecked ) { 377 return true; 378 } 379 370 380 return false; 371 else if (c) 372 return true; 373 return false; 374 }); 381 }); 375 382 }); 376 383 -
trunk/src/wp-admin/js/edit-comments.js
r26550 r26889 1 1 /* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */ 2 var setCommentsList, theList, theExtraList, commentReply, 3 toggleWithKeyboard = false; 2 var setCommentsList, theList, theExtraList, commentReply; 4 3 5 4 (function($) { … … 595 594 596 595 toggle_all = function() { 597 toggleWithKeyboard = true; 598 $('input:checkbox', '#cb').click().prop('checked', false); 599 toggleWithKeyboard = false; 596 $('#cb-select-all-1').data( 'wp-toggle', 1 ).trigger( 'click' ).removeData( 'wp-toggle' ); 600 597 }; 601 598 … … 610 607 $.table_hotkeys( 611 608 $('table.widefat'), 612 ['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all], 613 ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')], 614 ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')], 615 ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]], 616 { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last, 617 prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') } 609 [ 610 'a', 'u', 's', 'd', 'r', 'q', 'z', 611 ['e', edit_comment], 612 ['shift+x', toggle_all], 613 ['shift+a', make_bulk('approve')], 614 ['shift+s', make_bulk('spam')], 615 ['shift+d', make_bulk('delete')], 616 ['shift+t', make_bulk('trash')], 617 ['shift+z', make_bulk('untrash')], 618 ['shift+u', make_bulk('unapprove')] 619 ], 620 { 621 highlight_first: adminCommentsL10n.hotkeys_highlight_first, 622 highlight_last: adminCommentsL10n.hotkeys_highlight_last, 623 prev_page_link_cb: make_hotkeys_redirect('prev'), 624 next_page_link_cb: make_hotkeys_redirect('next'), 625 hotkeys_opts: { 626 disableInInput: true, 627 type: 'keypress', 628 noDisable: '.check-column input[type="checkbox"]' 629 } 630 } 618 631 ); 619 632 } -
trunk/src/wp-includes/js/jquery/jquery.hotkeys.js
r21592 r26889 1 1 /****************************************************************************************************************************** 2 2 3 * @ Original idea by by Binny V A, Original version: 2.00.A 3 * @ Original idea by by Binny V A, Original version: 2.00.A 4 4 * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/ 5 5 * @ Original License : BSD 6 7 * @ jQuery Plugin by Tzury Bar Yochay 6 7 * @ jQuery Plugin by Tzury Bar Yochay 8 8 mail: tzury.by@gmail.com 9 9 blog: evalinux.wordpress.com 10 10 face: facebook.com/profile.php?id=513676303 11 11 12 12 (c) Copyrights 2007 13 13 14 14 * @ jQuery Plugin version Beta (0.0.2) 15 15 * @ License: jQuery-License. 16 16 17 17 TODO: 18 18 add queue support (as in gmail) e.g. 'x' then 'y', etc. … … 22 22 $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');}); 23 23 $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});> 24 $.hotkeys.remove('Ctrl+c'); 25 $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); 26 24 $.hotkeys.remove('Ctrl+c'); 25 $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'}); 26 27 27 ******************************************************************************************************************************/ 28 28 (function (jQuery){ … … 30 30 this.all = {}; 31 31 this.special_keys = { 32 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 33 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 34 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 32 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock', 33 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup', 34 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3', 35 35 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'}; 36 37 this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 38 "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 36 37 this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&", 38 "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<", 39 39 ".":">", "/":"?", "\\":"|" }; 40 40 41 41 this.add = function(combi, options, callback) { 42 42 if (jQuery.isFunction(options)){ … … 48 48 that = this; 49 49 opt = jQuery.extend( opt , defaults, options || {} ); 50 combi = combi.toLowerCase(); 51 50 combi = combi.toLowerCase(); 51 52 52 // inspect if keystroke matches 53 53 var inspector = function(event) { … … 58 58 // WP: not needed with newer jQuery 59 59 // element = (element.nodeType==3) ? element.parentNode : element; 60 61 if (opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields60 61 if ( opt['disableInInput'] ) { // Disable shortcut keys in Input, Textarea fields 62 62 var target = jQuery(element); 63 if( target.is("input") || target.is("textarea")){ 64 return; 63 64 if ( ( target.is('input') || target.is('textarea') ) && 65 ( ! opt.noDisable || ! target.is( opt.noDisable ) ) ) { 66 67 return; 65 68 } 66 69 } … … 75 78 propagate = true, // default behaivour 76 79 mapPoint = null; 77 80 78 81 // in opera + safari, the event.target is unpredictable. 79 // for example: 'keydown' might be associated with HtmlBodyElement 82 // for example: 'keydown' might be associated with HtmlBodyElement 80 83 // or the element where you last clicked with your mouse. 81 // WP: needed for all browsers 84 // WP: needed for all browsers 82 85 // if (jQuery.browser.opera || jQuery.browser.safari){ 83 86 while (!that.all[element] && element.parentNode){ … … 107 110 } 108 111 } 109 }; 112 }; 110 113 // first hook for this element 111 114 if (!this.all[opt.target]){ … … 115 118 this.all[opt.target].events[opt.type] = {callbackMap: {}} 116 119 jQuery.event.add(opt.target, opt.type, inspector); 117 } 118 this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate}; 120 } 121 this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate}; 119 122 return jQuery; 120 }; 123 }; 121 124 this.remove = function(exp, opt) { 122 125 opt = opt || {}; 123 126 target = opt.target || jQuery('html')[0]; 124 127 type = opt.type || 'keydown'; 125 exp = exp.toLowerCase(); 126 delete this.all[target].events[type].callbackMap[exp] 128 exp = exp.toLowerCase(); 129 delete this.all[target].events[type].callbackMap[exp] 127 130 return jQuery; 128 131 }; 129 132 jQuery.hotkeys = this; 130 return jQuery; 133 return jQuery; 131 134 })(jQuery);
Note: See TracChangeset
for help on using the changeset viewer.