diff --git a/docs/maintenance/FUC_THEME.md b/docs/maintenance/FUC_THEME.md index 69f41b08..a6b5044e 100644 --- a/docs/maintenance/FUC_THEME.md +++ b/docs/maintenance/FUC_THEME.md @@ -219,3 +219,9 @@ Fuc在XB中已是系统主题,不能声称通过后台“上传同名主题” ### 用户中心专属公告 在原生 XB 公告中添加标签 `dashboard-only` 后,FUC 主题将公告放在用户中心的「置顶公告」,从「网站公告」列表过滤。用户中心会跨页查找该标签,其他公告继续按原生排序显示。「最新公告」使用第一条普通公告。 + +## 0.12.12 用户中心教程、下载与侧栏 + +侧栏菜单项在鼠标离开时清除悬停状态,避免收起后保留原版悬停缩进。侧栏和账号菜单的「使用教程」使用福云文档中心。用户中心各平台的「安装教程」直达对应文档,macOS Clash Verge Rev 使用原文档已发布的 `/macos/clash-verge-reg/` 路径。 + +「立即下载」沿用 DPL 的 Resource 固定安装包地址,覆盖 Clash Verge Rev、Hiddify 和 Android Clash Meta。iOS 使用各自的 App Store 页面。Resource 未提供 Clash Nyanpasu,本主题的 Windows x64、macOS Apple Silicon 和 Intel 入口使用其官方对应版本安装包。改动限 Fuc 主题,客户端选择和 XB 接口保持原样。 diff --git a/theme/Fuc/assets/app.mjs b/theme/Fuc/assets/app.mjs index b1d32e15..c2348dd1 100644 --- a/theme/Fuc/assets/app.mjs +++ b/theme/Fuc/assets/app.mjs @@ -1,12 +1,12 @@ import {applyPalette} from './palettes.mjs?v=0.12.6'; import {subscriptionUrl as makeSubscriptionUrl,importUrl} from './subscription.mjs?v=0.12.6'; -import {interactionsReady,paintInteractions,disposeInteractions,showModal,hideModals,toggleCollapse,selectTab,toggleDropdown,notify,scrollTop,scrollSection,toggleMenu,updateMenu,paintScrollTop,authFeedback,confirmSubscriptionReset} from './interactions.mjs?v=0.12.6'; +import {interactionsReady,paintInteractions,disposeInteractions,showModal,hideModals,toggleCollapse,selectTab,toggleDropdown,notify,scrollTop,scrollSection,toggleMenu,updateMenu,paintScrollTop,authFeedback,confirmSubscriptionReset} from './interactions.mjs?v=0.12.12'; import {richText} from './content.mjs?v=0.12.6'; import {copyText} from './clipboard.mjs?v=0.12.6'; import {createCaptcha} from './captcha.mjs?v=0.12.6'; import {showPayment,mountCard} from './payments.mjs?v=0.12.6'; import {beginPageProgress,finishPageProgress} from './progress.mjs?v=0.12.6'; -import {nativeReady,prepareNativeMode,nativeMode,fillPurchaseModal,nativeHeader,nativeFooter,nativeDashboard,nativeHome,nativeAuth,nativeSecondary,paintNativeChart,paintNativeHome} from './native.mjs?v=0.12.11'; +import {nativeReady,prepareNativeMode,nativeMode,fillPurchaseModal,nativeHeader,nativeFooter,nativeDashboard,nativeHome,nativeAuth,nativeSecondary,paintNativeChart,paintNativeHome} from './native.mjs?v=0.12.12'; import {escape as e, money, bytes, date, list, groupedList, periods, orderStates, soldOut, safeUrl, createApi, fetchNotices, routeFromHash,canPurchase} from './core.mjs?v=0.12.11'; const settings = window.fucSettings || {}; const root = document.querySelector('#app'); diff --git a/theme/Fuc/assets/interactions.mjs b/theme/Fuc/assets/interactions.mjs index 445d5d68..16c1b878 100644 --- a/theme/Fuc/assets/interactions.mjs +++ b/theme/Fuc/assets/interactions.mjs @@ -28,10 +28,13 @@ export function paintInteractions(root){ window.Waves.attach(".btn:not([class*='btn-relief-']):not([class*='btn-gradient-']):not([class*='btn-outline-']):not([class*='btn-flat-'])",['waves-float','waves-light']); window.Waves.attach("[class*='btn-outline-']");window.Waves.attach("[class*='btn-flat-']"); $(root).find('[data-toggle="tooltip"]').tooltip({container:'body'}); - root.querySelectorAll('.navigation-main li').forEach(item=>item.addEventListener('mouseenter',()=>{ - root.querySelectorAll('.navigation-main .hover').forEach(n=>n.classList.remove('hover')); - item.classList.add('hover'); - })); + root.querySelectorAll('.navigation-main li').forEach(item=>{ + item.addEventListener('mouseenter',()=>{ + root.querySelectorAll('.navigation-main .hover').forEach(n=>n.classList.remove('hover')); + item.classList.add('hover'); + }); + item.addEventListener('mouseleave',()=>item.classList.remove('hover')); + }); root.querySelectorAll('.main-menu,.navbar-header').forEach(menu=>{ menu.addEventListener('mouseenter',()=>{clearTimeout(hoverTimer);if(innerWidth>=1200)root.querySelectorAll('.main-menu,.navbar-header').forEach(n=>n.classList.add('expanded'));}); menu.addEventListener('mouseleave',()=>{hoverTimer=setTimeout(()=>{if(document.body.classList.contains('menu-collapsed')&&!root.querySelector('.main-menu:hover,.navbar-header:hover'))root.querySelectorAll('.main-menu,.navbar-header').forEach(n=>n.classList.remove('expanded'));},1);}); diff --git a/theme/Fuc/assets/native.mjs b/theme/Fuc/assets/native.mjs index a1351765..444ea822 100644 --- a/theme/Fuc/assets/native.mjs +++ b/theme/Fuc/assets/native.mjs @@ -3,8 +3,10 @@ import {catalogGroups} from './catalog.mjs?v=0.12.6'; import {escape as e,money,bytes,date,safeUrl,soldOut,trafficSummary,canPurchase,orderAmount} from './core.mjs?v=0.12.6'; const base = new URL('./native/',import.meta.url).href; let templates = {},sourceStyles={}; +// Only marked client links on these trusted hosts bypass legacy external-link stripping. +const clientLink=/^https:\/\/(?:doc\.xn--123-9i9dj97q\.com\/|downloads\.gemcook\.net\/downloads\/software\/|apps\.apple\.com\/us\/app\/|github\.com\/libnyanpasu\/clash-nyanpasu\/releases\/download\/)/; const styleReady=fetch(base+'styles.json?v=0.12.6').then(r=>r.json()).then(v=>sourceStyles=v); -export const nativeReady = Promise.all(['footer','header','index','home','login','register','forget','reset','plans','myplan','wallet','invite','profile','tickets','ticket','servers','notices','knowledge','article','faq','orders','purchase','checkout','planlog','walletlog','afflog'].map(async name=>{const r=await fetch(`${base}${name}.html?v=0.12.7`);if(!r.ok)throw Error('原版模板加载失败');templates[name]=await r.text();})).then(()=>styleReady); +export const nativeReady = Promise.all(['footer','header','index','home','login','register','forget','reset','plans','myplan','wallet','invite','profile','tickets','ticket','servers','notices','knowledge','article','faq','orders','purchase','checkout','planlog','walletlog','afflog'].map(async name=>{const r=await fetch(`${base}${name}.html?v=0.12.12`);if(!r.ok)throw Error('原版模板加载失败');templates[name]=await r.text();})).then(()=>styleReady); let nativeSwiper=null,swiperLibrary=null; export async function paintNativeHome(){if(!document.querySelector('.native-public .swiper-container'))return;if(!window.Swiper){if(!swiperLibrary)swiperLibrary=new Promise((resolve,reject)=>{const s=document.createElement('script');s.src=base+'assets/cool/swiper.min.js';s.onload=resolve;s.onerror=reject;document.head.append(s);});await swiperLibrary;}const el=document.querySelector('.native-public .swiper-container');if(!el)return;if(nativeSwiper){try{nativeSwiper.destroy(true,true);}catch{}}el.querySelectorAll('.swiper-slide').forEach(n=>{n.style.removeProperty('display');n.style.removeProperty('width');});el.querySelector('.swiper-wrapper')?.removeAttribute('style');nativeSwiper=new window.Swiper(el,{direction:'horizontal',loop:true,autoplay:{delay:5000,disableOnInteraction:true},navigation:{nextEl:'.swiper-button-next',prevEl:'.swiper-button-prev'}});} let currentMode='',currentStyleMode='',styleSequence=0,chartData=null,chartInstance=null,chartLibrary=null; @@ -61,7 +63,7 @@ function sanitize(raw) { doc.querySelectorAll('*').forEach(n=>{for(const a of [...n.attributes])if(a.name.startsWith('on')||a.name.startsWith('data-cf-'))n.removeAttribute(a.name);}); doc.querySelectorAll('[src]').forEach(n=>{if(n.closest('[data-fuc-richtext]'))return;let src=n.getAttribute('src');if(src==='/fucai192.png')src='/fucai192.png';if(src.startsWith('../theme/'))src=src.slice(2);if(src.startsWith('/')||src.startsWith('assets/cool/'))n.setAttribute('src',base+src.replace(/^\//,''));else if(!src.startsWith('data:'))n.removeAttribute('src');}); doc.querySelectorAll('[style]').forEach(n=>{n.setAttribute('style',n.getAttribute('style').replace(/url\((['"]?)(\/[^)'" ]+)\1\)/g,(_,q,p)=>`url(${base+p.slice(1)})`));}); - doc.querySelectorAll('a[href]').forEach(n=>{if(n.closest('[data-fuc-richtext]'))return;const href=n.getAttribute('href');if(routes[href])n.href=routes[href];else if(/^\/user\/ticket\/[^/]+\/detail$/.test(href))n.href='#/ticket/'+href.split('/')[3];else if(/^\/user\/docs\/[^/]+\/view$/.test(href))n.href='#/knowledge/'+href.split('/')[3];else if(href.startsWith('#/knowledge'))n.href=/^#\/knowledge\/\d+$/.test(href)?href:'#/knowledge';else if(href.startsWith('/clients/')){n.removeAttribute('href');n.dataset.action='native-unavailable';n.title='下载地址尚未接入,请查看安装教程';}else if(href.startsWith('#')&&doc.getElementById(href.slice(1))&&!['pill','tab','collapse','modal'].includes(n.dataset.toggle||n.dataset.bsToggle)){n.dataset.action='section';n.dataset.target=href.slice(1);n.href='#';}else if(href.startsWith('javascript:')||href.startsWith('https:')||href.startsWith('http:')){n.removeAttribute('href');n.dataset.action='native-unavailable';}}); + doc.querySelectorAll('a[href]').forEach(n=>{if(n.closest('[data-fuc-richtext]'))return;const href=n.getAttribute('href');if(n.hasAttribute('data-fuc-client-link')&&clientLink.test(href))return;if(routes[href])n.href=routes[href];else if(/^\/user\/ticket\/[^/]+\/detail$/.test(href))n.href='#/ticket/'+href.split('/')[3];else if(/^\/user\/docs\/[^/]+\/view$/.test(href))n.href='#/knowledge/'+href.split('/')[3];else if(href.startsWith('#/knowledge'))n.href=/^#\/knowledge\/\d+$/.test(href)?href:'#/knowledge';else if(href.startsWith('/clients/')){n.removeAttribute('href');n.dataset.action='native-unavailable';n.title='下载地址尚未接入,请查看安装教程';}else if(href.startsWith('#')&&doc.getElementById(href.slice(1))&&!['pill','tab','collapse','modal'].includes(n.dataset.toggle||n.dataset.bsToggle)){n.dataset.action='section';n.dataset.target=href.slice(1);n.href='#';}else if(href.startsWith('javascript:')||href.startsWith('https:')||href.startsWith('http:')){n.removeAttribute('href');n.dataset.action='native-unavailable';}}); doc.querySelectorAll('[data-toggle="pill"],[data-toggle="tab"]').forEach(n=>{const href=n.getAttribute('href');if(href?.startsWith('#')){n.dataset.action='native-tab';n.dataset.target=href.slice(1);n.href='#';}}); doc.querySelectorAll('[data-toggle="dropdown"]').forEach(n=>{n.dataset.action='native-dropdown';n.removeAttribute('data-toggle');}); doc.querySelectorAll('.icon-sun,.icon-moon').forEach(n=>{if(n.closest('a'))n.closest('a').dataset.action='mode';}); diff --git a/theme/Fuc/assets/native/header.html b/theme/Fuc/assets/native/header.html index 7dc22d1c..2fa44279 100644 --- a/theme/Fuc/assets/native/header.html +++ b/theme/Fuc/assets/native/header.html @@ -106,7 +106,7 @@ 推荐计划
- + 使用教程 常见问题 @@ -167,7 +167,7 @@