added loader to the view count and some code refactoring
This commit is contained in:
parent
fd8c860d35
commit
dd616fda41
@ -3,6 +3,9 @@ id: 'blog'
|
||||
|
||||
url: "https://blog.kottedi.in"
|
||||
|
||||
show_drafts: false
|
||||
future: false
|
||||
|
||||
# Custom configuration
|
||||
custom-config:
|
||||
blog-services:
|
||||
|
||||
@ -3,6 +3,9 @@ id: 'blog-uat'
|
||||
|
||||
url: "https://blog-uat.kottedi.in"
|
||||
|
||||
show_drafts: true
|
||||
future: true
|
||||
|
||||
# Custom configuration
|
||||
custom-config:
|
||||
blog-services:
|
||||
|
||||
@ -198,8 +198,8 @@ jekyll-archives:
|
||||
tag: /tags/:name/
|
||||
category: /categories/:name/
|
||||
|
||||
show_drafts: false
|
||||
future: false
|
||||
show_drafts: true
|
||||
future: true
|
||||
|
||||
|
||||
# Custom configuration
|
||||
|
||||
1
_includes/loader.html
Normal file
1
_includes/loader.html
Normal file
@ -0,0 +1 @@
|
||||
<i id="{{include.id}}" class="fa-solid fa-circle-notch fa-spin"></i>
|
||||
@ -1,10 +1,12 @@
|
||||
<i class="fa fa-eye fa-fw me-1" {% 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="postcountloader" %}
|
||||
<em id="visit-count">
|
||||
</em>
|
||||
|
||||
<script>
|
||||
document.getElementById("postvisitcounter").style.visibility = "hidden";
|
||||
document.getElementById("visit-count").style.display = "none";
|
||||
document.getElementById("postcountloader").style.display = "inline-block";
|
||||
function ajax(url) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
@ -24,7 +26,8 @@
|
||||
.then(function (result) {
|
||||
console.log(result); // Code depending on result
|
||||
document.getElementById('visit-count').innerText = result;
|
||||
document.getElementById("postvisitcounter").style.visibility = "visible";
|
||||
document.getElementById("postcountloader").style.display = "none";
|
||||
document.getElementById("visit-count").style.display = "inline-block";
|
||||
})
|
||||
.catch(function () {
|
||||
// An error occurred
|
||||
|
||||
@ -33,7 +33,7 @@ tail_includes:
|
||||
</div>
|
||||
|
||||
<!-- post counter -->
|
||||
<div id="postvisitcounter">
|
||||
<div>
|
||||
<!-- {{ site.data.locales[lang].post.views }} -->
|
||||
{% include post-counter.html tooltip=true lang=lang %}
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user