blowfish/public/js/process.min.2166d3adac1679c00a75161830ab5725d3efc0e3d3f8c2453fb01d0907948436c25f0f8a7ad824322fa22f3f9c85fd4d0a1d5c856f53b862157da25a57dc3d52.js
2022-12-31 15:35:21 +00:00

1 line
No EOL
1 KiB
JavaScript

if(typeof auth!="undefined"){var viewsCollection=db.collection("views"),update_views,update_likes,likesCollection=db.collection("likes");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))})},update_likes=function(e,t){likesCollection.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.likes))})},auth.signInAnonymously().then(()=>{var e,t,n,s,o=document.querySelectorAll("span[id^='views_']");for(n in o)e=o[n].id,t=e&&e.replaceAll("/","-"),t&&update_views(e,t);s=document.querySelectorAll("span[id^='likes_']");for(n in s)e=s[n].id,t=e&&e.replaceAll("/","-"),t&&update_likes(e,t)}).catch(e=>{var t=e.code,n=e.message;console.error(t,n)})}