您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
将 ABP 中的元素隐藏规则转换为 CSS 使用
当前为
将 ABP 中的元素隐藏规则转换为 CSS 使用,
配合 AdGuard 的解析库,
用于增强 Android 系统上套壳 (WebView) 浏览器的广告拦截能力 。
这个脚本用 TypeScript 编写,源代码见 这里 。
这个脚本的用户面非常窄 ... 因为:
如果你非常幸运,不属于上面所有情况,可以试试它 :)
主要流程,请参考以下 DOT :
digraph Run { ordering=in; subgraph Condition { node [shape = "diamond";]; 手动禁用; 规则为空; 检查更新; 预存为空; 预存需要更新; 已经应用预存; 已经应用预存_2; } 脚本退出 [shape = "square";]; 手动禁用 -> 创建启用菜单 [label = "是"; color = forestgreen;]; 创建启用菜单 -> 脚本退出; 手动禁用 -> 创建禁用菜单 [label = "否"; color = tomato;]; 创建禁用菜单 -> 预存为空; 预存为空 -> 读取规则,创建更新菜单 [label = "是"; color = forestgreen;]; 预存为空 -> 应用预存 [label = "否"; color = tomato;]; 应用预存 -> 创建更新菜单 -> 预存需要更新; 预存需要更新 -> 读取规则,创建更新菜单 [label = "是"; color = forestgreen;]; 预存需要更新 -> 检查更新 [label = "否"; color = tomato;]; 读取规则,创建更新菜单 -> 规则为空; 规则为空 -> 强制下载规则 [label = "是"; color = forestgreen;]; 规则为空 -> 转换规则,保存到预存 [label = "否"; color = tomato;]; 转换规则,保存到预存 -> 已经应用预存; 已经应用预存 -> 检查更新 [label = "是"; color = forestgreen;]; 已经应用预存 -> 应用规则 [label = "否"; color = tomato;]; 应用规则 -> 检查更新; 检查更新 -> 下载规则 [label = "有"; color = forestgreen;]; 检查更新 -> 脚本退出 [label = "无"; color = tomato;]; 强制下载规则 -> 已经应用预存_2; 已经应用预存_2 -> 脚本退出 [label = "是"; color = forestgreen;]; 已经应用预存_2 -> 应用规则_2 [label = "否"; color = tomato;]; 应用规则_2 -> 脚本退出; 下载规则 -> 脚本退出; }
更新流程 :
脚本菜单 :
目前内置由 @大萌主 提供的两套规则,十分感谢 :)
无法支持的浏览器 :
对于 Via 浏览器 :
对于 X 浏览器 :
对于 MDM 浏览器 :
对于 B 仔浏览器 :
对于 Top 浏览器 :
对于 书签地球 :
此脚本引用了 AdGuard 的解析库 ExtendedCss,
附 ExtendedCss 许可声明:
(文件注释)
/*! extended-css - v1.3.16 - Thu Sep 15 2022
* https://github.com/AdguardTeam/ExtendedCss
* Copyright (c) 2022 AdGuard. Licensed GPL-3.0
*/
(标准声明填充)
ExtendedCss
Copyright (C) 2022 AdGuard
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
从 2.1.2 开始,此脚本不再直接引用 bext-lib ,
而是抽取了其中的两个函数,并做了修改。
从 2.3.0 开始,不再使用 runNeed,只使用 runOnce。
附 bext-lib 许可声明 :
MIT License
Copyright (c) 2022 ikkz
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
可以在 80 行那里添加单条 ABP 元素规则,请务必确认在下面 "支持的语法" 中。
给它取个英文单词的名字,然后需要修改三个地方 :
脚本头 资源
// @resource 名字 规则地址
脚本头 跨域白名单
// @connect 规则地址的域名
OnlineRules.push 里面加个对象
{
标识: "名字",
地址: "规则地址",
在线更新: !!1, // 1 开启 0 关闭
筛选后存储: !!1,
},
注意,只有最后一个对象末尾可以不加逗号
! 一般的元素规则
###id
example.com###id
! 多域名
example.com,example.org###id
! 排除子域名
example.com,~www.example.com###id
! TLD 通配
example.*###id
隐藏 | 放行 | 内容 | ExtendedCss |
---|---|---|---|
## | #@# | 标准 CSS 选择器 | 否 |
#?# | #@?# | 扩充的 CSS 选择器 | 是 |
#$# | #@$# | 标准 CSS 规则 | 否 |
#$?# | #@$?# | 扩充的 CSS 规则 | 是 |
[$domain="example.com"]###id
[$path="/index"]###id
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址