@@ -49,170 +49,6 @@ TrollScript 内置丰富的原生模块,[查看完整中文 API 文档](API.md
4949
5050> [ 示例脚本 (TrollScript-Store)] ( https://github.com/dompling/TrollScript-Release/tree/main/templates/TestScripts )
5151
52- ## 触发器
53-
54- | 类型 | 说明 |
55- | ------| --------------------------------------------|
56- | 定时任务 | Cron 定时执行脚本 |
57- | 剪切板 | 复制了特定的文字内容之后触发脚本 |
58- | 文件监控 | 文件变化的时候触发 |
59- | 通知监控 | APP 发送通知的时候,触发脚本(兼容性未知 作者的手机系统:IOS 16.3.1) |
60-
61- > 脚本同时触发,可能会发生崩溃或者其他未知问题,请注意使用。可以反馈修复。
62-
63- ### 全局参数
64-
65- ** $triggerInput**
66- - 通知监控参数
67-
68- ``` typescript
69- interface $triggerInput {
70- type: " notification" ; // 触发类型
71- bundleId: string ; // 来源 App Bundle ID
72- title: string ; // 通知标题
73- message: string ; // 通知内容
74- timestamp: number ; // 时间戳 (毫秒)
75- }
76- ```
77-
78- ** $args**
79- - 快捷指令参数
80-
81- ``` typescript
82- interface $args {
83- text? : string // 输入内容
84- json? : string // 输入JSON
85- }
86- ```
87-
88- ** 脚本返回值**
89-
90- - 控制台显示返回值
91- - 返回给快捷指令
92-
93- ``` javascript
94- const test = " 123"
95- return test;
96- ```
97-
98- ## 安装方式
99-
100- ### 方式一:直接下载
101-
102- 1 . 前往 [ Releases] ( https://github.com/dompling/TrollScript-Release/releases/latest ) 页面
103- 2 . 下载最新的 ` .tipa ` 文件
104- 3 . 在 TrollStore 中安装
105-
106- ### 方式二:URL Scheme 安装
107-
108- 如果已安装 TrollStore,可以点击以下链接直接安装:
109-
110- ```
111- apple-magnifier://install?url=https://github.com/dompling/TrollScript-Release/releases/latest/download/TrollScript_latest.tipa
112- ```
113-
114- ## 高级功能
115-
116- ### 脚本导入/导出
117-
118- 支持两种导出格式:
119-
120- - ` .trollscript ` - 完整格式,包含代码和元数据
121- - ` .js ` - 纯 JavaScript 代码
122-
123- 导入支持:` .trollscript ` 、` .js ` 、` .json ` 、` .txt ` 格式
124-
125- ### 脚本商店
126-
127- TrollScript 支持脚本商店功能,通过脚本商店可以方便地获取和分享脚本。
128-
129- [ 默认商店 (TrollScript-Store)] ( https://github.com/dompling/TrollScript-Store )
130-
131- ### URL Scheme
132-
133- TrollScript 支持多种 URL Scheme,可用于从其他应用快速操作:
134-
135- #### 安装脚本
136-
137- 从 URL 下载并导入脚本:
138-
139- ```
140- trollscript://install?url=https://example.com/script.js
141- ```
142-
143- #### 商店安装
144-
145- 从脚本商店直接安装脚本(用于商店一键安装):
146-
147- ```
148- trollscript://store?id=脚本ID&name=脚本名称&url=https://example.com/script.js
149- ```
150-
151- | 参数 | 说明 |
152- | --------| ----------------|
153- | ` id ` | 脚本唯一标识(用于版本追踪) |
154- | ` name ` | 脚本显示名称 |
155- | ` url ` | 脚本下载地址 |
156-
157- #### 运行脚本
158-
159- 通过脚本 ID 或名称运行已安装的脚本:
160-
161- ```
162- trollscript://run?id=脚本UUID
163- trollscript://run?name=脚本名称
164- ```
165-
166- #### 导入脚本
167-
168- 通过 Base64 编码的内容导入脚本:
169-
170- ```
171- trollscript://import?content=Base64编码内容&name=脚本名称
172- ```
173-
174- #### 打开应用
175-
176- 仅打开 TrollScript 应用:
177-
178- ```
179- trollscript://open
180- ```
181-
182- #### 添加商店订阅
183-
184- 通过 URL 添加脚本商店订阅源:
185-
186- ```
187- trollscript://subscribe?name=订阅源名称&url=https://example.com/store.json
188- ```
189-
190- | 参数 | 说明 |
191- | --------| -------------|
192- | ` name ` | 订阅源显示名称 |
193- | ` url ` | 订阅源 JSON 地址 |
194-
195- ### NPM 支持
196-
197- 为了方便开发者编写脚本,提供了 TypeScript 定义包:
198-
199- [ ![ npm version] ( https://badge.fury.io/js/%40dompling%2Ftrollscript-types.svg )] ( https://www.npmjs.com/package/@dompling/trollscript-types )
200-
201- ``` bash
202- npm install --save-dev @dompling/trollscript-types
203- ```
204-
205- ## 截图
206-
207- <p align =" center " >
208- <img src =" images/2781768272086_.pic_hd-portrait.png " width =" 35% " alt =" Screenshot 3 " >
209- <img src =" images/2791768272087_.pic_hd-portrait.png " width =" 35% " alt =" Screenshot 4 " >
210- </p >
211- <p align =" center " >
212- <img src =" images/2761768272084_.pic_hd-left.png " width =" 35% " alt =" Screenshot 1 " >
213- <img src =" images/2771768272085_.pic_hd-left.png " width =" 35% " alt =" Screenshot 2 " >
214- </p >
215-
21652## 更新日志
21753
21854查看 [ Releases] ( https://github.com/dompling/TrollScript-Release/releases ) 获取完整更新日志。
0 commit comments