wp/wp-admin/js/edit-comments.js
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
     1 var theList, theExtraList, toggleWithKeyboard = false;
     1 /* global adminCommentsL10n, thousandsSeparator, list_args, QTags, ajaxurl, wpAjax */
       
     2 var setCommentsList, theList, theExtraList, commentReply;
     2 
     3 
     3 (function($) {
     4 (function($) {
     4 var getCount, updateCount, updatePending, dashboardTotals;
     5 var getCount, updateCount, updatePending;
     5 
     6 
     6 setCommentsList = function() {
     7 setCommentsList = function() {
     7 	var totalInput, perPageInput, pageInput, lastConfidentTime = 0, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList;
     8 	var totalInput, perPageInput, pageInput, dimAfter, delBefore, updateTotalCount, delAfter, refillTheExtraList, diff,
       
     9 		lastConfidentTime = 0;
     8 
    10 
     9 	totalInput = $('input[name="_total"]', '#comments-form');
    11 	totalInput = $('input[name="_total"]', '#comments-form');
    10 	perPageInput = $('input[name="_per_page"]', '#comments-form');
    12 	perPageInput = $('input[name="_per_page"]', '#comments-form');
    11 	pageInput = $('input[name="_page"]', '#comments-form');
    13 	pageInput = $('input[name="_page"]', '#comments-form');
    12 
    14 
    13 	dimAfter = function( r, settings ) {
    15 	dimAfter = function( r, settings ) {
    14 		var c = $('#' + settings.element), editRow, replyID, replyButton;
    16 		var editRow, replyID, replyButton,
       
    17 			c = $( '#' + settings.element );
    15 
    18 
    16 		editRow = $('#replyrow');
    19 		editRow = $('#replyrow');
    17 		replyID = $('#comment_ID', editRow).val();
    20 		replyID = $('#comment_ID', editRow).val();
    18 		replyButton = $('#replybtn', editRow);
    21 		replyButton = $('#replybtn', editRow);
    19 
    22 
    27 				replyButton.text(adminCommentsL10n.reply);
    30 				replyButton.text(adminCommentsL10n.reply);
    28 
    31 
    29 			c.find('div.comment_status').html('1');
    32 			c.find('div.comment_status').html('1');
    30 		}
    33 		}
    31 
    34 
    32 		var diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
    35 		diff = $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1;
    33 		updatePending( diff );
    36 		updatePending( diff );
    34 	};
    37 	};
    35 
    38 
    36 	// Send current total, page, per_page and url
    39 	// Send current total, page, per_page and url
    37 	delBefore = function( settings, list ) {
    40 	delBefore = function( settings, list ) {
    38 		var wpListsData = $(settings.target).attr('data-wp-lists'), id, el, n, h, a, author, action = false;
    41 		var note, id, el, n, h, a, author,
       
    42 			action = false,
       
    43 			wpListsData = $( settings.target ).attr( 'data-wp-lists' );
    39 
    44 
    40 		settings.data._total = totalInput.val() || 0;
    45 		settings.data._total = totalInput.val() || 0;
    41 		settings.data._per_page = perPageInput.val() || 0;
    46 		settings.data._per_page = perPageInput.val() || 0;
    42 		settings.data._page = pageInput.val() || 0;
    47 		settings.data._page = pageInput.val() || 0;
    43 		settings.data._url = document.location.href;
    48 		settings.data._url = document.location.href;
    72 			$('strong', '#undo-' + id).text(author);
    77 			$('strong', '#undo-' + id).text(author);
    73 			a = $('.undo a', '#undo-' + id);
    78 			a = $('.undo a', '#undo-' + id);
    74 			a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
    79 			a.attr('href', 'comment.php?action=un' + action + 'comment&c=' + id + '&_wpnonce=' + settings.data._ajax_nonce);
    75 			a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
    80 			a.attr('data-wp-lists', 'delete:the-comment-list:comment-' + id + '::un' + action + '=1');
    76 			a.attr('class', 'vim-z vim-destructive');
    81 			a.attr('class', 'vim-z vim-destructive');
    77 			$('.avatar', el).clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
    82 			$('.avatar', el).first().clone().prependTo('#undo-' + id + ' .' + action + '-undo-inside');
    78 
    83 
    79 			a.click(function(){
    84 			a.click(function(){
    80 				list.wpList.del(this);
    85 				list.wpList.del(this);
    81 				$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
    86 				$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
    82 					$(this).remove();
    87 					$(this).remove();
    83 					$('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show() });
    88 					$('#comment-' + id).css('backgroundColor', '').fadeIn(300, function(){ $(this).show(); });
    84 				});
    89 				});
    85 				return false;
    90 				return false;
    86 			});
    91 			});
    87 		}
    92 		}
    88 
    93 
    96 
   101 
    97 		if ( setConfidentTime )
   102 		if ( setConfidentTime )
    98 			lastConfidentTime = time;
   103 			lastConfidentTime = time;
    99 
   104 
   100 		totalInput.val( total.toString() );
   105 		totalInput.val( total.toString() );
   101 	};
       
   102 
       
   103 	dashboardTotals = function(n) {
       
   104 		var dash = $('#dashboard_right_now'), total, appr, totalN, apprN;
       
   105 
       
   106 		n = n || 0;
       
   107 		if ( isNaN(n) || !dash.length )
       
   108 			return;
       
   109 
       
   110 		total = $('span.total-count', dash);
       
   111 		appr = $('span.approved-count', dash);
       
   112 		totalN = getCount(total);
       
   113 
       
   114 		totalN = totalN + n;
       
   115 		apprN = totalN - getCount( $('span.pending-count', dash) ) - getCount( $('span.spam-count', dash) );
       
   116 		updateCount(total, totalN);
       
   117 		updateCount(appr, apprN);
       
   118 	};
   106 	};
   119 
   107 
   120 	getCount = function(el) {
   108 	getCount = function(el) {
   121 		var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );
   109 		var n = parseInt( el.html().replace(/[^0-9]+/g, ''), 10 );
   122 		if ( isNaN(n) )
   110 		if ( isNaN(n) )
   142 	updatePending = function( diff ) {
   130 	updatePending = function( diff ) {
   143 		$('span.pending-count').each(function() {
   131 		$('span.pending-count').each(function() {
   144 			var a = $(this), n = getCount(a) + diff;
   132 			var a = $(this), n = getCount(a) + diff;
   145 			if ( n < 1 )
   133 			if ( n < 1 )
   146 				n = 0;
   134 				n = 0;
   147 			a.closest('.awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
   135 			a.closest('.awaiting-mod')[ 0 === n ? 'addClass' : 'removeClass' ]('count-0');
   148 			updateCount( a, n );
   136 			updateCount( a, n );
   149 		});
   137 		});
   150 
       
   151 		dashboardTotals();
       
   152 	};
   138 	};
   153 
   139 
   154 	// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
   140 	// In admin-ajax.php, we send back the unix time stamp instead of 1 on success
   155 	delAfter = function( r, settings ) {
   141 	delAfter = function( r, settings ) {
   156 		var total, N, spam, trash, pending,
   142 		var total_items_i18n, total, spam, trash, pending,
   157 			untrash = $(settings.target).parent().is('span.untrash'),
   143 			untrash = $(settings.target).parent().is('span.untrash'),
   158 			unspam = $(settings.target).parent().is('span.unspam'),
   144 			unspam = $(settings.target).parent().is('span.unspam'),
   159 			unapproved = $('#' + settings.element).is('.unapproved');
   145 			unapproved = $('#' + settings.element).is('.unapproved');
   160 
   146 
   161 		function getUpdate(s) {
   147 		function getUpdate(s) {
   197 		$('span.trash-count').each( function() {
   183 		$('span.trash-count').each( function() {
   198 			var a = $(this), n = getCount(a) + trash;
   184 			var a = $(this), n = getCount(a) + trash;
   199 			updateCount(a, n);
   185 			updateCount(a, n);
   200 		});
   186 		});
   201 
   187 
   202 		if ( $('#dashboard_right_now').length ) {
   188 		if ( ! $('#dashboard_right_now').length ) {
   203 			N = trash ? -1 * trash : 0;
       
   204 			dashboardTotals(N);
       
   205 		} else {
       
   206 			total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
   189 			total = totalInput.val() ? parseInt( totalInput.val(), 10 ) : 0;
   207 			if ( $(settings.target).parent().is('span.undo') )
   190 			if ( $(settings.target).parent().is('span.undo') )
   208 				total++;
   191 				total++;
   209 			else
   192 			else
   210 				total--;
   193 				total--;
   223 			} else {
   206 			} else {
   224 				updateTotalCount( total, r, false );
   207 				updateTotalCount( total, r, false );
   225 			}
   208 			}
   226 		}
   209 		}
   227 
   210 
   228 		if ( ! theExtraList || theExtraList.size() == 0 || theExtraList.children().size() == 0 || untrash || unspam ) {
   211 		if ( ! theExtraList || theExtraList.size() === 0 || theExtraList.children().size() === 0 || untrash || unspam ) {
   229 			return;
   212 			return;
   230 		}
   213 		}
   231 
   214 
   232 		theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
   215 		theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
   233 
   216 
   281 	theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
   264 	theList = $('#the-comment-list').wpList( { alt: '', delBefore: delBefore, dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } )
   282 		.bind('wpListDelEnd', function(e, s){
   265 		.bind('wpListDelEnd', function(e, s){
   283 			var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, '');
   266 			var wpListsData = $(s.target).attr('data-wp-lists'), id = s.element.replace(/[^0-9]+/g, '');
   284 
   267 
   285 			if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.indexOf(':spam=1') != -1 )
   268 			if ( wpListsData.indexOf(':trash=1') != -1 || wpListsData.indexOf(':spam=1') != -1 )
   286 				$('#undo-' + id).fadeIn(300, function(){ $(this).show() });
   269 				$('#undo-' + id).fadeIn(300, function(){ $(this).show(); });
   287 		});
   270 		});
   288 };
   271 };
   289 
   272 
   290 commentReply = {
   273 commentReply = {
   291 	cid : '',
   274 	cid : '',
   307 		// add events
   290 		// add events
   308 		$('#the-comment-list .column-comment > p').dblclick(function(){
   291 		$('#the-comment-list .column-comment > p').dblclick(function(){
   309 			commentReply.toggle($(this).parent());
   292 			commentReply.toggle($(this).parent());
   310 		});
   293 		});
   311 
   294 
   312 		$('#doaction, #doaction2, #post-query-submit').click(function(e){
   295 		$('#doaction, #doaction2, #post-query-submit').click(function(){
   313 			if ( $('#the-comment-list #replyrow').length > 0 )
   296 			if ( $('#the-comment-list #replyrow').length > 0 )
   314 				commentReply.close();
   297 				commentReply.close();
   315 		});
   298 		});
   316 
   299 
   317 		this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || '';
   300 		this.comments_listing = $('#comments-form > input[name="comment_status"]').val() || '';
   353 		if ( replyrow.parent().is('#com-reply') )
   336 		if ( replyrow.parent().is('#com-reply') )
   354 			return;
   337 			return;
   355 
   338 
   356 		if ( this.cid && this.act == 'edit-comment' ) {
   339 		if ( this.cid && this.act == 'edit-comment' ) {
   357 			c = $('#comment-' + this.cid);
   340 			c = $('#comment-' + this.cid);
   358 			c.fadeIn(300, function(){ c.show() }).css('backgroundColor', '');
   341 			c.fadeIn(300, function(){ c.show(); }).css('backgroundColor', '');
   359 		}
   342 		}
   360 
   343 
   361 		// reset the Quicktags buttons
   344 		// reset the Quicktags buttons
   362 		if ( typeof QTags != 'undefined' )
   345 		if ( typeof QTags != 'undefined' )
   363 			QTags.closeAllTags('replycontent');
   346 			QTags.closeAllTags('replycontent');
   366 
   349 
   367 		replyrow.hide();
   350 		replyrow.hide();
   368 		$('#com-reply').append( replyrow );
   351 		$('#com-reply').append( replyrow );
   369 		$('#replycontent').css('height', '').val('');
   352 		$('#replycontent').css('height', '').val('');
   370 		$('#edithead input').val('');
   353 		$('#edithead input').val('');
   371 		$('.error', replyrow).html('').hide();
   354 		$('.error', replyrow).empty().hide();
   372 		$('.spinner', replyrow).hide();
   355 		$( '.spinner', replyrow ).removeClass( 'is-active' );
   373 
   356 
   374 		this.cid = '';
   357 		this.cid = '';
   375 	},
   358 	},
   376 
   359 
   377 	open : function(comment_id, post_id, action) {
   360 	open : function(comment_id, post_id, action) {
   378 		var t = this, editRow, rowData, act, c = $('#comment-' + comment_id), h = c.height(), replyButton;
   361 		var editRow, rowData, act, replyButton, editHeight,
       
   362 			t = this,
       
   363 			c = $('#comment-' + comment_id),
       
   364 			h = c.height();
   379 
   365 
   380 		t.close();
   366 		t.close();
   381 		t.cid = comment_id;
   367 		t.cid = comment_id;
   382 
   368 
   383 		editRow = $('#replyrow');
   369 		editRow = $('#replyrow');
   387 		act = t.act = act + '-comment';
   373 		act = t.act = act + '-comment';
   388 
   374 
   389 		$('#action', editRow).val(act);
   375 		$('#action', editRow).val(act);
   390 		$('#comment_post_ID', editRow).val(post_id);
   376 		$('#comment_post_ID', editRow).val(post_id);
   391 		$('#comment_ID', editRow).val(comment_id);
   377 		$('#comment_ID', editRow).val(comment_id);
   392 
       
   393 		if ( h > 120 )
       
   394 			$('#replycontent', editRow).css('height', (35+h) + 'px');
       
   395 
   378 
   396 		if ( action == 'edit' ) {
   379 		if ( action == 'edit' ) {
   397 			$('#author', editRow).val( $('div.author', rowData).text() );
   380 			$('#author', editRow).val( $('div.author', rowData).text() );
   398 			$('#author-email', editRow).val( $('div.author-email', rowData).text() );
   381 			$('#author-email', editRow).val( $('div.author-email', rowData).text() );
   399 			$('#author-url', editRow).val( $('div.author-url', rowData).text() );
   382 			$('#author-url', editRow).val( $('div.author-url', rowData).text() );
   400 			$('#status', editRow).val( $('div.comment_status', rowData).text() );
   383 			$('#status', editRow).val( $('div.comment_status', rowData).text() );
   401 			$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
   384 			$('#replycontent', editRow).val( $('textarea.comment', rowData).val() );
   402 			$('#edithead, #savebtn', editRow).show();
   385 			$('#edithead, #savebtn', editRow).show();
   403 			$('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide();
   386 			$('#replyhead, #replybtn, #addhead, #addbtn', editRow).hide();
   404 
   387 
       
   388 			if ( h > 120 ) {
       
   389 				// Limit the maximum height when editing very long comments to make it more manageable.
       
   390 				// The textarea is resizable in most browsers, so the user can adjust it if needed.
       
   391 				editHeight = h > 500 ? 500 : h;
       
   392 				$('#replycontent', editRow).css('height', editHeight + 'px');
       
   393 			}
       
   394 
   405 			c.after( editRow ).fadeOut('fast', function(){
   395 			c.after( editRow ).fadeOut('fast', function(){
   406 				$('#replyrow').fadeIn(300, function(){ $(this).show() });
   396 				$('#replyrow').fadeIn(300, function(){ $(this).show(); });
   407 			});
   397 			});
   408 		} else if ( action == 'add' ) {
   398 		} else if ( action == 'add' ) {
   409 			$('#addhead, #addbtn', editRow).show();
   399 			$('#addhead, #addbtn', editRow).show();
   410 			$('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide();
   400 			$('#replyhead, #replybtn, #edithead, #editbtn', editRow).hide();
   411 			$('#the-comment-list').prepend(editRow);
   401 			$('#the-comment-list').prepend(editRow);
   412 			$('#replyrow').fadeIn(300);
   402 			$('#replyrow').fadeIn(300);
   413  		} else {
   403 		} else {
   414  			replyButton = $('#replybtn', editRow);
   404 			replyButton = $('#replybtn', editRow);
   415 			$('#edithead, #savebtn, #addhead, #addbtn', editRow).hide();
   405 			$('#edithead, #savebtn, #addhead, #addbtn', editRow).hide();
   416 			$('#replyhead, #replybtn', editRow).show();
   406 			$('#replyhead, #replybtn', editRow).show();
   417 			c.after(editRow);
   407 			c.after(editRow);
   418 
   408 
   419 			if ( c.hasClass('unapproved') ) {
   409 			if ( c.hasClass('unapproved') ) {
   420 				replyButton.text(adminCommentsL10n.replyApprove);
   410 				replyButton.text(adminCommentsL10n.replyApprove);
   421 			} else {
   411 			} else {
   422 				replyButton.text(adminCommentsL10n.reply);
   412 				replyButton.text(adminCommentsL10n.reply);
   423 			}
   413 			}
   424 
   414 
   425 			$('#replyrow').fadeIn(300, function(){ $(this).show() });
   415 			$('#replyrow').fadeIn(300, function(){ $(this).show(); });
   426 		}
   416 		}
   427 
   417 
   428 		setTimeout(function() {
   418 		setTimeout(function() {
   429 			var rtop, rbottom, scrollTop, vp, scrollBottom;
   419 			var rtop, rbottom, scrollTop, vp, scrollBottom;
   430 
   420 
   431 			rtop = $('#replyrow').offset().top;
   421 			rtop = $('#replyrow').offset().top;
   432 			rbottom = rtop + $('#replyrow').height();
   422 			rbottom = rtop + $('#replyrow').height();
   433 			scrollTop = window.pageYOffset || document.documentElement.scrollTop;
   423 			scrollTop = window.pageYOffset || document.documentElement.scrollTop;
   434 			vp = document.documentElement.clientHeight || self.innerHeight || 0;
   424 			vp = document.documentElement.clientHeight || window.innerHeight || 0;
   435 			scrollBottom = scrollTop + vp;
   425 			scrollBottom = scrollTop + vp;
   436 
   426 
   437 			if ( scrollBottom - 20 < rbottom )
   427 			if ( scrollBottom - 20 < rbottom )
   438 				window.scroll(0, rbottom - vp + 35);
   428 				window.scroll(0, rbottom - vp + 35);
   439 			else if ( rtop - 20 < scrollTop )
   429 			else if ( rtop - 20 < scrollTop )
   450 
   440 
   451 	send : function() {
   441 	send : function() {
   452 		var post = {};
   442 		var post = {};
   453 
   443 
   454 		$('#replysubmit .error').hide();
   444 		$('#replysubmit .error').hide();
   455 		$('#replysubmit .spinner').show();
   445 		$( '#replysubmit .spinner' ).addClass( 'is-active' );
   456 
   446 
   457 		$('#replyrow input').not(':button').each(function() {
   447 		$('#replyrow input').not(':button').each(function() {
   458 			var t = $(this);
   448 			var t = $(this);
   459 			post[ t.attr('name') ] = t.val();
   449 			post[ t.attr('name') ] = t.val();
   460 		});
   450 		});
   511 				return;
   501 				return;
   512 			}
   502 			}
   513 		}
   503 		}
   514 
   504 
   515 		c = $.trim(r.data); // Trim leading whitespaces
   505 		c = $.trim(r.data); // Trim leading whitespaces
   516 		$(c).hide()
   506 		$(c).hide();
   517 		$('#replyrow').after(c);
   507 		$('#replyrow').after(c);
   518 
   508 
   519 		id = $(id);
   509 		id = $(id);
   520 		t.addEvents(id);
   510 		t.addEvents(id);
   521 		bg = id.hasClass('unapproved') ? '#FFFFE0' : id.closest('.widefat, .postbox').css('backgroundColor');
   511 		bg = id.hasClass('unapproved') ? '#FFFFE0' : id.closest('.widefat, .postbox').css('backgroundColor');
   533 	},
   523 	},
   534 
   524 
   535 	error : function(r) {
   525 	error : function(r) {
   536 		var er = r.statusText;
   526 		var er = r.statusText;
   537 
   527 
   538 		$('#replysubmit .spinner').hide();
   528 		$( '#replysubmit .spinner' ).removeClass( 'is-active' );
   539 
   529 
   540 		if ( r.responseText )
   530 		if ( r.responseText )
   541 			er = r.responseText.replace( /<.[^<>]*?>/g, '' );
   531 			er = r.responseText.replace( /<.[^<>]*?>/g, '' );
   542 
   532 
   543 		if ( er )
   533 		if ( er )
   570 
   560 
   571 				first_last = 'next' == which? 'first' : 'last';
   561 				first_last = 'next' == which? 'first' : 'last';
   572 				l = $('.tablenav-pages .'+which+'-page:not(.disabled)');
   562 				l = $('.tablenav-pages .'+which+'-page:not(.disabled)');
   573 				if (l.length)
   563 				if (l.length)
   574 					window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
   564 					window.location = l[0].href.replace(/\&hotkeys_highlight_(first|last)=1/g, '')+'&hotkeys_highlight_'+first_last+'=1';
   575 			}
   565 			};
   576 		};
   566 		};
   577 
   567 
   578 		edit_comment = function(event, current_row) {
   568 		edit_comment = function(event, current_row) {
   579 			window.location = $('span.edit a', current_row).attr('href');
   569 			window.location = $('span.edit a', current_row).attr('href');
   580 		};
   570 		};
   581 
   571 
   582 		toggle_all = function() {
   572 		toggle_all = function() {
   583 			toggleWithKeyboard = true;
   573 			$('#cb-select-all-1').data( 'wp-toggle', 1 ).trigger( 'click' ).removeData( 'wp-toggle' );
   584 			$('input:checkbox', '#cb').click().prop('checked', false);
       
   585 			toggleWithKeyboard = false;
       
   586 		};
   574 		};
   587 
   575 
   588 		make_bulk = function(value) {
   576 		make_bulk = function(value) {
   589 			return function() {
   577 			return function() {
   590 				var scope = $('select[name="action"]');
   578 				var scope = $('select[name="action"]');
   591 				$('option[value="' + value + '"]', scope).prop('selected', true);
   579 				$('option[value="' + value + '"]', scope).prop('selected', true);
   592 				$('#doaction').click();
   580 				$('#doaction').click();
   593 			}
   581 			};
   594 		};
   582 		};
   595 
   583 
   596 		$.table_hotkeys(
   584 		$.table_hotkeys(
   597 			$('table.widefat'),
   585 			$('table.widefat'),
   598 			['a', 'u', 's', 'd', 'r', 'q', 'z', ['e', edit_comment], ['shift+x', toggle_all],
   586 			[
   599 			['shift+a', make_bulk('approve')], ['shift+s', make_bulk('spam')],
   587 				'a', 'u', 's', 'd', 'r', 'q', 'z',
   600 			['shift+d', make_bulk('delete')], ['shift+t', make_bulk('trash')],
   588 				['e', edit_comment],
   601 			['shift+z', make_bulk('untrash')], ['shift+u', make_bulk('unapprove')]],
   589 				['shift+x', toggle_all],
   602 			{ highlight_first: adminCommentsL10n.hotkeys_highlight_first, highlight_last: adminCommentsL10n.hotkeys_highlight_last,
   590 				['shift+a', make_bulk('approve')],
   603 			prev_page_link_cb: make_hotkeys_redirect('prev'), next_page_link_cb: make_hotkeys_redirect('next') }
   591 				['shift+s', make_bulk('spam')],
       
   592 				['shift+d', make_bulk('delete')],
       
   593 				['shift+t', make_bulk('trash')],
       
   594 				['shift+z', make_bulk('untrash')],
       
   595 				['shift+u', make_bulk('unapprove')]
       
   596 			],
       
   597 			{
       
   598 				highlight_first: adminCommentsL10n.hotkeys_highlight_first,
       
   599 				highlight_last: adminCommentsL10n.hotkeys_highlight_last,
       
   600 				prev_page_link_cb: make_hotkeys_redirect('prev'),
       
   601 				next_page_link_cb: make_hotkeys_redirect('next'),
       
   602 				hotkeys_opts: {
       
   603 					disableInInput: true,
       
   604 					type: 'keypress',
       
   605 					noDisable: '.check-column input[type="checkbox"]'
       
   606 				},
       
   607 				cycle_expr: '#the-comment-list tr',
       
   608 				start_row_index: 0
       
   609 			}
   604 		);
   610 		);
   605 	}
   611 	}
       
   612 
       
   613 	// Quick Edit and Reply have an inline comment editor.
       
   614 	$( '#the-comment-list' ).on( 'click', '.comment-inline', function (e) {
       
   615 		e.preventDefault();
       
   616 		var $el = $( this ),
       
   617 			action = 'replyto';
       
   618 
       
   619 		if ( 'undefined' !== typeof $el.data( 'action' ) ) {
       
   620 			action = $el.data( 'action' );
       
   621 		}
       
   622 
       
   623 		commentReply.open( $el.data( 'commentId' ), $el.data( 'postId' ), action );
       
   624 	} );
   606 });
   625 });
   607 
   626 
   608 })(jQuery);
   627 })(jQuery);