wordpress-activitypub/assets/js/activitypub-reply.js

36 lines
1.4 KiB
JavaScript
Raw Normal View History

2023-10-01 19:38:37 +02:00
jQuery( function( $ ) {
// Reply from Comment-edit screen & Dashboard.
if ( $('body').hasClass('edit-comments-php') || $('body').hasClass('index-php') ) {
//Insert @mentions into comment content on reply
$( '.comment-inline.button-link' ).on( 'click', function( event ) {
var recipients = $(this).attr('data-recipients') ? $(this).attr('data-recipients') + ' ' : '';
setTimeout(function() {
if ( recipients ){
$('#replycontent').val( recipients )
}
}, 100);
})
//Clear @mentions from content on cancel
$('.cancel.button').on('click', function(){
$('#replycontent').val('');
});
}
// Reply from frontend.
if ( $('body').hasClass('logged-in') && $('body').hasClass('single') ) {
//Insert @mentions into comment content on reply
$( '.comment-reply-link' ).on( 'click', function( event ) {
var recipients = $(this).attr('data-recipients') ? $(this).attr('data-recipients') + ' ' : '';
console.log( 'recipients', recipients )
setTimeout(function() {
if ( recipients ){
$('#respond #comment').val( recipients )
}
}, 100);
})
2023-10-03 01:48:33 +02:00
//Clear @mentions from content on cancel
$('#cancel-comment-reply-link').on('click', function(){
$('#respond #comment').val('');
});
2023-10-01 19:38:37 +02:00
}
} );