Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/wp-admin/admin-footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,14 @@
?>

<div class="clear"></div></div><!-- wpwrap -->
<script>if(typeof wpOnload==='function')wpOnload();</script>
<?php
wp_print_inline_script_tag(
<<<'JS'
if ( typeof wpOnload === 'function' ) {
wpOnload();
}
JS
);
?>
</body>
</html>
30 changes: 29 additions & 1 deletion src/wp-admin/async-upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,35 @@
$_FILES['async-upload']['name']
);

echo '<script>_.delay(function() {wp.a11y.speak(' . wp_json_encode( $speak_message, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ");}, 1500);jQuery( 'button#{$button_unique_id}' ).on( 'click', function() {jQuery(this).parents('div.media-item').slideUp(200, function(){jQuery(this).remove();wp.a11y.speak( wp.i18n.__( 'Error dismissed.' ) );jQuery( '#plupload-browse-button' ).trigger( 'focus' );})});</script>\n";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code was originally introduced in fe0427c with modifications in 063a74f and 62f89e9.

@joedolson Does the below look good to you, as it originated with you for Core-63114? It should be much easier to read now 😄

$js_function = <<<'JS'
( { speakMessage, buttonSelector } ) => {
_.delay( function () {
wp.a11y.speak( speakMessage );
}, 1500 );
jQuery( buttonSelector ).on( 'click', function () {
jQuery( this )
.parents( 'div.media-item' )
.slideUp( 200, function () {
jQuery( this ).remove();
wp.a11y.speak( wp.i18n.__( 'Error dismissed.' ) );
jQuery( '#plupload-browse-button' ).trigger( 'focus' );
} );
} );
}
JS;
wp_print_inline_script_tag(
sprintf(
'( %s )( %s )',
$js_function,
wp_json_encode(
array(
'speakMessage' => $speak_message,
'buttonSelector' => 'button#' . $button_unique_id,
),
JSON_HEX_TAG | JSON_UNESCAPED_SLASHES
)
)
);
Comment thread
westonruter marked this conversation as resolved.
exit;
}

Expand Down
24 changes: 16 additions & 8 deletions src/wp-admin/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,17 +470,25 @@ function display_setup_form( $error = null ) {
}

if ( ! wp_is_mobile() ) {
?>
<script>var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
<?php
wp_print_inline_script_tag(
<<<'JS'
var t = document.getElementById( 'weblog_title' );
if ( t ) {
t.focus();
}
JS
);
}

wp_print_scripts( $scripts_to_print );

wp_print_inline_script_tag(
<<<'JS'
jQuery( function( $ ) {
$( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' );
} );
JS
);
?>
<script>
jQuery( function( $ ) {
$( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' );
} );
</script>
</body>
</html>
Loading