UNPKG

hexo-theme-kratos-rebirth

Version:
2 lines (1 loc) 1.4 kB
(()=>{function i(){document.getElementById("kr-share-modal").classList.add("show"),setTimeout(()=>{document.getElementById("kr-share-modal").classList.add("active")},1)}function c(){document.getElementById("kr-share-modal").classList.remove("active"),setTimeout(()=>{document.getElementById("kr-share-modal").classList.remove("show")},300)}function d(e){let o=document.querySelector('meta[property="og:url"]').getAttribute("content"),r=document.querySelector('meta[property="og:title"]').getAttribute("content"),n=document.querySelector('meta[property="og:description"]').getAttribute("content"),a=document.querySelector('meta[property="og:site_name"]').getAttribute("content"),l=e.replaceAll("$URL",o).replaceAll("$TITLE",r).replaceAll("$SUMMARY",n).replaceAll("$SITE",a);window.open(l,"_blank")}function t(){let e=document.getElementById("kr-share-qr");e?(e.innerHTML="",new QRCodeStyling({width:150,height:150,data:document.querySelector('meta[property="og:url"]').getAttribute("content"),image:document.querySelector('link[rel="icon"]').getAttribute("href"),dotsOptions:{color:"#78ce79",type:"extra-rounded"},backgroundOptions:{color:"transparent"},imageOptions:{crossOrigin:"anonymous",margin:1}}).append(e)):requestAnimationFrame(t)}t();window.addEventListener("pjax:complete",t);window.krOpenShareModal=i;window.krCloseShareModal=c;window.krShareModalOpenPlatform=d;window.initQRCode=t;})();