mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-02-02 03:22:33 -06:00
parent
5518d77c68
commit
740fc1763f
1 changed files with 3 additions and 0 deletions
|
@ -3,6 +3,7 @@ if (typeof auth !== 'undefined') {
|
|||
var likesCollection = db.collection('likes');
|
||||
|
||||
function numberWithCommas(x) {
|
||||
//return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
}
|
||||
|
||||
|
@ -10,6 +11,7 @@ if (typeof auth !== 'undefined') {
|
|||
viewsCollection.doc(id).onSnapshot(doc => {
|
||||
var data = doc.data();
|
||||
if (data) {
|
||||
//var label = node.innerText.split(' ')[1]
|
||||
node.innerText = numberWithCommas(data.views)
|
||||
}
|
||||
})
|
||||
|
@ -19,6 +21,7 @@ if (typeof auth !== 'undefined') {
|
|||
likesCollection.doc(id).onSnapshot(doc => {
|
||||
var data = doc.data();
|
||||
if (data) {
|
||||
//var label = node.innerText.split(' ')[1]
|
||||
node.innerText = numberWithCommas(data.likes)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue