blowfish/docs/js/process.min.f61c60504e7e9bc2bed3dade7f854248a97a58a590bc8d3fc30d48ee6de3964be61539e74da6ff53fc55b3cba9de8f221526f5cfe1e21c0328a6b17e3ef76cf6.js
2022-09-15 10:49:36 +01:00

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(t=>{var s,n=t.data();n&&(s=document.querySelectorAll("span[id='"+e+"']")[0].innerText.split(" ")[1],document.querySelectorAll("span[id='"+e+"']")[0].innerText=numberWithCommas(n.views)+" "+s)})},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)})}