Open hite opened 8 months ago
{
"name": "默认规则",
"author": "官方",
"type": "关闭登录弹窗#自动隐藏",
"matches":["blog.csdn.net","知乎","medium.com"],
"data": {
"*.zhihu.com": [
{
"type": "autoClick",
"name": "Close login dialogue",
"data": ".Modal-closeButton"
}
],
"blog.csdn.net": [
{
"type": "autoHide",
"name": "Close passport-login",
"data": ".passport-login-container"
},
{
"type": "insertCSS",
"name": "Remove restriction for copy",
"data": ".passport-container-mini {display: none !important;} #content_views pre code{user-select: text !important;} #content_views pre{ user-select: text !important;}"
},
{
"type": "insertCSS",
"name": "去掉关注才能阅读全文的限制",
"data": "#content_views{height:auto !important; overflow: auto !important;}"
}
],
"www.jianshu.com/go-wild*": [
{
"type": "autoClick",
"name": "ignore the warning for target page",
"data": ":contains('继续前往')"
}
],
"link.zhihu.com/": [
{
"type": "autoClick",
"name": "Auto open the external page",
"data": ".content .link"
}
]
}
}
一、分享自己规则集的步骤
1.在
AccessHappily
插件的规则编辑器里复制规则到粘贴板(或点击链接复制规则并分享自己的规则
),打开在线规则列表 2.点击右上角New issue
3.在第一条评论下添加一个纯粹是 JSON 对象的评论, 如下面的评论,注意:使用这样的markdown 标记*.
二、订阅规则的步骤
1.回到
AccessHappily
插件的设置界面 2.切换填入此 URL, 添加适当的描述内容 3.点击添加
三、JSON 对象的格式
{ "name": string, required, 为规则起个名字, "author": string, required, 规则的创建者, "type": string, required, 规则的类型,如 cookie warning removal, 关闭登录弹窗, "matches": array, required, 规则的适用页面,如 >, required, 实际的规则.可以从自动生成的规则文件里 copy,或者根据规则手动书写,
"remark": string, optional, 一些备注,
}
["知乎", "medium.com"]
, 只为了展示,不参与页面是否匹配规则的逻辑, "data": Object<Key, array四、Key 的格式
AccessHappily 获取到 URL =
location.host + location.pathname
, 使用此 URL,进行匹配(不包含 query 的参数)五、Rule 的格式
{ "name": string, required, 为规则动作起个名字, 规则被执行时,左上角提示的名称为了辨识当前执行的规则, "type": string 枚举, required, 规则的动作类型,如 autoHide | autoClick | autoNavigate | insertCSS | others, "data": string, required, 实际的规则.通常是普通的 CSS 选择器,如果 type = insertCSS 时, data 为完整的 style ,如
#content_views pre code{ user-select: text !important;}
, " exampleUrl": string,optional, 使用工具生成规则时的页面地址,用来验证是否生效 }六、规则样例见下一条评论