Skip to content

Commit

Permalink
fix: lots of typo
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Jun 21, 2024
1 parent b585db4 commit 14409ef
Show file tree
Hide file tree
Showing 13 changed files with 68 additions and 66 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 3.7.3

- 优化:代码typo更正

## 3.7.2

- 新增:直播页 活动直播页自动跳转普通直播
Expand Down
2 changes: 1 addition & 1 deletion src/filters/commentFilter/pages/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ if (isPageDynamic()) {
check(true)
const commentObverser = new MutationObserver(() => {
// 增量检测
check(false)
check(false).then().catch()
})
commentObverser.observe(commentListContainer, { childList: true, subtree: true })
}
Expand Down
4 changes: 2 additions & 2 deletions src/filters/commentFilter/pages/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ if (isPageVideo() || isPageBangumi() || isPagePlaylist()) {
if (usernameAction.status || contentAction.status) {
checkCommentList(true)
}
const commentObverser = new MutationObserver(() => {
const commentObserver = new MutationObserver(() => {
if (usernameAction.status || contentAction.status) {
checkCommentList(false)
}
})
commentObverser.observe(commentListContainer, { childList: true, subtree: true })
commentObserver.observe(commentListContainer, { childList: true, subtree: true })
}
}

Expand Down
1 change: 0 additions & 1 deletion src/filters/videoFilter/pages/actions/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ export class DimensionAction implements VideoFilterAction {
/**
* 视频横竖屏过滤操作
* @param statusKey 是否启用的GM key
* @param valueKey 存储数据的GM key
* @param checkVideoList 检测视频列表函数
*/
constructor(statusKey: string, checkVideoList: (fullSite: boolean) => void) {
Expand Down
20 changes: 10 additions & 10 deletions src/filters/videoFilter/pages/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ if (isPageChannel()) {
'global-uploader-whitelist-filter-value',
checkVideoList,
)
const channelTitleKeyworldWhitelistAction = new TitleKeywordWhitelistAction(
const channelTitleKeywordWhitelistAction = new TitleKeywordWhitelistAction(
'channel-title-keyword-whitelist-filter-status',
'global-title-keyword-whitelist-filter-value',
checkVideoList,
Expand All @@ -132,12 +132,12 @@ if (isPageChannel()) {
}
if (videoListContainer) {
// 初次全站检测
check(true)
const videoObverser = new MutationObserver(() => {
check(true).then().catch()
const videoObserver = new MutationObserver(() => {
// 增量检测
check(false)
check(false).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true, subtree: true })
videoObserver.observe(videoListContainer, { childList: true, subtree: true })
debug('watchVideoListContainer OK')
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ if (isPageChannel()) {
channelBvidAction.add(bvid)
})
menu.registerMenu(`◎ 复制视频链接`, () => {
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`)
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`).then().catch()
})
menu.show(e.clientX, e.clientY)
}
Expand Down Expand Up @@ -400,13 +400,13 @@ if (isPageChannel()) {
}),
// 启用 频道页标题关键词白名单
new CheckboxItem({
itemID: channelTitleKeyworldWhitelistAction.statusKey,
itemID: channelTitleKeywordWhitelistAction.statusKey,
description: '启用 标题关键词白名单',
itemFunc: () => {
channelTitleKeyworldWhitelistAction.enable()
channelTitleKeywordWhitelistAction.enable()
},
callback: () => {
channelTitleKeyworldWhitelistAction.disable()
channelTitleKeywordWhitelistAction.disable()
},
}),
// 编辑 关键词白名单
Expand All @@ -416,7 +416,7 @@ if (isPageChannel()) {
name: '编辑',
// 按钮功能:显示白名单编辑器
itemFunc: () => {
channelTitleKeyworldWhitelistAction.whitelist.show()
channelTitleKeywordWhitelistAction.whitelist.show()
},
}),
]
Expand Down
20 changes: 10 additions & 10 deletions src/filters/videoFilter/pages/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if (isPageHomepage()) {
'global-uploader-whitelist-filter-value',
checkVideoList,
)
const homepageTitleKeyworldWhitelistAction = new TitleKeywordWhitelistAction(
const homepageTitleKeywordWhitelistAction = new TitleKeywordWhitelistAction(
'homepage-title-keyword-whitelist-filter-status',
'global-title-keyword-whitelist-filter-value',
checkVideoList,
Expand All @@ -165,12 +165,12 @@ if (isPageHomepage()) {
}
if (videoListContainer) {
// 初次全站检测
check(true)
const videoObverser = new MutationObserver(() => {
check(true).then().catch()
const videoObserver = new MutationObserver(() => {
// 增量检测
check(false)
check(false).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true })
videoObserver.observe(videoListContainer, { childList: true })
debug('watchVideoListContainer OK')
}
}
Expand Down Expand Up @@ -242,7 +242,7 @@ if (isPageHomepage()) {
homepageBvidAction.add(bvid)
})
menu.registerMenu(`◎ 复制视频链接`, () => {
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`)
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`).then().catch()
})
menu.show(e.clientX, e.clientY)
}
Expand Down Expand Up @@ -447,13 +447,13 @@ if (isPageHomepage()) {
}),
// 启用 首页标题关键词白名单
new CheckboxItem({
itemID: homepageTitleKeyworldWhitelistAction.statusKey,
itemID: homepageTitleKeywordWhitelistAction.statusKey,
description: '启用 标题关键词白名单',
itemFunc: () => {
homepageTitleKeyworldWhitelistAction.enable()
homepageTitleKeywordWhitelistAction.enable()
},
callback: () => {
homepageTitleKeyworldWhitelistAction.disable()
homepageTitleKeywordWhitelistAction.disable()
},
}),
// 编辑 关键词白名单
Expand All @@ -463,7 +463,7 @@ if (isPageHomepage()) {
name: '编辑',
// 按钮功能:显示白名单编辑器
itemFunc: () => {
homepageTitleKeyworldWhitelistAction.whitelist.show()
homepageTitleKeywordWhitelistAction.whitelist.show()
},
}),
]
Expand Down
21 changes: 10 additions & 11 deletions src/filters/videoFilter/pages/popular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ if (isPagePopular()) {
// hook fetch
let apiResp: Response | undefined = undefined
const origFetch = unsafeWindow.fetch
unsafeWindow.fetch = (input, init?) => {
unsafeWindow.fetch = async (input, init?) => {
if (typeof input === 'string' && input.includes('api.bilibili.com') && init?.method?.toUpperCase() === 'GET') {
if (input.match(/web-interface\/(ranking|popular\/series\/one|popular\?ps)/)) {
return origFetch(input, init).then((resp: Response) => {
apiResp = resp.clone()
return resp
})
const resp = await origFetch(input, init)
apiResp = resp.clone()
return resp
}
}
return origFetch(input, init)
Expand Down Expand Up @@ -242,18 +241,18 @@ if (isPagePopular()) {
if (location.pathname.match(/\/v\/popular\/(?:all|rank|weekly)/)) {
popularDurationAction.status || popularQualityAction.status || popularDimensionAction.status
? await parseResp()
: parseResp()
: parseResp().then().catch()
}
checkVideoList(fullSite)
}
}

if (videoListContainer) {
check(true)
const videoObverser = new MutationObserver(async () => {
check(true)
check(true).then().catch()
const videoObserver = new MutationObserver(async () => {
check(true).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true, subtree: true })
videoObserver.observe(videoListContainer, { childList: true, subtree: true })
debug('watchVideoListContainer OK')
}
}
Expand All @@ -265,7 +264,7 @@ if (isPagePopular()) {
}).then((ele) => {
if (ele) {
videoListContainer = ele
watchVideoListContainer()
watchVideoListContainer().then().catch()
}
})
} catch (err) {
Expand Down
20 changes: 10 additions & 10 deletions src/filters/videoFilter/pages/search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ if (isPageSearch()) {
'global-uploader-whitelist-filter-value',
checkVideoList,
)
const searchTitleKeyworldWhitelistAction = new TitleKeywordWhitelistAction(
const searchTitleKeywordWhitelistAction = new TitleKeywordWhitelistAction(
'search-title-keyword-whitelist-filter-status',
'global-title-keyword-whitelist-filter-value',
checkVideoList,
Expand All @@ -135,11 +135,11 @@ if (isPageSearch()) {
}
}
if (videoListContainer) {
check(true)
const videoObverser = new MutationObserver(() => {
check(true)
check(true).then().catch()
const videoObserver = new MutationObserver(() => {
check(true).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true, subtree: true })
videoObserver.observe(videoListContainer, { childList: true, subtree: true })
debug('watchVideoListContainer OK')
}
}
Expand Down Expand Up @@ -210,7 +210,7 @@ if (isPageSearch()) {
searchBvidAction.add(bvid)
})
menu.registerMenu(`◎ 复制视频链接`, () => {
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`)
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`).then().catch()
})
menu.show(e.clientX, e.clientY)
}
Expand Down Expand Up @@ -397,13 +397,13 @@ if (isPageSearch()) {
},
}),
new CheckboxItem({
itemID: searchTitleKeyworldWhitelistAction.statusKey,
itemID: searchTitleKeywordWhitelistAction.statusKey,
description: '启用 标题关键词白名单',
itemFunc: () => {
searchTitleKeyworldWhitelistAction.enable()
searchTitleKeywordWhitelistAction.enable()
},
callback: () => {
searchTitleKeyworldWhitelistAction.disable()
searchTitleKeywordWhitelistAction.disable()
},
}),
new ButtonItem({
Expand All @@ -412,7 +412,7 @@ if (isPageSearch()) {
name: '编辑',
// 按钮功能:显示白名单编辑器
itemFunc: () => {
searchTitleKeyworldWhitelistAction.whitelist.show()
searchTitleKeywordWhitelistAction.whitelist.show()
},
}),
]
Expand Down
20 changes: 10 additions & 10 deletions src/filters/videoFilter/pages/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ if (isPageSpace()) {
'global-title-keyword-filter-value',
checkVideoList,
)
const spaceTitleKeyworldWhitelistAction = new TitleKeywordWhitelistAction(
const spaceTitleKeywordWhitelistAction = new TitleKeywordWhitelistAction(
'space-title-keyword-whitelist-filter-status',
'global-title-keyword-whitelist-filter-value',
checkVideoList,
Expand All @@ -96,12 +96,12 @@ if (isPageSpace()) {
}
}
if (videoListContainer) {
check(true)
const videoObverser = new MutationObserver(() => {
check(true).then().catch()
const videoObserver = new MutationObserver(() => {
// 全量检测
check(true)
check(true).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true, subtree: true })
videoObserver.observe(videoListContainer, { childList: true, subtree: true })
debug('watchVideoListContainer OK')
}
}
Expand Down Expand Up @@ -147,7 +147,7 @@ if (isPageSpace()) {
spaceBvidAction.add(bvid)
})
menu.registerMenu(`◎ 复制视频链接`, () => {
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`)
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`).then().catch()
})
menu.show(e.clientX, e.clientY)
}
Expand Down Expand Up @@ -273,13 +273,13 @@ if (isPageSpace()) {
const whitelistItems = [
// 启用 空间页标题关键词白名单
new CheckboxItem({
itemID: spaceTitleKeyworldWhitelistAction.statusKey,
itemID: spaceTitleKeywordWhitelistAction.statusKey,
description: '启用 标题关键词白名单',
itemFunc: () => {
spaceTitleKeyworldWhitelistAction.enable()
spaceTitleKeywordWhitelistAction.enable()
},
callback: () => {
spaceTitleKeyworldWhitelistAction.disable()
spaceTitleKeywordWhitelistAction.disable()
},
}),
// 编辑 标题关键词白名单
Expand All @@ -288,7 +288,7 @@ if (isPageSpace()) {
description: '编辑 标题关键词白名单(支持正则)',
name: '编辑',
itemFunc: () => {
spaceTitleKeyworldWhitelistAction.whitelist.show()
spaceTitleKeywordWhitelistAction.whitelist.show()
},
}),
]
Expand Down
12 changes: 6 additions & 6 deletions src/filters/videoFilter/pages/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ if (isPageVideo() || isPagePlaylist()) {
}
}
if (videoListContainer) {
check(true)
const videoObverser = new MutationObserver(() => {
check(true).then().catch()
const videoObserver = new MutationObserver(() => {
// 播放页右栏载入慢, 始终做全站检测
check(true)
check(true).then().catch()
})
videoObverser.observe(videoListContainer, { childList: true, subtree: true })
videoObserver.observe(videoListContainer, { childList: true, subtree: true })
debug('watchVideoListContainer OK')
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ if (isPageVideo() || isPagePlaylist()) {
const matches = url.match(/space\.bilibili\.com\/\d+/g)
matches &&
menu.registerMenu(`◎ 复制主页链接`, () => {
navigator.clipboard.writeText(`https://${matches[0]}`)
navigator.clipboard.writeText(`https://${matches[0]}`).then().catch()
})
}
menu.show(e.clientX, e.clientY)
Expand All @@ -265,7 +265,7 @@ if (isPageVideo() || isPagePlaylist()) {
videoBvidAction.add(bvid)
})
menu.registerMenu(`◎ 复制视频链接`, () => {
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`)
navigator.clipboard.writeText(`https://www.bilibili.com/video/${bvid}`).then().catch()
})
menu.show(e.clientX, e.clientY)
}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/bangumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (isPageBangumi()) {
const mainTitle = document.querySelector("[class^='mediainfo_mediaTitle']")?.textContent
const subTitle = document.getElementById('player-title')?.textContent
const shareText = `《${mainTitle}${subTitle} \nhttps://www.bilibili.com${location.pathname}`
navigator.clipboard.writeText(shareText)
navigator.clipboard.writeText(shareText).then().catch()
})
} else if (counter > 50) {
clearInterval(id)
Expand Down
2 changes: 1 addition & 1 deletion src/rules/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ if (isPageVideo() || isPagePlaylist()) {
if (params.has('p')) {
shareText += `?p=${params.get('p')}`
}
navigator.clipboard.writeText(shareText)
navigator.clipboard.writeText(shareText).then().catch()
})
clearInterval(id)
} else if (counter > 50) {
Expand Down
Loading

0 comments on commit 14409ef

Please sign in to comment.