From 3cef27f4a9e2a4efdf95127a5c4fb58a3799596b Mon Sep 17 00:00:00 2001 From: Vaica <94612053+zqlit@users.noreply.github.com> Date: Fri, 23 Jan 2026 19:18:54 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E5=8D=9C=E7=AE=97=E5=AD=90=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/Ying/assets/js/bsz.js | 30 +++++++++++++++++++++++++++++- themes/Ying/assets/js/mypjax.js | 4 ++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/themes/Ying/assets/js/bsz.js b/themes/Ying/assets/js/bsz.js index 1e653d78..9ba2e042 100644 --- a/themes/Ying/assets/js/bsz.js +++ b/themes/Ying/assets/js/bsz.js @@ -1 +1,29 @@ -!function(){var e=["site_pv","site_uv","page_pv","page_uv"],t=document.currentScript,a=t.hasAttribute("pjax"),n=t.getAttribute("data-api")||"https://bsz.dusays.com:9001/api",i="busuanzi-identity",r=function(){var t=new XMLHttpRequest;t.open("POST",n,!0);var a=localStorage.getItem(i);null!=a&&t.setRequestHeader("Authorization","Bearer "+a);var r=window.location.href;0==window.location.host.indexOf("www.")&&(r=r.replace("www.","")),t.setRequestHeader("x-bsz-referer",r),t.onreadystatechange=function(){if(4===t.readyState&&200===t.status){var a=JSON.parse(t.responseText);if(!0===a.success){e.map((function(e){var t=document.getElementById("busuanzi_value_".concat(e));t&&(t.innerHTML=a.data[e])}));var n=t.getResponseHeader("Set-Bsz-Identity");null!=n&&""!=n&&localStorage.setItem(i,n)}}},t.send()};if(r(),a){var s=window.history.pushState;window.history.pushState=function(){s.apply(this,arguments),r()},window.addEventListener("popstate",(function(e){r()}),!1)}}(); \ No newline at end of file +(function() { + var e = ["site_pv", "site_uv", "page_pv", "page_uv"], + n = "https://bsz.dusays.com:9001/api", + i = "busuanzi-identity"; + + window.bsz_fetch = function() { + var t = new XMLHttpRequest; + t.open("POST", n, !0); + var a = localStorage.getItem(i); + null != a && t.setRequestHeader("Authorization", "Bearer " + a); + var r = window.location.href; + 0 == window.location.host.indexOf("www.") && (r = r.replace("www.", "")), t.setRequestHeader("x-bsz-referer", r), t.onreadystatechange = function() { + if (4 === t.readyState && 200 === t.status) { + var a = JSON.parse(t.responseText); + if (!0 === a.success) { + e.map((function(e) { + var t = document.getElementById("busuanzi_value_".concat(e)); + t && (t.innerHTML = a.data[e]) + })); + var n = t.getResponseHeader("Set-Bsz-Identity"); + null != n && "" != n && localStorage.setItem(i, n) + } + } + }, t.send() + }; + + // Initial fetch + window.bsz_fetch(); +})(); \ No newline at end of file diff --git a/themes/Ying/assets/js/mypjax.js b/themes/Ying/assets/js/mypjax.js index b77691f0..60109f1b 100644 --- a/themes/Ying/assets/js/mypjax.js +++ b/themes/Ying/assets/js/mypjax.js @@ -192,6 +192,10 @@ document.addEventListener("pjax:complete", function () { if (document.querySelector("#Comments") && !isMobile()) { loadBarrager() } + // 重载不蒜子统计 + if (typeof window.bsz_fetch === 'function') { + window.bsz_fetch(); + } });