Skip to content

Commit 025db33

Browse files
committed
✨ 添加CAT_userConfig打开用户配置页
1 parent 3504d8d commit 025db33

8 files changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
branches:
66
- main
7-
- test/*
7+
- develop/beta
88

99
jobs:
1010
build-deploy:

example/userconfig.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// @author You
77
// @background
88
// @grant GM_getValue
9+
// @grant CAT_userConfig
910
// ==/UserScript==
1011

1112
/* ==UserConfig==
@@ -62,6 +63,8 @@ group2:
6263
type: text
6364
==/UserConfig== */
6465

65-
setInterval(() => {
66+
setInterval(() => {
6667
console.log(GM_getValue("group1.configA"));
67-
}, 5000)
68+
}, 5000)
69+
70+
CAT_userConfig();

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "scriptcat",
3-
"version": "0.10.1",
3+
"version": "0.11.0-beta",
44
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
55
"author": "CodFrm",
66
"license": "GPLv3",

src/app/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const ExtVersion = "0.10.0";
1+
export const ExtVersion = "0.11.0-beta";
22

33
export const ExtServer =
44
process.env.NODE_ENV === "development"

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "ScriptCat",
4-
"version": "0.10.0",
4+
"version": "0.11.0.1010",
55
"author": "CodFrm",
66
"description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.",
77
"options_ui": {

src/runtime/background/gm_api.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,4 +747,12 @@ export default class GMApi {
747747
GM_unregisterMenuCommand(request: Request) {
748748
GMApi.hook.trigger("unregisterMenu", request.params[0], request);
749749
}
750+
751+
@PermissionVerify.API()
752+
CAT_userConfig(request: Request) {
753+
chrome.tabs.create({
754+
url: `/src/options.html#/?userConfig=${request.scriptId}`,
755+
active: true,
756+
});
757+
}
750758
}

src/runtime/content/gm_api.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,4 +665,9 @@ export default class GMApi {
665665
GM_unregisterMenuCommand(id: number): void {
666666
this.sendMessage("GM_unregisterMenuCommand", [id]);
667667
}
668+
669+
@GMContext.API()
670+
CAT_userConfig() {
671+
return this.sendMessage("CAT_userConfig", []);
672+
}
668673
}

0 commit comments

Comments
 (0)