hite / AccessHappily

受够了那些仅仅为了浏览网页都提示让你登录账户、登录 app、扫描微信关注的网址,这个工具为了关闭这些干扰元素
4 stars 0 forks source link

[Guidelines][Official] How do I share my own rule set publicly #2

Open hite opened 7 months ago

hite commented 7 months ago

1. Steps to Share Your Rule Set

  1. Find the JSON editor In the AccessHappily extension's settings page, and copy the content of rule to the clipboard (or click the link Copy Rules and Publish). Open the Online Rules List.
  2. Click the New issue button in the top right corner.
  3. Add a comment in the first comment with a pure JSON object, like the comment below. Note: Use

    ```json {} ```

    as the markdown markup*.

  4. Once saving, copy the URL of the current issue.

2. Steps to Subscribe to Rules

  1. Go back to the AccessHappily extension's settings page.
  2. Switch to fill in this URL, and add appropriate description content.
  3. Click Add.

3. JSON Object Format

{
     "name": "string, required, name for the rule",
     "author": "string, required, creator of the rule",
     "type": "string, required, type of the rule, such as cookie warning removal, close login pop-up",
     "matches": "array<string>, required, applicable pages for the rule, such as `['msn.com', 'medium.com']`, only for display, don't affect logic of whether the page matches the rule",
    "data": "Object<Key, array<Rule>>, required, actual rule. Can be copied from the automatically generated rule file or written manually based on the rule format",
     "remark": "string, optional, leave remarks for further management",
}

4. Key Format

AccessHappily considers the fact that URL = location.host + location.pathname, uses this URL for matching rule (excluding query parameters).

https://keystonejs.com/docs/getting-started?type=CMS#where-to-next Actual value of URL is keystonejs.com/docs/getting-started

  • example.com/path*
  • Matches example.com/path/9H894.html
  • Does not match sub.example.com/path/9H894.html
  • *.example.com/path/*
  • Matches sub.example.com/path/9H894.html?t=123234234
  • *.example.com/path/9H894.html
  • Matches sub.example.com/path/9H894.html?t=123234234
  • file.example.com
  • Matches file.example.com/path/9H894.html?t=123234234
  • Matches file.example.com/user/9H894.html?t=123234234
  • Does not match sub2.file.example.com/user/9H894.html?t=123234234

5. Rule Format

{
    "name": "string, required, name for the rule action. When the rule is executed, the name displayed in the upper-left corner for identifying the currently executed rule",
    "type": "string enum, required, action type of the rule, such as autoHide | autoClick | autoNavigate | insertCSS | others",
    "data": "string, required, actual rule. Usually a regular CSS selector. If type = insertCSS, data is the complete style, such as `#content_views pre code{user-select: text !important;}`",
   "exampleUrl": "string, optional, page address when generating the rule with the tool, used to verify its effectiveness"
}

6. Rule Example in the Next Comment

hite commented 7 months ago
{
    "name": "Default Rules",
    "author": "Official",
    "type": "Close Login Popup#Auto Hide",
    "matches": ["blog.csdn.net", "zhihu", "medium.com"],
    "data": {
        "*.zhihu.com": [
            {
                "type": "autoClick",
                "name": "Close Login Dialog",
                "data": ".Modal-closeButton"
            }
        ],
        "blog.csdn.net": [
            {
                "type": "autoHide",
                "name": "Close Passport Login",
                "data": ".passport-login-container"
            },
            {
                "type": "insertCSS",
                "name": "Remove Copy Restriction",
                "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": "Remove Restriction to Read Full Text Only for Followers",
                "data": "#content_views{height:auto !important; overflow: auto !important;}"
            }
        ],
        "www.jianshu.com/go-wild*": [
            {
                "type": "autoClick",
                "name": "Ignore Warning for Target Page",
                "data": ":contains('Continue to')"
            }
        ],
        "link.zhihu.com/": [
            {
                "type": "autoClick",
                "name": "Auto Open External Page",
                "data": ".content .link"
            }
        ]
    }
}