27 lines
975 B
HTML
27 lines
975 B
HTML
<i class="fa fa-eye fa-fw" {% if include.tooltip %} title="{{site.data.locales[include.lang].post.views}}"
|
|
data-bs-toggle="tooltip" data-bs-placement="bottom" {% endif %}></i>
|
|
{% include loader.html id="views-loader" style="margin-right: 12px" %}
|
|
<em id="views-count" style="margin-right: 12px">
|
|
</em>
|
|
|
|
<script>
|
|
const viewsCount = document.getElementById("views-count");
|
|
const viewsLoader = document.getElementById("views-loader");
|
|
|
|
viewsCount.style.display = "none";
|
|
viewsLoader.style.display = "inline-block";
|
|
|
|
ajax(serviceUrl + "/GetPostViews?siteId=" + siteId + "&postId=" + postId)
|
|
.then(function (result) {
|
|
viewsCount.innerText = result;
|
|
viewsLoader.style.display = "none";
|
|
viewsCount.style.display = "inline-block";
|
|
})
|
|
.catch(function () {
|
|
viewsLoader.style.display = "none";
|
|
viewsCount.style.display = "inline-block";
|
|
});
|
|
</script>
|
|
|
|
<!-- <script src="{{ '/assets/js/views.js' | relative_url }}">
|
|
</script> --> |