1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| ! 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.butlanys.de/api", i = e.getAttribute("data-prefix") || "busuanzi", r = e.getAttribute("data-style") || "default", o = "bsz-id", s = () => { let e = new XMLHttpRequest; e.open("POST", n, !0); let a = localStorage.getItem(o); null != a && e.setRequestHeader("Authorization", "Bearer " + a), e.setRequestHeader("x-bsz-referer", window.location.href), e.onreadystatechange = function() { if (4 === e.readyState && 200 === e.status) { let a = JSON.parse(e.responseText); if (!0 === a.success) { t.map((t => { let elem = document.getElementById(`${i}_value_${t}`); if (elem) { elem.innerHTML = formatValue(a.data[t], r) } let n = document.getElementById(`${i}_container_${t}`); if (n) { n.style.display = "inline" } })); let n = e.getResponseHeader("Set-Bsz-Identity"); null != n && "" != n && localStorage.setItem(o, n) } } }, e.send() };
function formatValue(t, e = "default") { if ("comma" === e) return t.toLocaleString(); if ("short" === e) { const e = ["", "K", "M", "B", "T"]; let a = Math.floor(Math.log10(t) / 3); return t /= Math.pow(1e3, a), `${Math.round(100*t)/100}${e[a]}` } return t.toString() } if (s(), a) { let t = window.history.pushState; window.history.pushState = function() { t.apply(this, arguments), s() }, window.addEventListener("popstate", (function(t) { s() }), !1) } }();
|