From 1942e5891b94c51e2bf28d37e253ad80779ae5f4 Mon Sep 17 00:00:00 2001 From: b1xcy Date: Thu, 31 Oct 2024 16:57:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=A4=8D=E5=88=B6?= =?UTF-8?q?=E6=97=B6=E5=B0=8F=E4=BA=8E=E8=87=AA=E5=AE=9A=E4=B9=89=E5=AD=97?= =?UTF-8?q?=E6=95=B0=E7=9A=84=E6=97=B6=E5=80=99=E4=B8=8D=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=89=88=E6=9D=83=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _config.yml | 8 ++++---- scripts/generaters/script.ts | 3 +++ source/js/_app/library/declare.d.ts | 3 +++ source/js/_app/page/post.ts | 4 ++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/_config.yml b/_config.yml index 45d27b8..ceb3e14 100644 --- a/_config.yml +++ b/_config.yml @@ -33,6 +33,7 @@ experiments: enableCover: true # 是否开启头图 enablePreload: true #是否开启预加载头图 enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面 + copyrightLength: 50 # 自定义复制时显示copyright的长度 homeConfig: gradient: false # 使用CSS渐变作为文章封面 @@ -101,13 +102,13 @@ polyfill: # 参阅 https://github.com/D-Sketon/mouse-firework fireworks: enable: true - options: + options: excludeElements: ["a"] particles: - shape: circle move: ["emit"] easing: easeOutExpo - colors: + colors: - "rgba(255,182,185,.9)" - "rgba(250,227,217,.9)" - "rgba(187,222,214,.9)" @@ -227,7 +228,6 @@ summary: remote: "https://api.openai.com" apikey: "key" - # Social Links # Usage: `Key: permalink || icon || color` # Key is the link label showing to end users. @@ -403,4 +403,4 @@ vendors: justifiedGallery: source: cdnjs url: justifiedGallery/3.8.1/css/justifiedGallery.min.css - sri: "sha384-V/1Ew9pYm8xpy/L9i078ZXT6HSEOrGC6KNFYLbXOdtqb3+c6brpGqVzZtEPSQOiz" \ No newline at end of file + sri: "sha384-V/1Ew9pYm8xpy/L9i078ZXT6HSEOrGC6KNFYLbXOdtqb3+c6brpGqVzZtEPSQOiz" diff --git a/scripts/generaters/script.ts b/scripts/generaters/script.ts index 52ea094..5c12f65 100644 --- a/scripts/generaters/script.ts +++ b/scripts/generaters/script.ts @@ -45,6 +45,9 @@ hexo.extend.generator.register('script', function (locals) { priority: theme.quicklink.priority }, playerAPI: theme.playerAPI, + experiments: { + copyrightLength: theme.experiments.copyrightLength, + }, audio: undefined, fireworks: (theme.fireworks && theme.fireworks.enable && theme.fireworks.options) ? theme.fireworks.options diff --git a/source/js/_app/library/declare.d.ts b/source/js/_app/library/declare.d.ts index 30d560a..ff1974d 100644 --- a/source/js/_app/library/declare.d.ts +++ b/source/js/_app/library/declare.d.ts @@ -115,6 +115,9 @@ interface configType { priority: boolean } playerAPI: string + experiments: { + copyrightLength: number; + } } // esbuild 静态常量 declare const __shokax_player__:boolean diff --git a/source/js/_app/page/post.ts b/source/js/_app/page/post.ts index df520a9..63f2ce8 100644 --- a/source/js/_app/page/post.ts +++ b/source/js/_app/page/post.ts @@ -1,7 +1,7 @@ import { $dom } from '../library/dom' import { postFancybox } from './fancybox' import { clipBoard, showtip } from '../globals/tools' -import { BODY } from '../globals/globalVars' +import { CONFIG, BODY } from '../globals/globalVars' import { pageScroll, transition } from '../library/anime' import { mediaPlayer } from '../player' import { getDisplay, setDisplay, wrapObject } from '../library/proto' @@ -22,7 +22,7 @@ export const postBeauty = () => { } const copyright = document.getElementById('copyright') - if (window.getSelection().toString().length > 30 && copyright) { + if (window.getSelection().toString().length > CONFIG.experiments.copyrightLength && copyright) { event.preventDefault() const author = '# ' + (copyright.querySelector('.author') as HTMLElement).innerText const link = '# ' + (copyright.querySelector('.link') as HTMLElement).innerText