Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vitepress/config/cn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const cn = defineConfig({
],
},
{
text: '其它',
items: [
{ text: '关于 P2P', link: '/guide/aboutp2p' },
{ text: '性能测试', link: '/guide/perf' },
Expand Down
3 changes: 3 additions & 0 deletions .vitepress/config/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ export const en = defineConfig({
{ text: 'EasyTier Manager', link: '/en/guide/gui/easytier-manager' },
{ text: 'EasyTier Game Launcher', link: '/en/guide/gui/easytier-game' },
{ text: 'Astral Game Connection Tool', link: '/en/guide/gui/astral-game' },
{ text: 'EasyTier for HarmonyOS', link: '/en/guide/gui/easytier-harmonyos' },
],
},
{
text: 'Others',
items: [
{ text: 'About P2P', link: '/en/guide/aboutp2p' },
{ text: 'Performance Testing', link: '/en/guide/perf' },
{ text: 'Roadmap', link: '/en/guide/roadmap' },
{ text: 'Community and Contribution', link: '/en/guide/community-and-contribution' },
Expand Down
43 changes: 43 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,47 @@ import Layout from './layout.vue'
import '@theojs/lumen/theme'
import '@theojs/lumen/doc-blocks-border'

/**
* Add noopener to links with text fragments
*/
function initNoopenerLinks() {
if (typeof window === 'undefined')
return

const processLinks = () => {
document.querySelectorAll('a').forEach((link) => {
const href = link.getAttribute('href')
// Add noopener to links with text fragments
if (href && href.includes(':~:text=')) {
const rel = link.getAttribute('rel') || ''
if (!rel.includes('noopener')) {
const newRel = rel ? `${rel} noopener` : 'noopener'
link.setAttribute('rel', newRel.trim())
}
const target = link.getAttribute('target') || ''
if (!target) {
link.setAttribute('target', '_blank')
}
}
})
}

// Process links on load
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', processLinks)
}
else {
processLinks()
}

// Process dynamically added links
const observer = new MutationObserver(processLinks)
observer.observe(document.body, {
childList: true,
subtree: true,
})
}

export default {
extends: DefaultTheme,
Layout,
Expand All @@ -17,6 +58,8 @@ export default {
baiduAnalytics({ baiduId: '0afa8cd5bd78fd0c960f8af5dc6af333' })
if (typeof window !== 'undefined') {
trackPageview('0afa8cd5bd78fd0c960f8af5dc6af333', window.location.href)
// Initialize noopener for text fragment links
initNoopenerLinks()
}

app.component('Home', HomeUnderline)
Expand Down
24 changes: 18 additions & 6 deletions .vitepress/theme/layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,27 @@ footer.VPFooter {

.download-link-span {
display: inline-block;
margin: 0.1rem;
color: #666 !important;
border: 1px solid #666;
padding: 0.1rem 0.3rem;
background-color: #f0f0f0;
margin: 0.25rem 0.15rem;
color: #fff !important;
border: none;
padding: 0.3rem 0.6rem;
background: linear-gradient(135deg, #05b08e 0%, #048a6f 100%);
text-decoration: none !important;
border-radius: 6px;
font-size: 0.9em;
font-weight: 500;
transition: all 0.3s ease;
box-shadow: 0 2px 8px rgba(5, 176, 142, 0.2);
}

.download-link-span:hover {
background-color: #e0e0e0;
background: linear-gradient(135deg, #048a6f 0%, #036b59 100%);
box-shadow: 0 4px 12px rgba(5, 176, 142, 0.35);
transform: translateY(-2px);
}

.download-link-span:active {
transform: translateY(0);
box-shadow: 0 2px 4px rgba(5, 176, 142, 0.2);
}
</style>
Loading