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