diff --git a/.github/workflows/dev-ci.yml b/.github/workflows/dev-ci.yml index f7798b08..586e0059 100644 --- a/.github/workflows/dev-ci.yml +++ b/.github/workflows/dev-ci.yml @@ -1,8 +1,6 @@ name: dev-ci on: push: - paths: - - src branches: - dev @@ -22,7 +20,7 @@ jobs: with: version: 8 - - name: install dependencies + - name: install run: pnpm install - name: lint run: pnpm run lint diff --git a/CHANGELOG.md b/CHANGELOG.md index d51533fd..af7271c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## 2.0.1 + +- 新增:脚本URL元数据绑定Greasyfork +- 新增:通用项 header净化支持旧版本header + ## 2.0.0 - 重构:项目重构 diff --git a/README.md b/README.md index bebe0216..f3311a55 100644 --- a/README.md +++ b/README.md @@ -19,12 +19,12 @@ ## 安装 -### **稳定版:[点此安装](https://greasyfork.org/zh-CN/scripts/479861)** +### 稳定版:[**前往 Greasyfork 安装**](https://greasyfork.org/zh-CN/scripts/479861) -- 请查看 [浏览器适配](#%E6%B5%8F%E8%A7%88%E5%99%A8%E9%80%82%E9%85%8D) +- 请查看 [**浏览器适配**](#%E6%B5%8F%E8%A7%88%E5%99%A8%E9%80%82%E9%85%8D) - 稳定版持续在 Greasyfork 发布,油猴插件会定期检查,自动更新 -### 开发测试版:[点此安装dev版](https://github.com/festoney8/bilibili-cleaner/raw/dev/dist/bilibili-cleaner.user.js) +### 测试版:[Release安装](https://github.com/festoney8/bilibili-cleaner/releases/) ## 使用 diff --git a/src/pages/common.ts b/src/pages/common.ts index 45c8eb18..0ca7d56d 100644 --- a/src/pages/common.ts +++ b/src/pages/common.ts @@ -126,7 +126,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href="//www.bilibili.com"]) svg {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href="//www.bilibili.com"]) svg { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>span>a[href="//www.bilibili.com"]) .navbar_logo { + display: none !important; + }`, ), ) // 隐藏 顶栏-首页 @@ -137,8 +143,20 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar li:has(>a[href="//www.bilibili.com"]) span {display: none !important;} - div.bili-header__bar .left-entry .v-popover-wrap:has(>a[href="//www.bilibili.com"]) div {display: none !important;}`, + `div.bili-header__bar li:has(>a[href="//www.bilibili.com"]) span { + display: none !important; + } + div.bili-header__bar .left-entry .v-popover-wrap:has(>a[href="//www.bilibili.com"]) div { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>span>a[href="//www.bilibili.com"]) :not(svg) { + color: transparent; + user-select: none; + } + #internationalHeader li.nav-link-item:has(>span>a[href="//www.bilibili.com"]) .navbar_pullup { + display: none !important; + }`, ), ) // 隐藏 顶栏-番剧 @@ -149,7 +167,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href="//www.bilibili.com/anime/"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href="//www.bilibili.com/anime/"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>a[href*="bilibili.com/anime"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-直播 @@ -160,7 +184,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href="//live.bilibili.com"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href="//live.bilibili.com"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>span>a[href*="live.bilibili.com"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-游戏中心 @@ -171,7 +201,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href^="//game.bilibili.com"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href^="//game.bilibili.com"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>span>a[href*="game.bilibili.com"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-会员购 @@ -182,7 +218,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href^="//show.bilibili.com"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href^="//show.bilibili.com"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>a[href*="show.bilibili.com"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-漫画 @@ -193,7 +235,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href^="//manga.bilibili.com"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href^="//manga.bilibili.com"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>span>a[href*="manga.bilibili.com"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-赛事 @@ -206,6 +254,10 @@ if (location.host != 'live.bilibili.com') { false, `div.bili-header__bar .left-entry li:has(>a[href^="//www.bilibili.com/match/"], >a[href^="//www.bilibili.com/v/game/match/"]) { display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(>a[href*="bilibili.com/match/"]) { + display: none !important; }`, ), ) @@ -217,9 +269,18 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar li:has(.loc-mc-box) {display: none !important;} + `div.bili-header__bar li:has(.loc-mc-box) { + display: none !important; + } div.bili-header__bar .left-entry li:not(:has(.v-popover)):has([href^="https://live.bilibili.com/"]) { display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(a[href*="live.bilibili.com/blackboard"]) { + display: none !important; + } + #internationalHeader li.nav-link-item:has(.loc-mc-box, [href^="https://live.bilibili.com/"]) { + display: none !important; }`, ), ) @@ -242,7 +303,13 @@ if (location.host != 'live.bilibili.com') { true, undefined, false, - `div.bili-header__bar .left-entry li:has(a[href="//app.bilibili.com"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(a[href="//app.bilibili.com"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(a[href="//app.bilibili.com"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-所有官方活动(blackboard) @@ -253,8 +320,16 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `div.bili-header__bar .left-entry li:has(>a[href*="bilibili.com/blackboard"]) {display: none !important;} - div.bili-header__bar .left-entry li:has(>div>a[href*="bilibili.com/blackboard"]) {display: none !important;}`, + `div.bili-header__bar .left-entry li:has(>a[href*="bilibili.com/blackboard"]) { + display: none !important; + } + div.bili-header__bar .left-entry li:has(>div>a[href*="bilibili.com/blackboard"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader li.nav-link-item:has(.loc-mc-box, span>a[href*="bilibili.com/blackboard"]) { + display: none !important; + }`, ), ) } @@ -270,7 +345,9 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `#nav-searchform .nav-search-input::placeholder {color: transparent;}`, + `#nav-searchform .nav-search-input::placeholder {color: transparent;} + /* 旧版header */ + #internationalHeader #nav_searchform input::placeholder {color: transparent;}`, ), ) // 隐藏 顶栏-搜索框 搜索历史 @@ -281,7 +358,9 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.search-panel .history {display: none;}`, + `.search-panel .history {display: none;} + /* 旧版header */ + #internationalHeader .nav-search-box .history {display: none !important;}`, ), ) // 隐藏 顶栏-搜索框 bilibili热搜 @@ -292,7 +371,9 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.search-panel .trending {display: none;}`, + `.search-panel .trending {display: none;} + /* 旧版header */ + #internationalHeader .nav-search-box .trending {display: none !important;}`, ), ) } @@ -308,7 +389,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .v-popover-wrap.header-avatar-wrap {display: none !important;}`, + `.right-entry .v-popover-wrap.header-avatar-wrap { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.mini-avatar) { + display: none !important; + }`, ), ) // 隐藏 顶栏-大会员, 默认开启 @@ -319,7 +406,13 @@ if (location.host != 'live.bilibili.com') { true, undefined, false, - `.right-entry .vip-wrap:has([href="//account.bilibili.com/big"]) {display: none !important;}`, + `.right-entry .vip-wrap:has([href="//account.bilibili.com/big"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.mini-vip) { + display: none !important; + }`, ), ) // 隐藏 顶栏-消息 @@ -330,7 +423,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .v-popover-wrap:has([href^="//message.bilibili.com"], [data-idx="message"]) {display: none !important;}`, + `.right-entry .v-popover-wrap:has([href^="//message.bilibili.com"], [data-idx="message"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.nav-item-message) { + display: none !important; + }`, ), ) // 隐藏 顶栏-动态 @@ -341,7 +440,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .v-popover-wrap:has([href^="//t.bilibili.com"], [data-idx="dynamic"]) {display: none !important;}`, + `.right-entry .v-popover-wrap:has([href^="//t.bilibili.com"], [data-idx="dynamic"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.nav-item-dynamic) { + display: none !important; + }`, ), ) // 隐藏 顶栏-收藏 @@ -352,7 +457,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .v-popover-wrap:has(.header-favorite-container, [data-idx="fav"]) {display: none !important;}`, + `.right-entry .v-popover-wrap:has(.header-favorite-container, [data-idx="fav"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.mini-favorite) { + display: none !important; + }`, ), ) // 隐藏 顶栏-历史 @@ -363,7 +474,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .v-popover-wrap:has([href="//www.bilibili.com/account/history"], [data-idx="history"]) {display: none !important;}`, + `.right-entry .v-popover-wrap:has([href="//www.bilibili.com/account/history"], [data-idx="history"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(.mini-history) { + display: none !important; + }`, ), ) // 隐藏 顶栏-创作中心 @@ -374,7 +491,13 @@ if (location.host != 'live.bilibili.com') { false, undefined, false, - `.right-entry .right-entry-item:has(a[href="//member.bilibili.com/platform/home"], [data-idx="creation"]) {display: none !important;}`, + `.right-entry .right-entry-item:has(a[href="//member.bilibili.com/platform/home"], [data-idx="creation"]) { + display: none !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center .item:has(a[href="//member.bilibili.com/platform/home"]) { + display: none !important; + }`, ), ) // 隐藏 顶栏-投稿 @@ -386,7 +509,13 @@ if (location.host != 'live.bilibili.com') { undefined, false, // 不可设定 display: none, 会导致历史和收藏popover显示不全 - `.right-entry .right-entry-item.right-entry-item--upload {visibility: hidden !important;}`, + `.right-entry .right-entry-item.right-entry-item--upload { + visibility: hidden !important; + } + /* 旧版header */ + #internationalHeader .nav-user-center >div:has(.mini-upload) { + visibility: hidden !important; + }`, ), ) } diff --git a/vite.config.ts b/vite.config.ts index 4816ee21..1cb0fd2b 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ userscript: { name: 'bilibili 页面净化大师', namespace: 'http://tampermonkey.net/', - version: '2.0.0', + version: '2.0.1', description: '净化 B站/哔哩哔哩 页面内各种元素,去广告,BV号转AV号,提供300+项功能,定制自己的B站页面', author: 'festoney8', homepage: 'https://github.com/festoney8/bilibili-cleaner', @@ -16,6 +16,7 @@ export default defineConfig({ match: ['*://*.bilibili.com/*'], exclude: [ '*://message.bilibili.com/pages/nav/header_sync', + '*://message.bilibili.com/pages/nav/index_new_pc_sync', '*://data.bilibili.com/*', '*://cm.bilibili.com/*', '*://passport.bilibili.com/*', @@ -25,8 +26,10 @@ export default defineConfig({ ], icon: 'https://www.bilibili.com/favicon.ico', 'run-at': 'document-start', - // downloadURL: 'https://update.greasyfork.org/scripts/479861/bilibili%20%E9%A1%B5%E9%9D%A2%E5%87%80%E5%8C%96%E5%A4%A7%E5%B8%88.user.js', - // updateURL: 'https://update.greasyfork.org/scripts/479861/bilibili%20%E9%A1%B5%E9%9D%A2%E5%87%80%E5%8C%96%E5%A4%A7%E5%B8%88.meta.js', + downloadURL: + 'https://update.greasyfork.org/scripts/479861/bilibili%20%E9%A1%B5%E9%9D%A2%E5%87%80%E5%8C%96%E5%A4%A7%E5%B8%88.user.js', + updateURL: + 'https://update.greasyfork.org/scripts/479861/bilibili%20%E9%A1%B5%E9%9D%A2%E5%87%80%E5%8C%96%E5%A4%A7%E5%B8%88.meta.js', }, }), ],