Ticket #1819: 1819.2.patch
File 1819.2.patch, 2.0 KB (added by , 9 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/user-content-voting.php
64 64 public static function scripts_and_styles() { 65 65 // Only need to enqueue voting-related resources if there are comments to vote on. 66 66 if ( self::user_can_vote() && is_singular() && '0' != get_comments_number() ) { 67 wp_register_script( 'wporg-developer-user-notes-voting', get_template_directory_uri() . '/js/user-notes-voting.js', array( ), '20160623', true );67 wp_register_script( 'wporg-developer-user-notes-voting', get_template_directory_uri() . '/js/user-notes-voting.js', array( 'wp-a11y' ), '20160623', true ); 68 68 wp_localize_script( 'wporg-developer-user-notes-voting', 'ajaxurl', admin_url( 'admin-ajax.php' ) ); 69 69 wp_enqueue_script( 'wporg-developer-user-notes-voting' ); 70 70 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/user-notes-voting.js
8 8 e.preventDefault(); 9 9 10 10 var item = $(this); 11 var comment = item.closest( '.comment' ); 11 12 12 13 $.post(ajaxurl, { 13 14 action: "note_vote", … … 17 18 }, function(data) { 18 19 if ("0" != data) { 19 20 item.closest('.user-note-voting').replaceWith(data); 21 var updated_count = $( '.user-note-voting-count', comment ).text(); 22 23 if ( updated_count.length && ( wp.a11y !== undefined ) ) { 24 wp.a11y.speak( updated_count ); 25 } 20 26 } 21 27 }, "text" 22 28 );