Skip to content

Commit

Permalink
[U] (Read Changelog)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinxin2021 committed May 19, 2024
1 parent 783d62f commit 4164598
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 2 deletions.
10 changes: 9 additions & 1 deletion .vitepress/theme/CustomLayout.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script setup>
import DefaultTheme from 'vitepress/theme'
import { useData } from 'vitepress';
import Twikoo from './Twikoo.vue';
const { frontmatter } = useData()
const { Layout } = DefaultTheme
Expand Down Expand Up @@ -48,6 +48,14 @@ const { Layout } = DefaultTheme
</div>
</div>
</template>
<template #home-features-after>
<div class="home-comment-container">
<Twikoo></Twikoo>
</div>
</template>
<template #doc-after>
<Twikoo></Twikoo>
</template>
</Layout>
</template>

Expand Down
75 changes: 75 additions & 0 deletions .vitepress/theme/Twikoo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<script setup>
import { ref, onMounted } from 'vue'
import { useRouter } from 'vitepress'
// twikoojs/twikoo -> docs/.vitepress/theme/Twikoo.vue
const envId = 'https://twikoo.gbt.gteh.top'
const twikooJs = ref(null)
const router = useRouter()
function initTwikoo () {
try {
twikoo.init({
envId,
onCommentLoaded: initLightGallery
})
} catch (e) {}
}
function initLightGallery () {
var commentContents = [
...document.getElementsByClassName('vp-doc'),
...document.getElementsByClassName('tk-content')
];
for (var i = 0; i < commentContents.length; i++) {
var commentItem = commentContents[i];
var imgEls = commentItem.getElementsByTagName('img');
if (imgEls.length > 0) {
for (var j = 0; j < imgEls.length; j++) {
var imgEl = imgEls[j];
if (imgEl.parentElement.tagName === 'A') continue;
var aEl = document.createElement('a');
aEl.setAttribute('class', 'tk-lg-link');
aEl.setAttribute('href', imgEl.getAttribute('src'));
aEl.setAttribute('data-src', imgEl.getAttribute('src'));
aEl.appendChild(imgEl.cloneNode(false));
imgEl.parentNode.insertBefore(aEl, imgEl.nextSibling);
imgEl.remove();
}
lightGallery(commentItem, {
selector: '.tk-lg-link',
share: false
})
}
}
}
function initJs () {
if (twikooJs.value) {
twikooJs.value.onload = initTwikoo
router.onAfterRouteChanged = onRoute
}
}
function onRoute (to) {
if (to) setTimeout(initTwikoo, 1000)
}
onMounted(() => {
initTwikoo()
initJs()
})
</script>

<template>
<div class="comment-container vp-raw">
<!-- lightGallery -->
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/lightgallery@2.1.8/css/lightgallery.css">
<component :is="'script'" src="//cdn.jsdelivr.net/npm/lightgallery@2.1.8/lightgallery.min.js"></component>

<!-- Twikoo -->
<div id="twikoo"></div>
<component :is="'script'" src="//cdn.jsdelivr.net/npm/twikoo@1.6.34/dist/twikoo.min.js" ref="twikooJs"></component>
</div>
</template>
4 changes: 4 additions & 0 deletions auth/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

违反 QQ 相关规定、群规定等造成的后果不由本人承担。

## 官网 <Badge type="info" text="快速通道" />

在本页面评论后等待审核通过。

## MTRBBS <Badge type="info" text="快速通道" />

[MTRBBS 介绍帖](//www.mtrbbs.top/thread-6274-1-1.html)中回复帖子后等待回复。
Expand Down
7 changes: 6 additions & 1 deletion update.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,9 @@ next: false
- 鸣谢页面添加了 QuiltMC 和 NeoForged,原 Forge & Fabric 更改
- 下载页面样式更新
- 下载页面去除 WIP 标记
- 首页添加下载按钮 (在介绍与授权中间)
- 首页添加下载按钮 (在介绍与授权中间)

### 2024.5.19

- 添加了 [Twikoo](//twikoo.js.org) 评论区
- 授权方式添加了官网

0 comments on commit 4164598

Please sign in to comment.