Skip to content

Commit

Permalink
update: simpleShare
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Mar 27, 2024
1 parent 91c20e8 commit 51689fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 3.2.2

- 新增:播放页隐藏接下来播放
- 更新:净化分享适配新版标题

## 3.2.1

Expand Down
16 changes: 7 additions & 9 deletions src/rules/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,23 +63,21 @@ const simpleShare = () => {
// 新增click事件
// 若replace element, 会在切换视频后无法更新视频分享数量, 故直接新增click事件覆盖剪贴板
shareBtn.addEventListener('click', () => {
let title = document.querySelector('#viewbox_report > h1')?.textContent
if (!title) {
// 尝试稍后再看or收藏夹列表
title = document.querySelector('.video-title-href')?.textContent
if (!title) {
return
}
}
let title = document.querySelector(
'.video-info-title .video-title, #viewbox_report > h1, .video-title-href',
)?.textContent
if (
title &&
!'(({【[[《「<{〔〖<〈『'.includes(title[0]) &&
!'))}】]]》」>}〕〗>〉』'.includes(title.slice(-1))
) {
title = `【${title}】`
}
// 匹配av号, BV号, 分P号
const avbv = matchAvidBvid(location.href)
let shareText = `${title} \nhttps://www.bilibili.com/video/${avbv}`
let shareText = title
? `${title} \nhttps://www.bilibili.com/video/${avbv}`
: `https://www.bilibili.com/video/${avbv}`
const urlObj = new URL(location.href)
const params = new URLSearchParams(urlObj.search)
if (params.has('p')) {
Expand Down

0 comments on commit 51689fe

Please sign in to comment.