<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[26889] trunk/src: Comment moderation shortcuts:</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/26889">26889</a></dd>
<dt>Author</dt> <dd>azaozz</dd>
<dt>Date</dt> <dd>2014-01-02 00:10:20 +0000 (Thu, 02 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Comment moderation shortcuts:
- Fix "toggle checkboxes" (shift+x).
- Add noDisable selector and use it to stop disabling the shortcuts when a select-comment checkbox is focused.
See <a href="http://core.trac.wordpress.org/ticket/26755">#26755</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminjscommonjs">trunk/src/wp-admin/js/common.js</a></li>
<li><a href="#trunksrcwpadminjseditcommentsjs">trunk/src/wp-admin/js/edit-comments.js</a></li>
<li><a href="#trunksrcwpincludesjsjqueryjqueryhotkeysjs">trunk/src/wp-includes/js/jquery/jquery.hotkeys.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminjscommonjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/common.js (26888 => 26889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/common.js 2013-12-31 11:03:59 UTC (rev 26888)
+++ trunk/src/wp-admin/js/common.js 2014-01-02 00:10:20 UTC (rev 26889)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, toggleWithKeyboard, pagenow */
</del><ins>+/* global setUserSetting, ajaxurl, commonL10n, alert, confirm, pagenow */
</ins><span class="cx"> var showNotice, adminMenu, columns, validateForm, screenMeta;
</span><span class="cx"> ( function( $, window, undefined ) {
</span><span class="cx"> // Removed in 3.3.
</span><span class="lines">@@ -346,32 +346,39 @@
</span><span class="cx"> return true;
</span><span class="cx"> });
</span><span class="cx">
</span><del>- $('thead, tfoot').find('.check-column :checkbox').click( function(e) {
- var c = $(this).prop('checked'),
- kbtoggle = 'undefined' == typeof toggleWithKeyboard ? false : toggleWithKeyboard,
- toggle = e.shiftKey || kbtoggle;
</del><ins>+ $('thead, tfoot').find('.check-column :checkbox').on( 'click.wp-toggle-checkboxes', function( event ) {
+ var $this = $(this),
+ $table = $this.closest( 'table' ),
+ controlChecked = $this.prop('checked'),
+ toggle = event.shiftKey || $this.data('wp-toggle');
</ins><span class="cx">
</span><del>- $(this).closest( 'table' ).children( 'tbody' ).filter(':visible')
- .children().children('.check-column').find(':checkbox')
- .prop('checked', function() {
- if ( $(this).is(':hidden') )
</del><ins>+ $table.children( 'tbody' ).filter(':visible')
+ .children().children('.check-column').find(':checkbox')
+ .prop('checked', function() {
+ if ( $(this).is(':hidden') ) {
+ return false;
+ }
+
+ if ( toggle ) {
+ return ! $(this).prop( 'checked' );
+ } else if ( controlChecked ) {
+ return true;
+ }
+
</ins><span class="cx"> return false;
</span><del>- if ( toggle )
- return $(this).prop( 'checked' );
- else if (c)
- return true;
- return false;
- });
</del><ins>+ });
</ins><span class="cx">
</span><del>- $(this).closest('table').children('thead, tfoot').filter(':visible')
- .children().children('.check-column').find(':checkbox')
- .prop('checked', function() {
- if ( toggle )
</del><ins>+ $table.children('thead, tfoot').filter(':visible')
+ .children().children('.check-column').find(':checkbox')
+ .prop('checked', function() {
+ if ( toggle ) {
+ return false;
+ } else if ( controlChecked ) {
+ return true;
+ }
+
</ins><span class="cx"> return false;
</span><del>- else if (c)
- return true;
- return false;
- });
</del><ins>+ });
</ins><span class="cx"> });
</span><span class="cx">
</span><span class="cx"> // Show row actions on keyboard focus of its parent container element or any other elements contained within
</span></span></pre></div>
<a id="trunksrcwpadminjseditcommentsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/edit-comments.js (26888 => 26889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/edit-comments.js 2013-12-31 11:03:59 UTC (rev 26888)
+++ trunk/src/wp-admin/js/edit-comments.js 2014-01-02 00:10:20 UTC (rev 26889)
</span><span class="lines">@@ -1,6 +1,5 @@
</span><span class="cx"> /* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
</span><del>-var setCommentsList, theList, theExtraList, commentReply,
- toggleWithKeyboard = false;
</del><ins>+var setCommentsList, theList, theExtraList, commentReply;
</ins><span class="cx">
</span><span class="cx"> (function($) {
</span><span class="cx"> var getCount, updateCount, updatePending, dashboardTotals;
</span><span class="lines">@@ -594,9 +593,7 @@
</span><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> toggle_all = function() {
</span><del>- toggleWithKeyboard = true;
- $('input:checkbox', '#cb').click().prop('checked', false);
- toggleWithKeyboard = false;
</del><ins>+ $('#cb-select-all-1').data( 'wp-toggle', 1 ).trigger( 'click' ).removeData( 'wp-toggle' );
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> make_bulk = function(value) {
</span><span class="lines">@@ -609,12 +606,28 @@
</span><span class="cx">
</span><span class="cx"> $.table_hotkeys(
</span><span class="cx"> $('table.widefat'),
</span><del>- ['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all],
- ['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')],
- ['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')],
- ['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]],
- { highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
- prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') }
</del><ins>+ [
+ 'a', 'u', 's', 'd', 'r', 'q', 'z',
+ ['e', edit_comment],
+ ['shift+x', toggle_all],
+ ['shift+a', make_bulk('approve')],
+ ['shift+s', make_bulk('spam')],
+ ['shift+d', make_bulk('delete')],
+ ['shift+t', make_bulk('trash')],
+ ['shift+z', make_bulk('untrash')],
+ ['shift+u', make_bulk('unapprove')]
+ ],
+ {
+ highlight_first: adminCommentsL10n.hotkeys_highlight_first,
+ highlight_last: adminCommentsL10n.hotkeys_highlight_last,
+ prev_page_link_cb: make_hotkeys_redirect('prev'),
+ next_page_link_cb: make_hotkeys_redirect('next'),
+ hotkeys_opts: {
+ disableInInput: true,
+ type: 'keypress',
+ noDisable: '.check-column input[type="checkbox"]'
+ }
+ }
</ins><span class="cx"> );
</span><span class="cx"> }
</span><span class="cx"> });
</span></span></pre></div>
<a id="trunksrcwpincludesjsjqueryjqueryhotkeysjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/jquery/jquery.hotkeys.js (26888 => 26889)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/jquery/jquery.hotkeys.js 2013-12-31 11:03:59 UTC (rev 26888)
+++ trunk/src/wp-includes/js/jquery/jquery.hotkeys.js 2014-01-02 00:10:20 UTC (rev 26889)
</span><span class="lines">@@ -1,19 +1,19 @@
</span><span class="cx"> /******************************************************************************************************************************
</span><span class="cx">
</span><del>- * @ Original idea by by Binny V A, Original version: 2.00.A
</del><ins>+ * @ Original idea by by Binny V A, Original version: 2.00.A
</ins><span class="cx"> * @ http://www.openjs.com/scripts/events/keyboard_shortcuts/
</span><span class="cx"> * @ Original License : BSD
</span><del>-
- * @ jQuery Plugin by Tzury Bar Yochay
</del><ins>+
+ * @ jQuery Plugin by Tzury Bar Yochay
</ins><span class="cx"> mail: tzury.by@gmail.com
</span><span class="cx"> blog: evalinux.wordpress.com
</span><span class="cx"> face: facebook.com/profile.php?id=513676303
</span><del>-
</del><ins>+
</ins><span class="cx"> (c) Copyrights 2007
</span><del>-
</del><ins>+
</ins><span class="cx"> * @ jQuery Plugin version Beta (0.0.2)
</span><span class="cx"> * @ License: jQuery-License.
</span><del>-
</del><ins>+
</ins><span class="cx"> TODO:
</span><span class="cx"> add queue support (as in gmail) e.g. 'x' then 'y', etc.
</span><span class="cx"> add mouse + mouse wheel events.
</span><span class="lines">@@ -21,23 +21,23 @@
</span><span class="cx"> USAGE:
</span><span class="cx"> $.hotkeys.add('Ctrl+c', function(){ alert('copy anyone?');});
</span><span class="cx"> $.hotkeys.add('Ctrl+c', {target:'div#editor', type:'keyup', propagate: true},function(){ alert('copy anyone?');});>
</span><del>- $.hotkeys.remove('Ctrl+c');
- $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'});
-
</del><ins>+ $.hotkeys.remove('Ctrl+c');
+ $.hotkeys.remove('Ctrl+c', {target:'div#editor', type:'keypress'});
+
</ins><span class="cx"> ******************************************************************************************************************************/
</span><span class="cx"> (function (jQuery){
</span><span class="cx"> this.version = '(beta)(0.0.3)';
</span><span class="cx"> this.all = {};
</span><span class="cx"> this.special_keys = {
</span><del>- 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock',
- 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup',
- 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3',
</del><ins>+ 27: 'esc', 9: 'tab', 32:'space', 13: 'return', 8:'backspace', 145: 'scroll', 20: 'capslock',
+ 144: 'numlock', 19:'pause', 45:'insert', 36:'home', 46:'del',35:'end', 33: 'pageup',
+ 34:'pagedown', 37:'left', 38:'up', 39:'right',40:'down', 112:'f1',113:'f2', 114:'f3',
</ins><span class="cx"> 115:'f4', 116:'f5', 117:'f6', 118:'f7', 119:'f8', 120:'f9', 121:'f10', 122:'f11', 123:'f12'};
</span><del>-
- this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&",
- "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<",
</del><ins>+
+ this.shift_nums = { "`":"~", "1":"!", "2":"@", "3":"#", "4":"$", "5":"%", "6":"^", "7":"&",
+ "8":"*", "9":"(", "0":")", "-":"_", "=":"+", ";":":", "'":"\"", ",":"<",
</ins><span class="cx"> ".":">", "/":"?", "\\":"|" };
</span><del>-
</del><ins>+
</ins><span class="cx"> this.add = function(combi, options, callback) {
</span><span class="cx"> if (jQuery.isFunction(options)){
</span><span class="cx"> callback = options;
</span><span class="lines">@@ -47,8 +47,8 @@
</span><span class="cx"> defaults = {type: 'keydown', propagate: false, disableInInput: false, target: jQuery('html')[0]},
</span><span class="cx"> that = this;
</span><span class="cx"> opt = jQuery.extend( opt , defaults, options || {} );
</span><del>- combi = combi.toLowerCase();
-
</del><ins>+ combi = combi.toLowerCase();
+
</ins><span class="cx"> // inspect if keystroke matches
</span><span class="cx"> var inspector = function(event) {
</span><span class="cx"> // WP: not needed with newer jQuery
</span><span class="lines">@@ -57,11 +57,14 @@
</span><span class="cx"> // @ TextNode -> nodeType == 3
</span><span class="cx"> // WP: not needed with newer jQuery
</span><span class="cx"> // element = (element.nodeType==3) ? element.parentNode : element;
</span><del>-
- if(opt['disableInInput']) { // Disable shortcut keys in Input, Textarea fields
</del><ins>+
+ if ( opt['disableInInput'] ) { // Disable shortcut keys in Input, Textarea fields
</ins><span class="cx"> var target = jQuery(element);
</span><del>- if( target.is("input") || target.is("textarea")){
- return;
</del><ins>+
+ if ( ( target.is('input') || target.is('textarea') ) &&
+ ( ! opt.noDisable || ! target.is( opt.noDisable ) ) ) {
+
+ return;
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> var code = event.which,
</span><span class="lines">@@ -74,11 +77,11 @@
</span><span class="cx"> meta = event.metaKey,
</span><span class="cx"> propagate = true, // default behaivour
</span><span class="cx"> mapPoint = null;
</span><del>-
</del><ins>+
</ins><span class="cx"> // in opera + safari, the event.target is unpredictable.
</span><del>- // for example: 'keydown' might be associated with HtmlBodyElement
</del><ins>+ // for example: 'keydown' might be associated with HtmlBodyElement
</ins><span class="cx"> // or the element where you last clicked with your mouse.
</span><del>- // WP: needed for all browsers
</del><ins>+ // WP: needed for all browsers
</ins><span class="cx"> // if (jQuery.browser.opera || jQuery.browser.safari){
</span><span class="cx"> while (!that.all[element] && element.parentNode){
</span><span class="cx"> element = element.parentNode;
</span><span class="lines">@@ -106,7 +109,7 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx"> }
</span><del>- };
</del><ins>+ };
</ins><span class="cx"> // first hook for this element
</span><span class="cx"> if (!this.all[opt.target]){
</span><span class="cx"> this.all[opt.target] = {events:{}};
</span><span class="lines">@@ -114,18 +117,18 @@
</span><span class="cx"> if (!this.all[opt.target].events[opt.type]){
</span><span class="cx"> this.all[opt.target].events[opt.type] = {callbackMap: {}}
</span><span class="cx"> jQuery.event.add(opt.target, opt.type, inspector);
</span><del>- }
- this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate};
</del><ins>+ }
+ this.all[opt.target].events[opt.type].callbackMap[combi] = {cb: callback, propagate:opt.propagate};
</ins><span class="cx"> return jQuery;
</span><del>- };
</del><ins>+ };
</ins><span class="cx"> this.remove = function(exp, opt) {
</span><span class="cx"> opt = opt || {};
</span><span class="cx"> target = opt.target || jQuery('html')[0];
</span><span class="cx"> type = opt.type || 'keydown';
</span><del>- exp = exp.toLowerCase();
- delete this.all[target].events[type].callbackMap[exp]
</del><ins>+ exp = exp.toLowerCase();
+ delete this.all[target].events[type].callbackMap[exp]
</ins><span class="cx"> return jQuery;
</span><span class="cx"> };
</span><span class="cx"> jQuery.hotkeys = this;
</span><del>- return jQuery;
-})(jQuery);
</del><span class="cx">\ No newline at end of file
</span><ins>+ return jQuery;
+})(jQuery);
</ins></span></pre>
</div>
</div>
</body>
</html>