diff --git a/_includes/comments-counter.html b/_includes/comments-counter.html index 7e04d13..a54d833 100644 --- a/_includes/comments-counter.html +++ b/_includes/comments-counter.html @@ -22,7 +22,9 @@ if(Number(comments.innerText) !== NaN){ commentsCount = Number(comments.innerText); } - ajax(serviceUrl + "/UpdatePostCommentsCount?blogUrl=" + siteId + "&postSlug=" + postId, "POST", commentsCount); + if(commentsCount !== commentsCountFromResponse){ + ajax(serviceUrl + "/UpdatePostCommentsCount?blogUrl=" + siteId + "&postSlug=" + postId, "POST", commentsCount); + } }); var config = { childList: true }; observer.observe(target, config); diff --git a/_includes/head.html b/_includes/head.html index 1f01955..fd42199 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -148,6 +148,7 @@ xhr.open(type, url); xhr.setRequestHeader('XApiKey', 'c6eAXYcNT873TT7BfMgQyS4ii7hxa53TLEUN7pAGaaU='); xhr.setRequestHeader('Content-Type', 'application/json'); + xhr.setRequestHeader('ngsw-bypass', ''); xhr.send(JSON.stringify(payload)); }); } diff --git a/_includes/likes-views.html b/_includes/likes-views.html index e4b6c89..336310a 100644 --- a/_includes/likes-views.html +++ b/_includes/likes-views.html @@ -29,6 +29,7 @@ const views = document.getElementById("views-count"); const likes = document.getElementById("likes-count"); const postLikesAndViews = document.getElementById("likes-views"); + var commentsCountFromResponse = 0; postLikesAndViews.style.display = "none"; @@ -60,6 +61,7 @@ if(response.postExists){ views.innerText = response.views; likes.innerText = response.likes; + commentsCountFromResponse = response.comments; postLikesAndViews.style.display = "inline"; } }