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"
|
url: "https://blog.kottedi.in"
|
||||||
|
|
||||||
|
show_drafts: false
|
||||||
|
future: false
|
||||||
|
|
||||||
# Custom configuration
|
# Custom configuration
|
||||||
custom-config:
|
custom-config:
|
||||||
blog-services:
|
blog-services:
|
||||||
|
|||||||
@ -3,6 +3,9 @@ id: 'blog-uat'
|
|||||||
|
|
||||||
url: "https://blog-uat.kottedi.in"
|
url: "https://blog-uat.kottedi.in"
|
||||||
|
|
||||||
|
show_drafts: true
|
||||||
|
future: true
|
||||||
|
|
||||||
# Custom configuration
|
# Custom configuration
|
||||||
custom-config:
|
custom-config:
|
||||||
blog-services:
|
blog-services:
|
||||||
|
|||||||
@ -198,8 +198,8 @@ jekyll-archives:
|
|||||||
tag: /tags/:name/
|
tag: /tags/:name/
|
||||||
category: /categories/:name/
|
category: /categories/:name/
|
||||||
|
|
||||||
show_drafts: false
|
show_drafts: true
|
||||||
future: false
|
future: true
|
||||||
|
|
||||||
|
|
||||||
# Custom configuration
|
# 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}}"
|
<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>
|
data-bs-toggle="tooltip" data-bs-placement="bottom" {% endif %}></i>
|
||||||
|
{% include loader.html id="postcountloader" %}
|
||||||
<em id="visit-count">
|
<em id="visit-count">
|
||||||
</em>
|
</em>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
document.getElementById("postvisitcounter").style.visibility = "hidden";
|
document.getElementById("visit-count").style.display = "none";
|
||||||
|
document.getElementById("postcountloader").style.display = "inline-block";
|
||||||
function ajax(url) {
|
function ajax(url) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
@ -24,7 +26,8 @@
|
|||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
console.log(result); // Code depending on result
|
console.log(result); // Code depending on result
|
||||||
document.getElementById('visit-count').innerText = 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 () {
|
.catch(function () {
|
||||||
// An error occurred
|
// An error occurred
|
||||||
|
|||||||
@ -33,7 +33,7 @@ tail_includes:
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- post counter -->
|
<!-- post counter -->
|
||||||
<div id="postvisitcounter">
|
<div>
|
||||||
<!-- {{ site.data.locales[lang].post.views }} -->
|
<!-- {{ site.data.locales[lang].post.views }} -->
|
||||||
{% include post-counter.html tooltip=true lang=lang %}
|
{% include post-counter.html tooltip=true lang=lang %}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user