Add upstream

This commit is contained in:
root
2019-10-24 00:12:05 +02:00
parent 85d41e4216
commit ac980f592c
3504 changed files with 1049983 additions and 29971 deletions

View File

@@ -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: #72777c;
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: #0073aa;
}
.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;
}
}

View File

@@ -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();
} );