Skip to content

Commit

Permalink
feat: space page redirect to video
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Aug 5, 2024
1 parent afae04c commit 1474b0b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 3.10.2

- 新增:空间页 用户主页自动跳转到投稿
- 优化:更名频道页为分区页以消除歧义

## 3.10.1
Expand Down
5 changes: 3 additions & 2 deletions src/components/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ interface IItem {
* itemID item的唯一ID, 与GM database中的Key对应, 使用相同ID可共享item状态
* description item的功能介绍, 显示在panel内, \n可用来换行
* defaultStatus item默认开启状态, 第一次安装时使用, 对于所有用户均开启的项目给true
* itemFunc 功能函数
* enableFunc 启用功能函数
* enableFuncRunAt 启用功能函数运行时机 (立即执行,DOMContentLoaded, load)
* disableFunc 禁用功能函数
* itemCSS item的CSS
* callback 回调函数, 用于在关掉开关时触发外部事务
*/
interface ICheckboxItemOption {
itemID: string
Expand Down
13 changes: 13 additions & 0 deletions src/rules/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ const spaceGroupList: Group[] = []
if (isPageSpace()) {
// 基本功能
const basicItems = [
// 打开用户主页 自动跳转到投稿
new CheckboxItem({
itemID: 'space-page-redirect-to-video',
description: '打开用户主页 自动跳转到投稿',
enableFunc: () => {
if (/\/\d+\/?($|\?)/.test(location.pathname)) {
const userid = location.pathname.match(/\d+/)?.[0]
if (userid) {
location.href = `https://space.bilibili.com/${userid}/video`
}
}
},
}),
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
Expand Down

0 comments on commit 1474b0b

Please sign in to comment.