Skip to content

Commit

Permalink
Merge pull request #25 from festoney8/dev
Browse files Browse the repository at this point in the history
merge dev to main, v3.0.1 alpha #24
  • Loading branch information
festoney8 authored Jan 22, 2024
2 parents 90b2297 + 6812e58 commit ef660e7
Show file tree
Hide file tree
Showing 32 changed files with 1,323 additions and 1,025 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## 3.0.1

- 新增:白名单管理(UP主、标题关键词)
- 新增:白名单 支持首页、播放页、热门页
- 新增:首页 标有已关注Tag的视频免过滤(实验性)
- 新增:播放页 接下来播放 免过滤
- 优化:视频过滤行为
- 修复:一些bug
- 更新:README

## 3.0.0

- 新增:视频过滤器(时长过滤、UP主过滤、标题关键词过滤、BV号过滤)
Expand Down
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@
<div>专注于净化/优化页面,轻量高效无浏览器负担,载入时不闪屏</div>
<br>

[安装](#%E5%AE%89%E8%A3%85) / [功能介绍](#%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D) / [浏览器适配](#%E6%B5%8F%E8%A7%88%E5%99%A8%E9%80%82%E9%85%8D) / [净化效果](#%E5%87%80%E5%8C%96%E6%95%88%E6%9E%9C%E5%AF%B9%E6%AF%94) / [插件兼容](#%E4%B8%8E%E5%85%B6%E4%BB%96-bilibili-%E6%8F%92%E4%BB%B6%E7%9A%84%E5%85%BC%E5%AE%B9%E6%80%A7) / [数据导出](#%E6%95%B0%E6%8D%AE%E5%AF%BC%E5%85%A5%E4%B8%8E%E5%AF%BC%E5%87%BA)
[安装使用](#%E5%AE%89%E8%A3%85) / [功能介绍](#%E5%8A%9F%E8%83%BD%E4%BB%8B%E7%BB%8D) / [浏览器适配](#%E6%B5%8F%E8%A7%88%E5%99%A8%E9%80%82%E9%85%8D) / [净化效果](#%E5%87%80%E5%8C%96%E6%95%88%E6%9E%9C%E5%AF%B9%E6%AF%94) / [插件兼容](#%E4%B8%8E%E5%85%B6%E4%BB%96-bilibili-%E6%8F%92%E4%BB%B6%E7%9A%84%E5%85%BC%E5%AE%B9%E6%80%A7) / [数据导出](#%E6%95%B0%E6%8D%AE%E5%AF%BC%E5%85%A5%E4%B8%8E%E5%AF%BC%E5%87%BA)
<br>
<br>

</div>

## 功能一览

![](images/preview.png)
### 页面元素净化

<details>
<summary><b>查看 全部功能长图</b></summary>
![](images/preview.png)

![](images/preview-full.jpg)
### 筛选推荐视频(测试阶段)

</details>
![](images/preview-filter.png)

## 安装

Expand All @@ -37,27 +36,37 @@

## 使用

- **注意「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页」这 7 个页面,菜单各不相同**

- 「通用」项目对所有页面生效
- **注意「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页」这 7 个页面,菜单各不相同**,「通用」项目对所有页面生效

- 按下图打开菜单,在每个页面进行自定义净化,支持实时预览

![](images/usage.png)

## 功能介绍

### 页面净化

- 适用于 **净化新版 bilibili 网页**,不做老版本页面适配
- 目前支持 **「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页」** 这 7 个页面,可在每个页面下开启插件菜单,查看功能列表
- 目前支持「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页」这 7 个页面,可在每个页面下开启插件菜单,查看功能列表
- 「通用」功能主要用于净化顶栏,对全站所有页面生效
- 脚本默认用户已登录,大会员下(开发环境)体验最佳
- 脚本默认开启少数基础功能,其余功能由用户自行设定
- 大多数功能实时生效,方便用户进行页面定制
- 脚本在开启网页后立即注入,所有隐藏元素规则在开启页面后 1 秒内生效。其他需要等待元素出现的功能,如「净化分享」生效较慢

### 过滤视频推荐

- **注意:功能目前处于测试阶段,仅供体验,不保证功能生效、不保证屏蔽记录稳定性**
- 支持「首页、播放页、热门页(热门视频/每周必看/排行榜)」共 3 个页面
- 支持「UP主、BV号、标题关键词、视频时长」共 4 种推荐模式
- 视频推荐功能实时生效
- 每个页面的功能开关相互独立
- 黑名单、白名单全站通用,一次屏蔽,全站隐藏(只要开关开启就会隐藏)
- 白名单权限高于黑名单,命中白名单的视频不会被隐藏

### 快捷键

- 支持使用快捷键 `Alt + B``Ctrl + Alt + B` 快速开启/关闭插件功能,迅速查看净化对比
- 支持使用快捷键 `Alt + B``Ctrl + Alt + B` 快速开启/关闭**页面净化**功能,迅速查看净化对比
- Firefox 浏览器仅支持 `Ctrl + Alt + B`
- 临时使用被隐藏的功能,只需快捷键快速关闭插件,不用打开菜单寻找选项
- 快速关闭只支持停用CSS规则,部分功能不支持,如:BV号转AV号
Expand Down
Binary file added images/preview-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed images/preview-full.jpg
Binary file not shown.
3 changes: 2 additions & 1 deletion src/components/panel.css
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@
#bili-cleaner-wordlist textarea.wordlist-body {
width: 340px;
height: 400px;
margin: 10px;
margin: 5px 15px;
border: 1px solid #000;
border-radius: 5px;
overflow-y: scroll;
font-size: 18px;
Expand Down
3 changes: 2 additions & 1 deletion src/components/panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
& textarea.wordlist-body {
width: 340px;
height: 400px;
margin: 10px;
margin: 5px 15px;
border: 1px solid black;
border-radius: 5px;
overflow-y: scroll;
font-size: 18px;
Expand Down
2 changes: 1 addition & 1 deletion src/components/panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { debug, error } from '../utils/logger'

class Panel {
panelCSS = `
#bili-cleaner{position:fixed;left:50%;top:50%;transform:translate(-50%, -50%);width:max(32vw,300px);height:90vh;border-radius:10px;background:#f4f5f7;box-shadow:0 0 8px rgba(0,0,0,.25);overflow:auto;z-index:2147483640}#bili-cleaner #bili-cleaner-bar{width:max(32vw,300px);height:6vh;background:#fb7299;border-top-left-radius:10px;border-top-right-radius:10px;cursor:move;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-bar #bili-cleaner-title{width:max(32vw,300px);height:6vh;display:flex;justify-content:center;align-items:center;color:#fff;font-weight:bold;font-size:22px}#bili-cleaner #bili-cleaner-bar #bili-cleaner-title span{text-align:center}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close{position:absolute;top:0;right:0;width:6vh;height:6vh;border-radius:6vh;display:flex;justify-content:center;align-items:center;cursor:auto}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close:hover{background:rgba(255,255,255,.2)}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close svg{text-align:center}#bili-cleaner #bili-cleaner-group-list{height:84vh;overflow:auto;scrollbar-width:none !important}#bili-cleaner #bili-cleaner-group-list::-webkit-scrollbar{display:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group{margin:14px;background:#fff;border-radius:6px;padding:8px 16px;border:1px solid #ddd;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group hr{border:1px solid #eee;margin:5px 0 10px 0}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-group-title{font-size:20px;font-weight:bold;padding:2px;color:#000;letter-spacing:1px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-list label{display:flex;align-items:center;margin:6px 0 6px 10px;font-size:16px;color:#000}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-list hr{border:1px solid #eee;margin:15px 20px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox{width:50px;min-width:50px;height:27px;margin:0 1em 0 0;position:relative;border:1px solid #dfdfdf;background-color:#fdfdfd;box-shadow:#dfdfdf 0 0 0 0 inset;border-radius:50px;-moz-appearance:none;appearance:none;-webkit-appearance:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:before{content:"";width:25px;height:25px;position:absolute;top:0px;left:0;border-radius:50px;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.5)}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:checked{border-color:#fb7299;box-shadow:#fb7299 0 0 0 16px inset;background-color:#fb7299}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:checked:before{left:25px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number{width:50px;min-width:50px;height:27px;margin:0 .5em 0 .5em;position:relative;border:1px solid #dfdfdf;background-color:#fdfdfd;box-shadow:#dfdfdf 0 0 0 0 inset;border-radius:5px;-moz-appearance:none;appearance:none;-webkit-appearance:none;text-align:center;color:blue;font-size:16px;-moz-appearance:textfield}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number::-webkit-inner-spin-button,#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number::-webkit-inner-spin-button{-webkit-appearance:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-button{width:50px;background-color:#fff;border:1px solid #666;border-radius:6px;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:16px;margin:0 1em 0 0;outline:none;padding:5px 0;position:relative;text-align:center;text-decoration:none;touch-action:manipulation;transition:box-shadow .2s,transform .1s;-moz-user-select:none;user-select:none;-webkit-user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-button:active{background-color:#f7f7f7;border-color:#000;transform:scale(0.96)}#bili-cleaner-wordlist{background:#fff;border-radius:5px;position:fixed;left:50%;top:50%;transform:translate(-50%, -50%);display:flex;flex-direction:column;border:1px solid #000;z-index:2147483641}#bili-cleaner-wordlist .wordlist-header{font-size:22px;font-weight:bold;margin:8px auto;height:40px;line-height:40px;text-align:center}#bili-cleaner-wordlist textarea.wordlist-body{width:340px;height:400px;margin:10px;border-radius:5px;overflow-y:scroll;font-size:18px;line-height:24px;padding:8px;flex-grow:1;resize:none}#bili-cleaner-wordlist textarea.wordlist-body:focus{outline:none !important}#bili-cleaner-wordlist .wordlist-footer{height:50px;display:flex;justify-content:space-evenly;padding:0 10px;align-items:center}#bili-cleaner-wordlist .wordlist-footer button{width:100px;height:30px;border-radius:5px;border:1px solid #666;font-size:18px}#bili-cleaner-wordlist .wordlist-footer button:hover{background-color:#666;color:#fff}
#bili-cleaner{position:fixed;left:50%;top:50%;transform:translate(-50%, -50%);width:max(32vw,300px);height:90vh;border-radius:10px;background:#f4f5f7;box-shadow:0 0 8px rgba(0,0,0,.25);overflow:auto;z-index:2147483640}#bili-cleaner #bili-cleaner-bar{width:max(32vw,300px);height:6vh;background:#fb7299;border-top-left-radius:10px;border-top-right-radius:10px;cursor:move;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-bar #bili-cleaner-title{width:max(32vw,300px);height:6vh;display:flex;justify-content:center;align-items:center;color:#fff;font-weight:bold;font-size:22px}#bili-cleaner #bili-cleaner-bar #bili-cleaner-title span{text-align:center}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close{position:absolute;top:0;right:0;width:6vh;height:6vh;border-radius:6vh;display:flex;justify-content:center;align-items:center;cursor:auto}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close:hover{background:rgba(255,255,255,.2)}#bili-cleaner #bili-cleaner-bar #bili-cleaner-close svg{text-align:center}#bili-cleaner #bili-cleaner-group-list{height:84vh;overflow:auto;scrollbar-width:none !important}#bili-cleaner #bili-cleaner-group-list::-webkit-scrollbar{display:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group{margin:14px;background:#fff;border-radius:6px;padding:8px 16px;border:1px solid #ddd;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group hr{border:1px solid #eee;margin:5px 0 10px 0}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-group-title{font-size:20px;font-weight:bold;padding:2px;color:#000;letter-spacing:1px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-list label{display:flex;align-items:center;margin:6px 0 6px 10px;font-size:16px;color:#000}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-list hr{border:1px solid #eee;margin:15px 20px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox{width:50px;min-width:50px;height:27px;margin:0 1em 0 0;position:relative;border:1px solid #dfdfdf;background-color:#fdfdfd;box-shadow:#dfdfdf 0 0 0 0 inset;border-radius:50px;-moz-appearance:none;appearance:none;-webkit-appearance:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:before{content:"";width:25px;height:25px;position:absolute;top:0px;left:0;border-radius:50px;background-color:#fff;box-shadow:0 1px 3px rgba(0,0,0,.5)}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:checked{border-color:#fb7299;box-shadow:#fb7299 0 0 0 16px inset;background-color:#fb7299}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-checkbox:checked:before{left:25px}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number{width:50px;min-width:50px;height:27px;margin:0 .5em 0 .5em;position:relative;border:1px solid #dfdfdf;background-color:#fdfdfd;box-shadow:#dfdfdf 0 0 0 0 inset;border-radius:5px;-moz-appearance:none;appearance:none;-webkit-appearance:none;text-align:center;color:blue;font-size:16px;-moz-appearance:textfield}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number::-webkit-inner-spin-button,#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-number::-webkit-inner-spin-button{-webkit-appearance:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-button{width:50px;background-color:#fff;border:1px solid #666;border-radius:6px;box-sizing:border-box;cursor:pointer;display:inline-block;font-size:16px;margin:0 1em 0 0;outline:none;padding:5px 0;position:relative;text-align:center;text-decoration:none;touch-action:manipulation;transition:box-shadow .2s,transform .1s;-moz-user-select:none;user-select:none;-webkit-user-select:none}#bili-cleaner #bili-cleaner-group-list .bili-cleaner-group .bili-cleaner-item-button:active{background-color:#f7f7f7;border-color:#000;transform:scale(0.96)}#bili-cleaner-wordlist{background:#fff;border-radius:5px;position:fixed;left:50%;top:50%;transform:translate(-50%, -50%);display:flex;flex-direction:column;border:1px solid #000;z-index:2147483641}#bili-cleaner-wordlist .wordlist-header{font-size:22px;font-weight:bold;margin:8px auto;height:40px;line-height:40px;text-align:center}#bili-cleaner-wordlist textarea.wordlist-body{width:340px;height:400px;margin:5px 15px;border:1px solid #000;border-radius:5px;overflow-y:scroll;font-size:18px;line-height:24px;padding:8px;flex-grow:1;resize:none}#bili-cleaner-wordlist textarea.wordlist-body:focus{outline:none !important}#bili-cleaner-wordlist .wordlist-footer{height:50px;display:flex;justify-content:space-evenly;padding:0 10px;align-items:center}#bili-cleaner-wordlist .wordlist-footer button{width:100px;height:30px;border-radius:5px;border:1px solid #666;font-size:18px}#bili-cleaner-wordlist .wordlist-footer button:hover{background-color:#666;color:#fff}
`
panelHTML = `
<div id="bili-cleaner">
Expand Down
27 changes: 25 additions & 2 deletions src/components/wordlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,27 @@ 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`)
}
}

/**
* 添加多个值到列表
* 编辑整个列表
* @param values 编辑框内输入的列表
* @returns 保存是否成功
*/
Expand Down Expand Up @@ -105,7 +124,11 @@ export class WordList {
e.innerHTML = this.nodeHTML.trim()
e.querySelector('.wordlist-header')!.innerHTML = this.description.replace('\n', '<br>')
debug(`insertNode, fetchList ${this.fetchList().length} lines`)
e.querySelector('textarea')!.value = this.fetchList().join('\n')
let lines = this.fetchList().join('\n')
if (lines) {
lines += '\n'
}
e.querySelector('textarea')!.value = lines
document.body?.appendChild(e.firstChild!)
}

Expand Down
Loading

0 comments on commit ef660e7

Please sign in to comment.