diff --git a/src/components/Comment/Comment.less b/src/components/Comment/Comment.less index 37b7d1c..2aca3b5 100644 --- a/src/components/Comment/Comment.less +++ b/src/components/Comment/Comment.less @@ -1,6 +1,6 @@ .vh-comment { box-sizing: border-box; - padding: 2rem 1rem 1rem; + padding: 2rem 1rem 2.88rem; width: 100%; height: max-content; border-radius: 0.5rem; @@ -401,7 +401,7 @@ // 图片 img { - &:not(.wl-user-avatar, .wl-reaction-list img) { + &:not(.wl-user-avatar, .wl-reaction-list img,.wl-panel img) { max-height: 66px; object-fit: contain; cursor: zoom-in; diff --git a/src/scripts/Comment.ts b/src/scripts/Comment.ts index 44a5210..869baaf 100644 --- a/src/scripts/Comment.ts +++ b/src/scripts/Comment.ts @@ -14,7 +14,16 @@ const WalineFn = async (commentDOM: string, walineInit: any) => { import('@waline/client/waline.css'); import('@waline/client/waline-meta.css'); const { init } = await import('@waline/client'); - walineInit = init({ el: commentDOM, serverURL: SITE_INFO.Comment.Waline.serverURL }); + walineInit = init({ + el: commentDOM, serverURL: SITE_INFO.Comment.Waline.serverURL, emoji: ['https://registry.npmmirror.com/@waline/emojis/1.3.0/files/alus', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/bilibili', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/bmoji', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/qq', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/tieba', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/weibo', 'https://registry.npmmirror.com/@waline/emojis/1.3.0/files/soul-emoji'], + imageUploader: async (file: any) => { + const body = new FormData(); + body.append('file', file); + const res = await fetch("https://wp-cdn.4ce.cn/upload", { method: "POST", body }); + const resJson = await res.json(); + return resJson.data.link.replace('i.imgur.com', 'wp-cdn.4ce.cn/v2'); + } + }); } // 检查是否开启评论 @@ -26,10 +35,11 @@ const checkComment = () => { // 初始化评论插件 const commentInit = async (key: string, walineInit: any) => { - // 评论列表 - const CommentList: any = { TwikooFn, WalineFn }; // 评论 DOM const commentDOM = '.vh-comment>section' + if (!document.querySelector(commentDOM)) return; + // 评论列表 + const CommentList: any = { TwikooFn, WalineFn }; // 初始化评论 CommentList[`${key}Fn`](commentDOM, walineInit); } diff --git a/src/scripts/Friends.ts b/src/scripts/Friends.ts index c1d00de..e9c17f0 100644 --- a/src/scripts/Friends.ts +++ b/src/scripts/Friends.ts @@ -1,5 +1,5 @@ -import vh from 'vh-plugin' +import vh from 'vh-plugin'; import { fmtDate } from '@/utils/index' import { $GET } from '@/utils/index' // 图片懒加载 diff --git a/src/scripts/ViewImage.ts b/src/scripts/ViewImage.ts index 003aa55..bef31a1 100644 --- a/src/scripts/ViewImage.ts +++ b/src/scripts/ViewImage.ts @@ -10,7 +10,7 @@ const ViewImgList: string[] = [ // Twikoo 评论区图片 ".vh-comment>.twikoo>.tk-comments img:not(.tk-avatar-img,.tk-owo-emotion,.OwO-item img)", // Waline 评论区图片 - ".vh-comment div[data-waline] img:not(.wl-user-avatar,.wl-avatar img,.wl-reaction-list img)" + ".vh-comment div[data-waline] img:not(.wl-user-avatar,.wl-avatar img,.wl-reaction-list img,.wl-panel img)" ]; // 初始化 export default async () => {