Skip to content

Commit

Permalink
feat: 支持复制时小于自定义字数的时候不添加版权信息
Browse files Browse the repository at this point in the history
  • Loading branch information
b1xcy committed Oct 31, 2024
1 parent a8ae0d7 commit 1942e58
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
8 changes: 4 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ experiments:
enableCover: true # 是否开启头图
enablePreload: true #是否开启预加载头图
enableNextGradientCover: false # 使用CSS渐变作为上/下一页封面
copyrightLength: 50 # 自定义复制时显示copyright的长度

homeConfig:
gradient: false # 使用CSS渐变作为文章封面
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -403,4 +403,4 @@ vendors:
justifiedGallery:
source: cdnjs
url: justifiedGallery/3.8.1/css/justifiedGallery.min.css
sri: "sha384-V/1Ew9pYm8xpy/L9i078ZXT6HSEOrGC6KNFYLbXOdtqb3+c6brpGqVzZtEPSQOiz"
sri: "sha384-V/1Ew9pYm8xpy/L9i078ZXT6HSEOrGC6KNFYLbXOdtqb3+c6brpGqVzZtEPSQOiz"
3 changes: 3 additions & 0 deletions scripts/generaters/script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions source/js/_app/library/declare.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ interface configType {
priority: boolean
}
playerAPI: string
experiments: {
copyrightLength: number;
}
}
// esbuild 静态常量
declare const __shokax_player__:boolean
Expand Down
4 changes: 2 additions & 2 deletions source/js/_app/page/post.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down

0 comments on commit 1942e58

Please sign in to comment.