@@ -28,21 +28,25 @@ export const head: HeadConfig[] = [
2828 [
2929 'script' ,
3030 { } ,
31- `(function (w, d, s, q, i) {
32- w[q] = w[q] || [];
33- var f = d.getElementsByTagName(s)[0], j = d.createElement(s);
34- j.async = true;
35- j.id = 'beacon-aplus';
36- j.src = 'https://d.alicdn.com/alilog/mlog/aplus/' + i + '.js';
37- f.parentNode.insertBefore(j, f);
38- })(window, document, 'script', 'aplus_queue', '203467608');
39- aplus_queue.push({
40- action: 'aplus.setMetaInfo',
41- arguments: ['appKey', '68234476bc47b67d8364a026']
42- });`
31+ `;(function (w, d, s, q, i) {
32+ w[q] = w[q] || []
33+ const f = d.getElementsByTagName(s)[0],
34+ j = d.createElement(s)
35+ j.async = true
36+ j.id = 'beacon-aplus'
37+ j.src = 'https://d.alicdn.com/alilog/mlog/aplus/' + i + '.js'
38+ j.onerror = function () {
39+ console.warn('警告:友盟统计加载失败,可能已被广告拦截插件拦截。')
40+ }
41+ f.parentNode.insertBefore(j, f)
42+ })(window, document, 'script', 'aplus_queue', '203467608')
43+ aplus_queue.push({
44+ action: 'aplus.setMetaInfo',
45+ arguments: ['appKey', '68234476bc47b67d8364a026']
46+ })`
4347 ] ,
4448
45- /*
49+ /*
4650 增强版导航修复脚本
4751 虽然我也不知道是怎么解决的,但是copilot这样写肯定有它的理由
4852 确实是修复了导航栏的问题
@@ -60,25 +64,25 @@ export const head: HeadConfig[] = [
6064 originalPushState.apply(this, arguments);
6165 fixNavigation();
6266 };
63-
67+
6468 // 监听popstate事件(浏览器后退/前进)
6569 window.addEventListener('popstate', fixNavigation);
66-
70+
6771 // 监听hashchange事件
6872 window.addEventListener('hashchange', fixNavigation);
69-
73+
7074 // 监听页面点击事件,可能触发导航
7175 document.addEventListener('click', (e) => {
7276 // 延迟检查,以捕获可能的导航变化
7377 setTimeout(fixNavigation, 100);
7478 });
75-
79+
7680 // 定期检查导航可见性
7781 setInterval(fixNavigation, 1000);
78-
82+
7983 // 立即执行一次修复
8084 fixNavigation();
81-
85+
8286 // 核心修复函数
8387 function fixNavigation() {
8488 const navbar = document.querySelector('.VPNav');
@@ -87,15 +91,15 @@ export const head: HeadConfig[] = [
8791 navbar.style.display = '';
8892 navbar.style.opacity = '1';
8993 navbar.style.visibility = 'visible';
90-
94+
9195 // 修复logo
9296 const logo = document.querySelector('.VPNavBarTitle');
9397 if (logo) {
9498 logo.style.display = '';
9599 logo.style.opacity = '1';
96100 logo.style.visibility = 'visible';
97101 }
98-
102+
99103 // 检查是否在团队页面
100104 if (window.location.pathname.includes('/About')) {
101105 // 在团队页面上额外处理
@@ -104,14 +108,14 @@ export const head: HeadConfig[] = [
104108 }
105109 }
106110 };
107-
111+
108112 // 在DOMContentLoaded和load事件上都注册修复
109113 if (document.readyState === 'loading') {
110114 window.addEventListener('DOMContentLoaded', initNavFix);
111115 } else {
112116 initNavFix();
113117 }
114-
118+
115119 window.addEventListener('load', initNavFix);
116120 }
117121 `
0 commit comments