├── img └── icon.png ├── src ├── .babelrc ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.ttf │ ├── glyphicons-halflings-regular.woff │ ├── glyphicons-halflings-regular.woff2 │ └── glyphicons-halflings-regular.svg ├── popup.tmpl.html └── js │ ├── main.js │ ├── component │ └── app.vue │ ├── utils.js │ └── popup.js ├── image ├── preview-1.png └── preview-2.jpg ├── .gitignore ├── manifest.json ├── README.md ├── package.json ├── webpack.config.js └── LICENSE /img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/img/icon.png -------------------------------------------------------------------------------- /src/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-0"], 3 | "plugins": ["transform-runtime"] 4 | } -------------------------------------------------------------------------------- /image/preview-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/image/preview-1.png -------------------------------------------------------------------------------- /image/preview-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/image/preview-2.jpg -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/src/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/src/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/src/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /src/fonts/glyphicons-halflings-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hanFengSan/BilibiliCleaner/HEAD/src/fonts/glyphicons-halflings-regular.woff2 -------------------------------------------------------------------------------- /src/popup.tmpl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 |
11 |
12 |
13 | **以上UP主名单仅是测试,毫无恶性:)**
14 |
15 | ## 用户使用说明
16 | [chrome webstore 下载地址](https://chrome.google.com/webstore/detail/bilibili-%E6%B8%85%E6%B4%81%E8%80%85/ihadnfkejmlnpohmlccdmgeikafohamb/related)
17 |
18 | 直接在输入框中输入用户名称然后点击添加或回车即可,屏蔽列表会自动同步到云端,不用担心丢失。添加是立即见效的,而删除需要重新刷新页面。
19 |
20 | ## 使用
21 | ```
22 | npm install
23 | ```
24 | 先解决依赖
25 | ```
26 | webpack
27 | ```
28 | 如上,即可完成编译,然后在chrome://extensions中勾选``开发者模式``,再选择``已解压的扩展程序``,选择此根目录,即加载成功。
29 |
30 |
31 |
32 |
33 | # License
34 |
35 | Copyright (C) 2016 hanFengSan
36 |
37 | Licensed under the Apache License, Version 2.0 (the "License");
38 | you may not use this file except in compliance with the License.
39 | You may obtain a copy of the License at
40 |
41 | http://www.apache.org/licenses/LICENSE-2.0
42 |
43 | Unless required by applicable law or agreed to in writing, software
44 | distributed under the License is distributed on an "AS IS" BASIS,
45 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
46 | See the License for the specific language governing permissions and
47 | limitations under the License.
48 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bilibili-cleaner",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "jquery.min.js",
6 | "scripts": {
7 | "start": "webpack-dev-server --progress",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "author": "",
11 | "license": "ISC",
12 | "devDependencies": {
13 | "webpack": "^1.13.2",
14 | "autoprefixer": "^6.4.1",
15 | "babel-core": "^6.14.0",
16 | "babel-loader": "^6.2.5",
17 | "babel-plugin-react-transform": "^2.0.2",
18 | "babel-plugin-transform-runtime": "^6.1.2",
19 | "babel-preset-es2015": "^6.14.0",
20 | "babel-preset-react": "^6.11.1",
21 | "babel-preset-stage-0": "^6.1.2",
22 | "babel-runtime": "^5.8.0",
23 | "bootstrap": "^3.3.7",
24 | "css-loader": "^0.24.0",
25 | "expose-loader": "^0.7.1",
26 | "extract-text-webpack-plugin": "^1.0.1",
27 | "favicons-webpack-plugin": "0.0.7",
28 | "file-loader": "^0.9.0",
29 | "html-webpack-plugin": "^2.22.0",
30 | "image-loader": "0.0.1",
31 | "image-webpack-loader": "^2.0.0",
32 | "jquery": "^1.10.2",
33 | "json-loader": "^0.5.4",
34 | "node-sass": "^3.9.3",
35 | "postcss-loader": "^0.11.1",
36 | "react-transform-hmr": "^1.0.4",
37 | "sass-loader": "^4.0.1",
38 | "style-loader": "^0.13.1",
39 | "url-loader": "^0.5.7",
40 | "vue": "^1.0.26",
41 | "vue-html-loader": "^1.0.0",
42 | "vue-loader": "^7.3.0",
43 | "vue-strap": "^1.1.14",
44 | "vuestrap-base-components": "^0.8.10",
45 | "vuex": "^1.0.0-rc.2",
46 | "webpack-dev-server": "^1.15.1"
47 | },
48 | "dependencies": {
49 | "vue": "^1.0.26",
50 | "vuex": "^1.0.0-rc.2"
51 | }
52 | }
--------------------------------------------------------------------------------
/src/js/main.js:
--------------------------------------------------------------------------------
1 | var blockList = [] // 屏蔽列表
2 | var html = document.documentElement.innerHTML // 用于检查是否需要刷新
3 |
4 | // 读取数据
5 | chrome.storage.sync.get('list', function (items) {
6 | for (let item of items.list) {
7 | blockList.push(item)
8 | }
9 | })
10 |
11 | // 监听屏蔽列表的变化
12 | chrome.storage.onChanged.addListener(function (changes, namespace) {
13 | for (let key in changes) {
14 | if (key == 'list') {
15 | blockList = changes[key].newValue
16 | }
17 | }
18 | })
19 |
20 | const clean = function () {
21 | // console.log('clean')
22 | // 音乐区推荐列表
23 | let hasRecommand = ($('.top-list').length != 0)
24 | // 评论列表
25 | let hasCommList = ($('.comm_list').length != 0)
26 |
27 | blockList.forEach(function (item) {
28 | // /清潔一般項
29 | $("[data-up='{0}']".format(item)).remove()
30 | // 清潔排行榜
31 | $(".l-item .up-info [title='{0}']".format(item)).parents('li').remove()
32 | // 清潔動態
33 | $(".vl-dyn-cnt [up='{0}']".format(item)).parents('li').remove()
34 |
35 | // 清洁推荐
36 | if (hasRecommand) {
37 | for (let recommandItem of $('.v-item')) {
38 | if (recommandItem.innerHTML.indexOf(item) != -1) {
39 | let node = recommandItem.parentNode
40 | node.parentNode.removeChild(node)
41 | }
42 | }
43 | }
44 |
45 | // 清洁评论
46 | if (hasCommList) {
47 | for (let commItem of $('.t')) {
48 | console.log(commItem.innerHTML)
49 | if (commItem.innerHTML.indexOf('card="{0}"'.format(item)) != -1) {
50 | let node = commItem.parentNode
51 | node.parentNode.removeChild(node)
52 | }
53 | }
54 | }
55 | })
56 | }
57 |
58 | const DOMModificationHandler = function () {
59 | $(this).unbind('DOMSubtreeModified')
60 | setTimeout(function () {
61 | // 判断document是否有变化
62 | if (html != document.documentElement.innerHTML) {
63 | clean()
64 | html = document.documentElement.innerHTML
65 | }
66 | $(document).bind('DOMSubtreeModified', DOMModificationHandler)
67 | }, 250)
68 | }
69 |
70 | // Checking page title
71 | if (document.title.indexOf('哔哩哔哩') != -1) {
72 | clean()
73 | DOMModificationHandler()
74 | }
75 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack')
2 | const HtmlWebpackPlugin = require('html-webpack-plugin')
3 | const ExtractTextPlugin = require('extract-text-webpack-plugin')
4 | const path = require('path')
5 | const srcPath = './src'
6 | const buildPath = '/build'
7 |
8 | module.exports = {
9 | devtool: 'eval-source-map',
10 |
11 | entry: {
12 | main: __dirname + '/src/js/main.js',
13 | popup: __dirname + '/src/js/popup.js'
14 | },
15 | output: {
16 | path: __dirname + buildPath,
17 | filename: '[name].js'
18 | },
19 |
20 | module: {
21 | loaders: [{
22 | test: /\.json$/,
23 | loader: 'json'
24 | },
25 | {
26 | test: /\.js$/,
27 | exclude: /node_modules/,
28 | loader: 'babel',
29 | query: {
30 | presets: ['es2015']
31 | }
32 | },
33 | {
34 | test: /\.scss$/,
35 | loaders: ['style', 'css', 'sass']
36 | },
37 | {
38 | test: /\.css$/,
39 | loader: 'style-loader!css-loader'
40 | },
41 | {
42 | test: /\.(png|jpg)$/,
43 | loader: 'url-loader?limit=8192'
44 | },
45 | {
46 | test: /\.vue$/,
47 | loader: 'vue'
48 | },
49 | {
50 | test: /\.(woff|woff2|eot|ttf|svg)$/,
51 | loader: 'url-loader?limit=100000'
52 | },
53 | {
54 | test: require.resolve('jquery'),
55 | loader: 'expose?jQuery!expose?$'
56 | },
57 | {
58 | test: /\.(jpe?g|png|gif|svg)$/i,
59 | loaders: [
60 | 'image-webpack'
61 | ]
62 | }
63 | ]
64 | },
65 |
66 | vue: {
67 | loaders: {
68 | js: 'babel'
69 | }
70 | },
71 |
72 | postcss: [],
73 |
74 | sassLoader: {
75 | includePaths: [path.resolve(__dirname, srcPath)]
76 | },
77 |
78 | imageWebpackLoader: {
79 | pngquant: {
80 | quality: '65-90',
81 | speed: 4
82 | },
83 | jpegtran: {
84 | progressive: false
85 | }
86 | },
87 |
88 | plugins: [
89 | new HtmlWebpackPlugin({
90 | filename: 'popup.html',
91 | template: __dirname + '/src/popup.tmpl.html',
92 | excludeChunks: ['main']
93 | }),
94 | new ExtractTextPlugin('[name].css'),
95 | new webpack.ProvidePlugin({
96 | $: 'jquery',
97 | jQuery: 'jquery'
98 | })
99 | ]
100 |
101 | }
--------------------------------------------------------------------------------
/src/js/component/app.vue:
--------------------------------------------------------------------------------
1 |
2 | | 名称 | 15 |操作 | 16 |
|---|---|
| {{ item }} | 21 |删除 | 22 |