@@ -62,20 +62,26 @@ function simpleShare() {
6262 // 新增click事件
6363 // 若replace element, 会在切换视频后无法更新视频分享数量, 故直接新增click事件覆盖剪贴板
6464 shareBtn . addEventListener ( 'click' , ( ) => {
65- let title = document . querySelector ( '#viewbox_report > h1' ) ?. textContent as string
65+ let title = document . querySelector ( '#viewbox_report > h1' ) ?. textContent
66+ if ( ! title ) {
67+ // 尝试稍后再看or收藏夹列表
68+ title = document . querySelector ( '.video-title-href' ) ?. textContent
69+ if ( ! title ) {
70+ return
71+ }
72+ }
6673 if (
6774 ! '(({【[[《「<{〔〖<〈『' . includes ( title [ 0 ] ) &&
6875 ! '))}】]]》」>}〕〗>〉』' . includes ( title . slice ( - 1 ) )
6976 ) {
7077 title = `【${ title } 】`
7178 }
72- let urlPath = location . pathname
73- if ( urlPath . endsWith ( '/' ) ) {
74- urlPath = urlPath . slice ( 0 , - 1 )
75- }
79+ // 匹配av号, BV号, 分P号
80+ const pattern = / a v \d + | B V [ 1 - 9 A - H J - N P - Z a - k m - z ] + / g
81+ const avbv = pattern . exec ( location . href )
82+ let shareText = ` ${ title } \nhttps://www.bilibili.com/video/ ${ avbv } `
7683 const urlObj = new URL ( location . href )
7784 const params = new URLSearchParams ( urlObj . search )
78- let shareText = `${ title } \nhttps://www.bilibili.com${ urlPath } `
7985 if ( params . has ( 'p' ) ) {
8086 shareText += `?p=${ params . get ( 'p' ) } `
8187 }
759765 false ,
760766 undefined ,
761767 false ,
762- `#v_desc {display: none !important;}` ,
768+ `#v_desc {display: none !important;}
769+ /* 收藏夹和稍后再看 */
770+ .video-desc-container {display: none !important;}` ,
763771 ) ,
764772 )
765773 // 隐藏 tag列表
770778 false ,
771779 undefined ,
772780 false ,
773- `#v_tag {display: none !important;}` ,
781+ `#v_tag {display: none !important;}
782+ /* 收藏夹和稍后再看 */
783+ .video-tag-container {display: none !important;}` ,
774784 ) ,
775785 )
776786 // 隐藏 活动宣传, 默认开启
0 commit comments