From 75fcdab8da4bf9aaf83102f76f9558b3f3317db5 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:16:43 +0200 Subject: [PATCH 1/2] Fix user notes voting selector --- .../js/user-notes-voting.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js b/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js index f3d59fa6e..79f13bcfa 100644 --- a/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js +++ b/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js @@ -1,24 +1,26 @@ /** * Dynamic functionality for voting on user submitted notes. * + * @param $ + * @param wp */ -( function( $, wp ) { - $( '#comments' ).on( 'click', 'a.user-note-voting-up, a.user-note-voting-down', function( event ) { +( function ( $, wp ) { + $( '.comment-list' ).on( 'click', 'a.user-note-voting-up, a.user-note-voting-down', function ( event ) { event.preventDefault(); - var $item = $( this ), + const $item = $( this ), comment = $item.closest( '.comment' ); $.post( wporg_note_voting.ajaxurl, { - action: 'note_vote', - comment: $item.attr( 'data-id' ), - vote: $item.attr( 'data-vote' ), - _wpnonce: $item.parent().attr( 'data-nonce' ) + action: 'note_vote', + comment: $item.attr( 'data-id' ), + vote: $item.attr( 'data-vote' ), + _wpnonce: $item.parent().attr( 'data-nonce' ), }, - function( data ) { + function ( data ) { if ( '0' !== data ) { $item.closest( '.user-note-voting' ).replaceWith( data ); wp.a11y.speak( $( '.user-note-voting-count', comment ).text() ); From 7c64378104601456dc68bd69a6c2112f976c29a6 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Thu, 25 Jul 2024 18:18:51 +0200 Subject: [PATCH 2/2] Remove linting --- .../js/user-notes-voting.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js b/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js index 79f13bcfa..f2fe95f5b 100644 --- a/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js +++ b/source/wp-content/themes/wporg-developer-2023/js/user-notes-voting.js @@ -1,26 +1,24 @@ /** * Dynamic functionality for voting on user submitted notes. * - * @param $ - * @param wp */ -( function ( $, wp ) { - $( '.comment-list' ).on( 'click', 'a.user-note-voting-up, a.user-note-voting-down', function ( event ) { +( function( $, wp ) { + $( '.comment-list' ).on( 'click', 'a.user-note-voting-up, a.user-note-voting-down', function( event ) { event.preventDefault(); - const $item = $( this ), + var $item = $( this ), comment = $item.closest( '.comment' ); $.post( wporg_note_voting.ajaxurl, { - action: 'note_vote', - comment: $item.attr( 'data-id' ), - vote: $item.attr( 'data-vote' ), - _wpnonce: $item.parent().attr( 'data-nonce' ), + action: 'note_vote', + comment: $item.attr( 'data-id' ), + vote: $item.attr( 'data-vote' ), + _wpnonce: $item.parent().attr( 'data-nonce' ) }, - function ( data ) { + function( data ) { if ( '0' !== data ) { $item.closest( '.user-note-voting' ).replaceWith( data ); wp.a11y.speak( $( '.user-note-voting-count', comment ).text() );