blog/_includes/likes-views.html

50 lines
1.4 KiB
HTML

<style>
.heart-icon {
margin-bottom: -41px;
margin-right: -39.5px;
display: inline-flex;
width: 46px;
height: 46px;
transform: translate(-50%, -50%);
background: url("{{ '/assets/img/custom/heart.png' | relative_url }}") no-repeat;
background-position: 0 0;
cursor: pointer;
}
.heart-icon.liked {
animation: like-anim 0.7s steps(28) forwards;
}
@keyframes like-anim {
to {
background-position: right;
}
}
</style>
{% include views.html tooltip=true onload=false lang=lang %}
{% include likes.html tooltip=true onload=false lang=lang %}
<script>
const views = document.getElementById("views-count");
const likes = document.getElementById("likes-count");
const postLikesAndViews = document.getElementById("likes-views");
postLikesAndViews.style.display = "none";
ajax(serviceUrl + "/GetPostLikesAndViews?siteId=" + siteId + "&postId=" + postId)
.then(function (result) {
if (result != "N/A") {
var response = JSON.parse(result);
views.innerText = response.postViews;
likes.innerText = response.postLikes;
postLikesAndViews.style.display = "inline";
}
});
var apiUrl = serviceUrl + "/GetMyLocation";
ajax(apiUrl)
.then(function (result) {
console.log(result);
})
</script>