// 修复内部链接 - 强制使用完整页面跳转而不是Next.js客户端路由 (function() { const fixInternalLinks = () => { // 查找所有需要强制刷新的内部链接 const links = document.querySelectorAll('a[href*="classschedule"], a[href*="contacts"], a[href*="accelerated-cloud-platform"]'); links.forEach(link => { // 避免重复添加监听器 if (link.dataset.forceReload) return; link.dataset.forceReload = 'true'; // 移除 Next.js 的客户端路由处理 link.addEventListener('click', function(e) { const href = this.getAttribute('href'); // 如果是内部页面链接,使用完整页面跳转 if (href && (href.includes('classschedule') || href.includes('contacts') || href.includes('accelerated-cloud-platform'))) { e.preventDefault(); e.stopPropagation(); // 强制完整页面跳转 window.location.href = href; } }, true); // 使用捕获阶段,优先于Next.js的处理 }); }; // 页面加载完成后执行 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', fixInternalLinks); } else { fixInternalLinks(); } // 监听DOM变化,处理动态添加的链接 const observer = new MutationObserver(fixInternalLinks); if (document.body) { observer.observe(document.body, { childList: true, subtree: true }); } else { document.addEventListener('DOMContentLoaded', () => { observer.observe(document.body, { childList: true, subtree: true }); }); } })();