小调整。

scripts
王良 2024-04-23 22:25:44 +08:00
parent c194656ee0
commit e33472ee83
1 changed files with 10 additions and 11 deletions

View File

@ -37,7 +37,10 @@
const api = {}; const api = {};
//region DS自定义的API //region DS自定义的API start
// 获取上下文
api.getContext = () => context;
// 创建插件样式 // 创建插件样式
api.createPluginStyle = (options) => { api.createPluginStyle = (options) => {
@ -175,6 +178,7 @@
body.prepend(context.pluginElement); body.prepend(context.pluginElement);
} }
// 显示菜单列表
api.showMenus = () => { api.showMenus = () => {
for (const menuCmdId in context.menus) { for (const menuCmdId in context.menus) {
const menuElement = context.menus[menuCmdId].element; const menuElement = context.menus[menuCmdId].element;
@ -182,7 +186,7 @@
} }
} }
// 隐藏菜单 // 隐藏菜单列表
api.hideMenus = () => { api.hideMenus = () => {
for (const menuCmdId in context.menus) { for (const menuCmdId in context.menus) {
const menuElement = context.menus[menuCmdId].element; const menuElement = context.menus[menuCmdId].element;
@ -190,11 +194,6 @@
} }
} }
// 获取上下文
api.getContext = () => {
return context;
};
// 初始化篡改猴操作界面 // 初始化篡改猴操作界面
api.DS_init = (options) => { api.DS_init = (options) => {
try { try {
@ -214,10 +213,10 @@
} }
}; };
//endregion DS自定义的API //endregion DS自定义的API end
//region 篡改猴标准API由DS自定义实现 //region 篡改猴标准API由DS自定义实现 start
// 注册菜单 // 注册菜单
api.GM_registerMenuCommand = (name, callback, options_or_accessKey) => { api.GM_registerMenuCommand = (name, callback, options_or_accessKey) => {
@ -406,10 +405,10 @@
} }
}; };
//endregion 篡改猴标准API由DS自定义实现 //endregion 篡改猴标准API由DS自定义实现 end
// 设置脚本环境 // 设置API
window.__ds_global__ = api; window.__ds_global__ = api;
// 模块化支持 // 模块化支持