Publish box: move focus when the animation is done

Also move the focus back to 'edit' when saving changes.

Props afercia.
Fixes #33060.

Built from https://develop.svn.wordpress.org/trunk@33352


git-svn-id: http://core.svn.wordpress.org/trunk@33324 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ella Iseulde Van Dorpe 2015-07-21 22:46:24 +00:00
parent d8980f96da
commit 482f174f2e
5 changed files with 19 additions and 13 deletions

View File

@ -8,8 +8,9 @@ jQuery(document).ready( function($) {
$timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
if ( $timestampdiv.is( ':hidden' ) ) {
$timestampdiv.slideDown('fast');
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
$timestampdiv.slideDown( 'fast', function() {
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
} );
$(this).hide();
}
event.preventDefault();

View File

@ -1 +1 @@
jQuery(document).ready(function(a){postboxes.add_postbox_toggles("comment");var b=a("#timestampdiv"),c=a("#timestamp").html();b.siblings("a.edit-timestamp").click(function(c){b.is(":hidden")&&(b.slideDown("fast"),a("input, select",b.find(".timestamp-wrap")).first().focus(),a(this).hide()),c.preventDefault()}),b.find(".cancel-timestamp").click(function(d){b.slideUp("fast").siblings("a.edit-timestamp").show().focus(),a("#mm").val(a("#hidden_mm").val()),a("#jj").val(a("#hidden_jj").val()),a("#aa").val(a("#hidden_aa").val()),a("#hh").val(a("#hidden_hh").val()),a("#mn").val(a("#hidden_mn").val()),a("#timestamp").html(c),d.preventDefault()}),b.find(".save-timestamp").click(function(c){var d=a("#aa").val(),e=a("#mm").val(),f=a("#jj").val(),g=a("#hh").val(),h=a("#mn").val(),i=new Date(d,e-1,f,g,h);return c.preventDefault(),i.getFullYear()!=d||1+i.getMonth()!=e||i.getDate()!=f||i.getMinutes()!=h?void b.find(".timestamp-wrap").addClass("form-invalid"):(b.find(".timestamp-wrap").removeClass("form-invalid"),a("#timestamp").html(commentL10n.submittedOn+" <b>"+commentL10n.dateFormat.replace("%1$s",a('option[value="'+e+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(f,10)).replace("%3$s",d).replace("%4$s",("00"+g).slice(-2)).replace("%5$s",("00"+h).slice(-2))+"</b> "),b.slideUp("fast"),void b.siblings("a.edit-timestamp").show())})});
jQuery(document).ready(function(a){postboxes.add_postbox_toggles("comment");var b=a("#timestampdiv"),c=a("#timestamp").html();b.siblings("a.edit-timestamp").click(function(c){b.is(":hidden")&&(b.slideDown("fast",function(){a("input, select",b.find(".timestamp-wrap")).first().focus()}),a(this).hide()),c.preventDefault()}),b.find(".cancel-timestamp").click(function(d){b.slideUp("fast").siblings("a.edit-timestamp").show().focus(),a("#mm").val(a("#hidden_mm").val()),a("#jj").val(a("#hidden_jj").val()),a("#aa").val(a("#hidden_aa").val()),a("#hh").val(a("#hidden_hh").val()),a("#mn").val(a("#hidden_mn").val()),a("#timestamp").html(c),d.preventDefault()}),b.find(".save-timestamp").click(function(c){var d=a("#aa").val(),e=a("#mm").val(),f=a("#jj").val(),g=a("#hh").val(),h=a("#mn").val(),i=new Date(d,e-1,f,g,h);return c.preventDefault(),i.getFullYear()!=d||1+i.getMonth()!=e||i.getDate()!=f||i.getMinutes()!=h?void b.find(".timestamp-wrap").addClass("form-invalid"):(b.find(".timestamp-wrap").removeClass("form-invalid"),a("#timestamp").html(commentL10n.submittedOn+" <b>"+commentL10n.dateFormat.replace("%1$s",a('option[value="'+e+'"]',"#mm").attr("data-text")).replace("%2$s",parseInt(f,10)).replace("%3$s",d).replace("%4$s",("00"+g).slice(-2)).replace("%5$s",("00"+h).slice(-2))+"</b> "),b.slideUp("fast"),void b.siblings("a.edit-timestamp").show())})});

View File

@ -607,7 +607,9 @@ jQuery(document).ready( function($) {
$( '#visibility .edit-visibility').click( function () {
if ( $postVisibilitySelect.is(':hidden') ) {
updateVisibility();
$postVisibilitySelect.slideDown('fast').find('input[type="radio"]').first().focus();
$postVisibilitySelect.slideDown( 'fast', function() {
$postVisibilitySelect.find( 'input[type="radio"]' ).first().focus();
} );
$(this).hide();
}
return false;
@ -626,7 +628,7 @@ jQuery(document).ready( function($) {
$postVisibilitySelect.find('.save-post-visibility').click( function( event ) { // crazyhorse - multiple ok cancels
$postVisibilitySelect.slideUp('fast');
$('#visibility .edit-visibility').show();
$('#visibility .edit-visibility').show().focus();
updateText();
if ( $postVisibilitySelect.find('input:radio:checked').val() != 'public' ) {
@ -649,8 +651,9 @@ jQuery(document).ready( function($) {
$timestampdiv.siblings('a.edit-timestamp').click( function( event ) {
if ( $timestampdiv.is( ':hidden' ) ) {
$timestampdiv.slideDown('fast');
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
$timestampdiv.slideDown( 'fast', function() {
$( 'input, select', $timestampdiv.find( '.timestamp-wrap' ) ).first().focus();
} );
$(this).hide();
}
event.preventDefault();
@ -670,7 +673,7 @@ jQuery(document).ready( function($) {
$timestampdiv.find('.save-timestamp').click( function( event ) { // crazyhorse - multiple ok cancels
if ( updateText() ) {
$timestampdiv.slideUp('fast');
$timestampdiv.siblings('a.edit-timestamp').show();
$timestampdiv.siblings('a.edit-timestamp').show().focus();
}
event.preventDefault();
});
@ -690,20 +693,22 @@ jQuery(document).ready( function($) {
$postStatusSelect.siblings('a.edit-post-status').click( function( event ) {
if ( $postStatusSelect.is( ':hidden' ) ) {
$postStatusSelect.slideDown('fast').find('select').focus();
$postStatusSelect.slideDown( 'fast', function() {
$postStatusSelect.find('select').focus();
} );
$(this).hide();
}
event.preventDefault();
});
$postStatusSelect.find('.save-post-status').click( function( event ) {
$postStatusSelect.slideUp('fast').siblings('a.edit-post-status').show();
$postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus();
updateText();
event.preventDefault();
});
$postStatusSelect.find('.cancel-post-status').click( function( event ) {
$('#post-status-select').slideUp('fast').siblings( 'a.edit-post-status' ).show().focus();
$postStatusSelect.slideUp( 'fast' ).siblings( 'a.edit-post-status' ).show().focus();
$('#post_status').val( $('#hidden_post_status').val() );
updateText();
event.preventDefault();

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-beta3-33351';
$wp_version = '4.3-beta3-33352';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.