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 1260ff3
Show file tree
Hide file tree
Showing 16 changed files with 92 additions and 90 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/components/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class CheckboxItem implements IItem {
}
}
}
/** 监听item chekbox开关 */
/** 监听item checkbox开关 */
watchItem() {
try {
this.itemEle = document.querySelector(`#${this.option.itemID} input`) as HTMLInputElement
Expand Down
2 changes: 1 addition & 1 deletion src/components/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class Panel {
<span>bilibili 页面净化大师</span>
</div>
<div id="bili-cleaner-close">
<svg t="1699601981125" class="icon" viewBox="0 0 1026 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5964" width="20" height="20"><path d="M996.742543 154.815357L639.810328 511.747572l356.932215 356.932215a90.158906 90.158906 0 0 1-127.490994 127.490994L512.319334 639.195998l-356.932215 356.889647A90.158906 90.158906 0 1 1 27.896126 868.637219L384.82834 511.747572 27.896126 154.815357A90.158906 90.158906 0 1 1 155.387119 27.324364L512.319334 384.256578 869.251549 27.324364a90.158906 90.158906 0 1 1 127.490994 127.490993z" fill="#ffffff" p-id="5965"></path></svg>
<svg class="icon" viewBox="0 0 1026 1024" xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M996.742543 154.815357L639.810328 511.747572l356.932215 356.932215a90.158906 90.158906 0 0 1-127.490994 127.490994L512.319334 639.195998l-356.932215 356.889647A90.158906 90.158906 0 1 1 27.896126 868.637219L384.82834 511.747572 27.896126 154.815357A90.158906 90.158906 0 1 1 155.387119 27.324364L512.319334 384.256578 869.251549 27.324364a90.158906 90.158906 0 1 1 127.490994 127.490993z" fill="#ffffff"></path></svg>
</div>
</div>
<div id="bili-cleaner-group-list">
Expand Down
38 changes: 19 additions & 19 deletions src/components/wordlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class WordList {
<div id="bili-cleaner-wordlist">
<div class="wordlist-header"></div>
<div class="wordlist-description"></div>
<textarea class="wordlist-body" spellcheck="false" autocapitalize="off" autocomplete="off" autocorrect="off"></textarea>
<textarea class="wordlist-body" spellcheck="false" autocapitalize="off" autocomplete="off"></textarea>
<div class="wordlist-footer">
<button class="wordlist-save-button">保存</button>
<button class="wordlist-close-button">关闭</button>
Expand Down Expand Up @@ -60,24 +60,24 @@ export class WordList {
}
}

/** 添加多个值到列表 */
addValues(values: string[]) {
try {
this.getValue()
values.forEach((value) => {
value = value.trim()
if (value && !this.wordSet.has(value)) {
this.wordArr.push(value)
this.wordSet.add(value)
}
})
this.setValue()
debug(`list ${this.listID} add ${values.length} lines, OK`)
} catch (err) {
error(err)
error(`list ${this.listID} add ${values.length} lines, ERROR`)
}
}
// /** 添加多个值到列表 */
// addValues(values: string[]) {
// try {
// this.getValue()
// values.forEach((value) => {
// value = value.trim()
// if (value && !this.wordSet.has(value)) {
// this.wordArr.push(value)
// this.wordSet.add(value)
// }
// })
// this.setValue()
// debug(`list ${this.listID} add ${values.length} lines, OK`)
// } catch (err) {
// error(err)
// error(`list ${this.listID} add ${values.length} lines, ERROR`)
// }
// }

/**
* 编辑整个列表
Expand Down
8 changes: 4 additions & 4 deletions src/filters/commentFilter/pages/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,12 @@ if (isPageDynamic()) {
}
if (commentListContainer) {
// 初次全站检测
check(true)
const commentObverser = new MutationObserver(() => {
check(true).then().catch()
const commentObserver = new MutationObserver(() => {
// 增量检测
check(false)
check(false).then().catch()
})
commentObverser.observe(commentListContainer, { childList: true, subtree: true })
commentObserver.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
Loading

0 comments on commit 1260ff3

Please sign in to comment.