mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-23 06:55:43 -06:00
Revert "🐛 Fixed error getting views and likes on a Windows built site."
This commit is contained in:
parent
740fc1763f
commit
679f0684b5
1 changed files with 12 additions and 12 deletions
|
@ -7,22 +7,22 @@ if (typeof auth !== 'undefined') {
|
||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
var update_views = function (node, id) {
|
var update_views = function (oid, id) {
|
||||||
viewsCollection.doc(id).onSnapshot(doc => {
|
viewsCollection.doc(id).onSnapshot(doc => {
|
||||||
var data = doc.data();
|
var data = doc.data();
|
||||||
if (data) {
|
if (data) {
|
||||||
//var label = node.innerText.split(' ')[1]
|
var label = document.querySelectorAll("span[id='" + oid + "']")[0].innerText.split(' ')[1]
|
||||||
node.innerText = numberWithCommas(data.views)
|
document.querySelectorAll("span[id='" + oid + "']")[0].innerText = numberWithCommas(data.views)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
var update_likes = function (node, id) {
|
var update_likes = function (oid, id) {
|
||||||
likesCollection.doc(id).onSnapshot(doc => {
|
likesCollection.doc(id).onSnapshot(doc => {
|
||||||
var data = doc.data();
|
var data = doc.data();
|
||||||
if (data) {
|
if (data) {
|
||||||
//var label = node.innerText.split(' ')[1]
|
var label = document.querySelectorAll("span[id='" + oid + "']")[0].innerText.split(' ')[1]
|
||||||
node.innerText = numberWithCommas(data.likes)
|
document.querySelectorAll("span[id='" + oid + "']")[0].innerText = numberWithCommas(data.likes)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -33,20 +33,20 @@ if (typeof auth !== 'undefined') {
|
||||||
var views_nodes = document.querySelectorAll("span[id^='views_']")
|
var views_nodes = document.querySelectorAll("span[id^='views_']")
|
||||||
|
|
||||||
for (var i in views_nodes) {
|
for (var i in views_nodes) {
|
||||||
var node = views_nodes[i]
|
var oid = views_nodes[i].id
|
||||||
var id = node.id ? node.id.replaceAll("/", "-") : node.id
|
var id = oid ? oid.replaceAll("/", "-") : oid
|
||||||
if (id) {
|
if (id) {
|
||||||
update_views(node, id)
|
update_views(oid, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var likes_nodes = document.querySelectorAll("span[id^='likes_']")
|
var likes_nodes = document.querySelectorAll("span[id^='likes_']")
|
||||||
|
|
||||||
for (var i in likes_nodes) {
|
for (var i in likes_nodes) {
|
||||||
var node = likes_nodes[i]
|
var oid = likes_nodes[i].id
|
||||||
var id = node.id ? node.id.replaceAll("/", "-") : node.id
|
var id = oid ? oid.replaceAll("/", "-") : oid
|
||||||
if (id) {
|
if (id) {
|
||||||
update_likes(node, id)
|
update_likes(oid, id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue