mirror of
https://github.com/nunocoracao/blowfish.git
synced 2025-01-23 15:05:38 -06:00
1 line
No EOL
649 B
JavaScript
1 line
No EOL
649 B
JavaScript
if(typeof auth!='undefined'){var viewsCollection=db.collection('views'),update_views;function numberWithCommas(e){return e.toString().replace(/\B(?=(\d{3})+(?!\d))/g,',')}update_views=function(e,t){viewsCollection.doc(t).onSnapshot(s=>{var n,t=s.data();t&&(n=document.querySelectorAll("span[id='"+e+"']")[0].innerText.split(' ')[1],document.querySelectorAll("span[id='"+e+"']")[0].innerText=numberWithCommas(t.views)+" "+n)})},auth.signInAnonymously().then(()=>{var e,t,s,n=document.querySelectorAll("span[id^='views_']");for(s in n)e=n[s].id,t=e&&e.replaceAll("/","-"),t&&update_views(e,t)}).catch(e=>{var t=e.code,n=e.message;console.error(t,n)})} |