@@ -538,7 +538,6 @@ window.addEventListener("load", ()=>{
538538 setupBackToTop ( ) ;
539539 setupFadeInAnimations ( ) ;
540540 setupActiveNav ( ) ;
541- setupVisitorCounter ( ) ;
542541} ) ;
543542
544543/* ===== Hero video interactions ===== */
@@ -1081,150 +1080,4 @@ function setupFadeInAnimations(){
10811080 } ) ;
10821081
10831082 elements . forEach ( el => observer . observe ( el ) ) ;
1084- }
1085-
1086- /* ===== Busuanzi Visitor Counter (Owner Only) ===== */
1087- function setupVisitorCounter ( ) {
1088- const OWNER_PASSWORD = "rise123" ; // 修改为你自己的密码
1089-
1090- // 创建统计面板
1091- function createStatsPanel ( ) {
1092- const panel = document . createElement ( 'div' ) ;
1093- panel . id = 'visitorStatsPanel' ;
1094- panel . style . cssText = `
1095- position: fixed;
1096- bottom: 20px;
1097- right: 20px;
1098- background: white;
1099- border: 2px solid #5b7cfa;
1100- border-radius: 12px;
1101- padding: 20px;
1102- max-width: 350px;
1103- box-shadow: 0 4px 20px rgba(0,0,0,0.2);
1104- z-index: 9999;
1105- font-family: system-ui, -apple-system, Segoe UI;
1106- font-size: 14px;
1107- display: none;
1108- ` ;
1109- panel . innerHTML = `
1110- <div style="margin-bottom: 16px; font-weight: 700; font-size: 16px; color: #5b7cfa; border-bottom: 2px solid #e6e6e6; padding-bottom: 10px;">📊 访客统计(不蒜子)</div>
1111- <div style="margin-bottom: 8px; color: #333; line-height: 1.8;">
1112- <div style="margin-bottom: 8px; display: flex; justify-content: space-between;">
1113- <span>🌐 本站总访问量:</span>
1114- <strong style="color: #5b7cfa;"><span id="busuanzi_value_site_pv">--</span> 次</strong>
1115- </div>
1116- <div style="margin-bottom: 8px; display: flex; justify-content: space-between;">
1117- <span>👥 本站访客数:</span>
1118- <strong style="color: #5b7cfa;"><span id="busuanzi_value_site_uv">--</span> 人</strong>
1119- </div>
1120- <div style="margin-bottom: 8px; display: flex; justify-content: space-between;">
1121- <span>📄 本页访问量:</span>
1122- <strong style="color: #5b7cfa;"><span id="busuanzi_value_page_pv">--</span> 次</strong>
1123- </div>
1124- </div>
1125- <div style="margin-top: 12px; padding: 8px; background: #f5f5f5; border-radius: 6px; font-size: 12px;">
1126- <div style="color: #666;">状态: <span id="busuanzi_status" style="color: #5b7cfa;">检测中...</span></div>
1127- </div>
1128- <div style="margin-top: 12px; padding-top: 12px; border-top: 1px solid #e6e6e6; font-size: 12px; color: #999;">
1129- 统计数据由 <a href="http://busuanzi.ibruce.info/" target="_blank" style="color: #5b7cfa;">不蒜子</a> 提供
1130- </div>
1131- <div style="display: flex; gap: 8px; margin-top: 12px;">
1132- <button id="refreshStats" style="flex: 1; padding: 10px; background: #4caf50; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;">🔄 刷新</button>
1133- <button id="closeStats" style="flex: 1; padding: 10px; background: #5b7cfa; color: white; border: none; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;">关闭</button>
1134- </div>
1135- ` ;
1136- document . body . appendChild ( panel ) ;
1137-
1138- // 关闭按钮
1139- document . getElementById ( 'closeStats' ) . addEventListener ( 'click' , ( ) => {
1140- panel . style . display = 'none' ;
1141- } ) ;
1142-
1143- // 刷新按钮
1144- document . getElementById ( 'refreshStats' ) . addEventListener ( 'click' , ( ) => {
1145- // 重新加载不蒜子脚本
1146- const oldScript = document . querySelector ( 'script[src*="busuanzi"]' ) ;
1147- if ( oldScript ) {
1148- oldScript . remove ( ) ;
1149- }
1150-
1151- const newScript = document . createElement ( 'script' ) ;
1152- newScript . async = true ;
1153- newScript . src = 'https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js' ;
1154- document . body . appendChild ( newScript ) ;
1155-
1156- // 更新状态
1157- const statusEl = document . getElementById ( 'busuanzi_status' ) ;
1158- if ( statusEl ) {
1159- statusEl . textContent = '🔄 正在刷新...' ;
1160- }
1161-
1162- // 3秒后检查状态
1163- setTimeout ( ( ) => {
1164- const status = checkBusuanziStatus ( ) ;
1165- if ( statusEl ) {
1166- statusEl . textContent = status ;
1167- }
1168- } , 3000 ) ;
1169- } ) ;
1170-
1171- return panel ;
1172- }
1173-
1174- // 检查不蒜子是否加载
1175- function checkBusuanziStatus ( ) {
1176- const pv = document . getElementById ( 'busuanzi_value_site_pv' ) ;
1177- const uv = document . getElementById ( 'busuanzi_value_site_uv' ) ;
1178- const ppv = document . getElementById ( 'busuanzi_value_page_pv' ) ;
1179-
1180- if ( typeof window . busuanzi !== 'undefined' ) {
1181- return '✅ 已加载' ;
1182- } else if ( pv && pv . textContent && pv . textContent !== '--' ) {
1183- return '✅ 数据正常' ;
1184- } else {
1185- return '⏳ 加载中...(可能需要等待30秒-1分钟)' ;
1186- }
1187- }
1188-
1189- // 打开统计面板(需要密码)
1190- function showStatsPanel ( ) {
1191- const pwd = prompt ( '请输入访客统计密码:' ) ;
1192- if ( pwd === OWNER_PASSWORD ) {
1193- const panel = document . getElementById ( 'visitorStatsPanel' ) || createStatsPanel ( ) ;
1194- panel . style . display = 'block' ;
1195-
1196- // 检查加载状态
1197- setTimeout ( ( ) => {
1198- const status = checkBusuanziStatus ( ) ;
1199- const statusEl = document . getElementById ( 'busuanzi_status' ) ;
1200- if ( statusEl ) {
1201- statusEl . textContent = status ;
1202- }
1203-
1204- // 如果还是 -- 就提示刷新
1205- const pv = document . getElementById ( 'busuanzi_value_site_pv' ) ;
1206- if ( pv && ( pv . textContent === '--' || ! pv . textContent ) ) {
1207- pv . textContent = '等待中...' ;
1208- }
1209- } , 1000 ) ;
1210- } else if ( pwd !== null ) {
1211- alert ( '密码错误!' ) ;
1212- }
1213- }
1214-
1215- window . showStatsPanel = showStatsPanel ;
1216-
1217- // 绑定按钮
1218- const statsBtn = document . getElementById ( 'statsBtn' ) ;
1219- if ( statsBtn ) {
1220- statsBtn . addEventListener ( 'click' , showStatsPanel ) ;
1221- }
1222-
1223- // 添加快捷键:Ctrl+Shift+S 打开统计
1224- document . addEventListener ( 'keydown' , ( e ) => {
1225- if ( e . ctrlKey && e . shiftKey && e . code === 'KeyS' ) {
1226- e . preventDefault ( ) ;
1227- showStatsPanel ( ) ;
1228- }
1229- } ) ;
12301083}
0 commit comments