lisonge / vite-plugin-monkey

A vite plugin server and build your.user.js for userscript engine like Tampermonkey, Violentmonkey, Greasemonkey, ScriptCat
MIT License
1.31k stars 70 forks source link

GM_getClipboard获取剪切板内容是不支持使用吗? #94

Closed duoluodexiaoxiaoyuan closed 1 year ago

duoluodexiaoxiaoyuan commented 1 year ago

image

lisonge commented 1 year ago
import { monkeyWindow } from '$';

console.log(monkeyWindow.GM_getClipboard);
console.log(monkeyWindow.your_want_any_api);
pingfangdeguang commented 1 year ago
import { monkeyWindow } from '$';

console.log(monkeyWindow.GM_getClipboard);
console.log(monkeyWindow.your_want_any_api);

好的,我之前是这样引入的 import { GM_cookie, unsafeWindow, monkeyWindow, GM_addElement, GM_getValue, GM_setValue, GM_setClipboard } from '$';

然后只有GM_getClipboard会报错

lisonge commented 1 year ago

这种只能引入提前声明好的 GM_api ,GM_getClipboard 是哪个脚本引擎提供的方法? 我没找到文档

pingfangdeguang commented 1 year ago

是哪个脚本引擎提

感谢大佬解答,这个我也不清楚,我用的时候问的gpt, 油猴和脚本猫是都有这个方法的,我也不知道在哪里

lisonge commented 1 year ago

并没有这个方法

image

只有 GM_setClipboard 方法

https://www.tampermonkey.net/documentation.php#api:GM_setClipboard

duoluodexiaoxiaoyuan commented 1 year ago

并没有这个方法

image

只有 GM_setClipboard 方法

https://www.tampermonkey.net/documentation.php#api:GM_setClipboard

那应该是脚本猫独有的

lisonge commented 1 year ago

脚本猫的 文档 和 源码 里都没有 GM_getClipboard

duoluodexiaoxiaoyuan commented 1 year ago

脚本猫的 文档 和 源码 里都没有 GM_getClipboard

我刚才本地写了脚本测试了一下确实不行,可能记错了,尴尬