This commit is contained in:
emmymayo
2025-02-05 23:15:46 +01:00
commit 7269c99357
16995 changed files with 3389680 additions and 0 deletions
@@ -0,0 +1,45 @@
.fixed .column-comment_likes {
width: 5.5em;
padding: 8px 0;
text-align: center;
}
.fixed .column-stats {
width: 5em;
}
.fixed .column-comment_likes .comment-like-count {
box-sizing: border-box;
display: inline-block;
padding: 0 8px;
height: 2em;
margin-top: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
background-color: #787c82;
color: #fff;
font-size: 11px;
line-height: 21px;
}
.fixed .column-comment_likes .comment-like-count:after {
border: none;
}
.fixed .column-comment_likes .comment-like-count:hover {
background-color: #2271b1;
}
.fixed .column-comment_likes .vers:before {
font: normal 20px/1 dashicons;
content: '\f155';
speak: none;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
@media screen and (max-width: 782px) {
.fixed .column-comment_likes {
display: none;
}
}
@@ -0,0 +1,42 @@
jQuery( document ).ready( function ( $ ) {
var jsonAPIbase = 'https://public-api.wordpress.com/rest/v1',
APIqueue = [];
function getCommentLikeCounts() {
$( '.comment-like-count' ).each( function () {
var blogId = $( this ).attr( 'data-blog-id' ),
commentId = $( this ).attr( 'data-comment-id' );
APIqueue.push( '/sites/' + blogId + '/comments/' + commentId + '/likes' );
} );
return $.ajax( {
type: 'GET',
url: jsonAPIbase + '/batch',
dataType: 'jsonp',
data: 'urls[]=' + APIqueue.map( encodeURIComponent ).join( '&urls[]=' ),
success: function ( response ) {
for ( var path in response ) {
if ( ! response[ path ].error_data ) {
var urlPieces = path.split( '/' ),
commentId = urlPieces[ 4 ],
likeCount = response[ path ].found;
if ( likeCount < 1 ) {
return;
}
$( '#comment-like-count-' + commentId )
.find( '.like-count' )
.hide()
.text( likeCount )
.fadeIn();
}
}
},
error: function () {},
} );
}
getCommentLikeCounts();
} );