!(function () { let t = ["site_pv", "site_uv", "page_pv", "page_uv"], e = document.currentScript, a = e.hasAttribute("pjax"), n = e.getAttribute("data-api") || "https://busuanzi.example.com/api", // 修改为你的域名 i = e.getAttribute("data-prefix") || "busuanzi", r = e.getAttribute("data-style") || "default", o = "bsz-id", s = () => { let e = newXMLHttpRequest(); e.open("POST", n, !0); let a = localStorage.getItem(o); if (a != null) e.setRequestHeader("Authorization", "Bearer " + a); e.setRequestHeader("x-bsz-referer", window.location.href); e.onreadystatechange = function () { if (e.readyState === 4 && e.status === 200) { let a = JSON.parse(e.responseText); if (a.success) { t.forEach((t) => { let e = document.getElementById(`${i}_${t}`); if (e != null) { e.innerHTML = formatNumber(a.data[t], r); } let n = document.getElementById(`${i}_container_${t}`); if (n != null) { n.style.display = "inline"; } }); let n = e.getResponseHeader("Set-Bsz-Identity"); if (n) localStorage.setItem(o, n); } } }; e.send(); };
if (a) { let t = window.history.pushState; window.history.pushState = function () { t.apply(this, arguments); s(); }; window.addEventListener("popstate", s, false); }
functionformatNumber(t, e) { if (e === "comma") return t.toLocaleString(); if (e === "short") { const e = ["", "K", "M", "B", "T"]; let a = Math.floor(Math.log10(t) / 3); return`${Math.round(100 * (t / Math.pow(1e3, a))) / 100}${e[a]}`; } return t.toString(); } })();