diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
index b1f69ea..b5462ae 100644
a
|
b
|
add_action( 'wp_print_footer_scripts', '_wp_footer_scripts' ); |
230 | 230 | add_action( 'init', 'check_theme_switched', 99 ); |
231 | 231 | add_action( 'after_switch_theme', '_wp_sidebars_changed' ); |
232 | 232 | add_action( 'wp_print_styles', 'print_emoji_styles' ); |
| 233 | add_action( 'wp_print_scripts', 'wp_save_early_comment_reply_clicks', 99 ); |
233 | 234 | |
234 | 235 | if ( isset( $_GET['replytocom'] ) ) |
235 | 236 | add_action( 'wp_head', 'wp_no_robots' ); |
diff --git a/src/wp-includes/js/comment-reply.js b/src/wp-includes/js/comment-reply.js
index 2f2e3b3..334356a 100644
a
|
b
|
|
1 | | var addComment = { |
| 1 | window.wp=window.wp||{}; |
| 2 | wp.commentQueue=wp.commentQueue||[]; |
| 3 | window.addComment = { |
| 4 | c : function(){}, |
| 5 | |
| 6 | checkQueue: function(){ |
| 7 | if ( 4 === wp.commentQueue.length ) { |
| 8 | a = wp.commentQueue; |
| 9 | addComment.moveForm(a[0],a[1],a[2],a[3]); |
| 10 | } |
| 11 | wp.commentQueue = []; |
| 12 | }, |
| 13 | |
2 | 14 | moveForm : function(commId, parentId, respondId, postId) { |
3 | 15 | var t = this, div, comm = t.I(commId), respond = t.I(respondId), cancel = t.I('cancel-comment-reply-link'), parent = t.I('comment_parent'), post = t.I('comment_post_ID'); |
4 | 16 | |
… |
… |
var addComment = { |
45 | 57 | return document.getElementById(e); |
46 | 58 | } |
47 | 59 | }; |
| 60 | addComment.checkQueue(); |
| 61 | No newline at end of file |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index 3e55a11..9b36328 100644
a
|
b
|
function wp_just_in_time_script_localization() { |
783 | 783 | } |
784 | 784 | |
785 | 785 | /** |
| 786 | * Save clicks on a comment reply link before the script has loaded |
| 787 | * |
| 788 | * On long comment threads, it's possible a visitor will click a reply link |
| 789 | * before the comment-reply script loads. React gracefully. |
| 790 | * |
| 791 | * @since 4.2 |
| 792 | */ |
| 793 | function wp_save_early_comment_reply_clicks() { |
| 794 | |
| 795 | // check if comment reply script is enqueued |
| 796 | // if so, create a 1second method queue for quick clicks |
| 797 | if ( wp_script_is( 'comment-reply' ) ) { |
| 798 | echo "<script>\n"; |
| 799 | echo "window.wp=window.wp||{};"; |
| 800 | echo "wp.commentQueue = [];"; |
| 801 | echo "window.addComment = { |
| 802 | moveForm : function(a,b,c,d) { wp.commentQueue = [a,b,c,d]; setTimeout( addComment.c, 500 ); return false; }, |
| 803 | c : function() { wp.commentQueue = [];} }\n"; |
| 804 | echo "</script>\n"; |
| 805 | } |
| 806 | |
| 807 | } |
| 808 | |
| 809 | |
| 810 | /** |
786 | 811 | * Administration Screen CSS for changing the styles. |
787 | 812 | * |
788 | 813 | * If installing the 'wp-admin/' directory will be replaced with './'. |