Skip to content

Commit

Permalink
chore: docs
Browse files Browse the repository at this point in the history
  • Loading branch information
solobat committed Mar 18, 2023
1 parent ae9d06f commit aaa0f2a
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ public/manifest.json
utils/reload/*.js
utils/reload/injections/*.js
.turbo
/docs
/typesdoc
39 changes: 22 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
<h1 align="center">iHelpers</h1>
<p align="center">Some useful tools for Chrome</p>
<p align="left">iHelpers is a Chrome extension that provides users with built-in shortcuts such as reading mode, night mode, page outlines, and basic operations like clicking, inputting, event listening and emitting, and more. In addition to supporting custom functions through script mode, iHelpers also allows for instruction configuration through its user interface. Whether you are looking to increase productivity or seeking more convenience while browsing the web, iHelpers is a very practical tool.</p>
<p align="center">
<a href="https://github.com/solobat/iHelpers/releases"><img src="https://img.shields.io/badge/lastest_version-1.7.5-blue.svg"></a>
<a href="https://github.com/solobat/iHelpers/releases"><img src="https://img.shields.io/badge/lastest_version-1.8.0-blue.svg"></a>
<a target="_blank" href="https://chrome.google.com/webstore/detail/ihelpers/hcnekoladldejmeindnhpjkfhjadcick"><img src="https://img.shields.io/badge/download-_chrome_webstore-brightgreen.svg"></a>
</p>

***
---

## Install

### Install
- [Chrome Web Store](https://chrome.google.com/webstore/detail/ihelpers/hcnekoladldejmeindnhpjkfhjadcick)

### Usage
[Documents](https://const.app/iHelpers/index.html)
## Docs
- [IScript Documents](https://docs.ihelpers.xyz/)
- [Types Documents](https://types.ihelpers.xyz/)

#### Videos
### Videos

## Development

### Development
Please start with the dev branch
````

```
# node >= v16.13
`yarn`
Expand All @@ -27,15 +30,17 @@ yarn dev
# build
yarn build
````
```

## License:

### License:
[![license-badge]][license-link]

<!-- Link -->
[version-badge]: https://img.shields.io/badge/lastest_version-1.6.0-blue.svg
[version-link]: https://github.com/solobat/iHelpers
[chrome-badge]: https://img.shields.io/badge/download-_chrome_webstore-brightgreen.svg
[offline-badge]: https://img.shields.io/badge/download-_crx-brightgreen.svg
[license-badge]: https://img.shields.io/github/license/mashape/apistatus.svg
[license-link]: https://opensource.org/licenses/MIT

[version-badge]: https://img.shields.io/badge/lastest_version-1.6.0-blue.svg
[version-link]: https://github.com/solobat/iHelpers
[chrome-badge]: https://img.shields.io/badge/download-_chrome_webstore-brightgreen.svg
[offline-badge]: https://img.shields.io/badge/download-_crx-brightgreen.svg
[license-badge]: https://img.shields.io/github/license/mashape/apistatus.svg
[license-link]: https://opensource.org/licenses/MIT
40 changes: 40 additions & 0 deletions docs/IScript.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## 版本
v0.1.0

## 语言概述
该语言用于定义自动化脚本,可以通过该脚本来创建浏览器的自动化操作,例如打开网页、点击、输入文字等,从而提高浏览的体验与效率。

## 语言规则
该语言由以下几个部分组成:
1. 注释,支持单行以及行内注释,以 `#` 开头
2. `automation` 定义块:
```ruby
automation for "{url pattern}" on "{stage: immediate | load | delay}"
# 这里是具体的语句
end
```
3. `statement` 语句
语句写在 `automation` 块里,主要有以下三大类语句:
- 赋值语句
- 格式为: `set var = {值 | 变量 | listen 表达式 | get 表达式}`

- 快捷语句
- `open` 语句: `open "{url}" as "{url pattern}"`,用以打开 `url`,仅当 `url pattern` 集合中的页面已经存在时才会创建新标签页
- `active` 语句:`active`, 用于选中当前标签页
- `wait` 语句: `wait {number}`, 用以两条语句间的等待,以秒为单位
- `close` 语句: `close`, 关闭当前页面
- `emit` 语句: `emit "{eventName}" with (var1=1, var2=othervar)`,用于向浏览器发出全局事件`eventName`
- `listen` 语句: `listen "{eventName}" on "CssSelector | global"`,监听来自全局或页面的事件,例如 `global` | `body` | `.cls`

- 执行语句
- 格式为: `apply "{actionName}" with (var1=1, var2=othervar, var=false, ...) on "CssSelector"`
- `apply` 语句可以执行所有内置的 `action`;本质上讲,快捷语句也都可以由 `apply` 语句改写。


## 例子
- 微博阅读模式
```ruby
automation for "https://weibo.com/*" on "load"
apply "readMode" with (excludes=".Frame_wrap_16as0") on "#homeWrap"
end
```
40 changes: 40 additions & 0 deletions docs/IScript_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## Version
v0.1.0

## Language Overview
This language is used to define automation scripts that can be used to perform automated operations in a web browser, such as opening a webpage, clicking, inputting text, and more, in order to improve browsing experience and efficiency.

## Language Rules
The language consists of the following parts:
1. Comments, which support single-line and inline comments starting with `#`.
2. `automation` definition blocks:
```ruby
automation for "{url pattern}" on "{stage: immediate | load | delay}"
# Here are the specific statements
end
```

3. `statement` Statements
Statements are written inside an `automation` block and can be divided into the following three categories:
- Assignment statements
- The format is: `set var = {value | variable | listen expression | get expression}`

- Shortcut statements
- `open` statement: `open "{url}" as "{url pattern}"`, used to open the `url`, and only creates a new tab if the page is not already present in the `url pattern` set
- `active` statement: `active`, used to select the current tab
- `wait` statement: `wait {number}`, used for waiting between two statements, in seconds
- `close` statement: `close`, closes the current page
- `emit` statement: `emit "{eventName}" with (var1=1, var2=othervar)`, used to send a global event `eventName` to the browser
- `listen` statement: `listen "{eventName}" on "CssSelector | global"`, listens for events from the global or page scope, e.g., `global` | `body` | `.cls`

- Execution statements
- The format is: `apply "{actionName}" with (var1=1, var2=othervar, var=false, ...) on "CssSelector"`
- The `apply` statement can execute all built-in `action`s, and essentially, shortcut statements can be rewritten by `apply` statements.

## Example
- Weibo Read-Mode
```ruby
automation for "https://weibo.com/*" on "load"
apply "readMode" with (excludes=".Frame_wrap_16as0") on "#homeWrap"
end
```
4 changes: 2 additions & 2 deletions src/common/const/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const local_i18n = {
},
};

// const lang = chrome.i18n.getUILanguage().replace("-", "_");
const lang = "zh_CN";
const lang = chrome.i18n.getUILanguage().replace("-", "_");
// const lang = "zh_CN";

function t(key: string): string {
const texts = local_i18n[lang] ?? local_i18n.en;
Expand Down
1 change: 1 addition & 0 deletions src/pages/popup/components/Automation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ function MenuBtn(props: {
}

const defaultScript = `
# example
automation for "https://weibo.com/*" on "load"
set excludes = ".Frame_wrap_16as0"
apply "readMode" with (excludes=excludes) on "#homeWrap"
Expand Down
2 changes: 1 addition & 1 deletion typedoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"entryPoints": [
"src/builtin/*.ts",
],
"out": "docs"
"out": "typesdoc"
}

0 comments on commit aaa0f2a

Please sign in to comment.