From e33472ee83ac3bb442091606ba9c683858333f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=89=AF?= <841369634@qq.com> Date: Tue, 23 Apr 2024 22:25:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E8=B0=83=E6=95=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tampermonkey.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tampermonkey.js b/tampermonkey.js index 752cbfc9..0e2f0835 100644 --- a/tampermonkey.js +++ b/tampermonkey.js @@ -37,7 +37,10 @@ const api = {}; - //region DS自定义的API + //region DS自定义的API start + + // 获取上下文 + api.getContext = () => context; // 创建插件样式 api.createPluginStyle = (options) => { @@ -175,6 +178,7 @@ body.prepend(context.pluginElement); } + // 显示菜单列表 api.showMenus = () => { for (const menuCmdId in context.menus) { const menuElement = context.menus[menuCmdId].element; @@ -182,7 +186,7 @@ } } - // 隐藏菜单 + // 隐藏菜单列表 api.hideMenus = () => { for (const menuCmdId in context.menus) { const menuElement = context.menus[menuCmdId].element; @@ -190,11 +194,6 @@ } } - // 获取上下文 - api.getContext = () => { - return context; - }; - // 初始化篡改猴操作界面 api.DS_init = (options) => { 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) => { @@ -406,10 +405,10 @@ } }; - //endregion 篡改猴标准API,由DS自定义实现 + //endregion 篡改猴标准API,由DS自定义实现 end - // 设置脚本环境 + // 设置API window.__ds_global__ = api; // 模块化支持