GM_registerMenuCommand("打开设置", setting, "h"); 配合另外两个函数 GM_setValue(变量名,值); //(用来设置一个变量,打开其他网页时,重启浏览器都不会变) GM_getValue(变量名); //(获取保存的变量) 就能简单的做出一个设置功能了! 但是,你运行时肯定会报错,我也找了半天,不知道为什么,结果偶然发现...
GM_setValue('test',num) }else{ GM_deleteValue('test') } } ,5000) }else{ GM_addValueChangeListener('test',function(name, old_value, new_value, remote) { console.log('监听到了更改',name, old_value, new_value, remote) }) } 大家可以分别访问油猴中文网以及百度首页体验一下。 GM_remov...
GM_setValue("count",100); GM_setValue("active",true); GM_setValue("data", { name:'Andy', age:18 }); varinfo =`foo =${GM_getValue("foo")} count =${GM_getValue("count")} active =${GM_getValue("active")} data.name =${GM_getValue("data").name}`; alert(info); GM_l...
GM_setValue(name,value)将数据保存到存储中 GM_xmlhttpRequest(details)异步访问网页数据的API,这个方法比较复杂,有大量参数和回调,详情请参考官方文档。 GM_setClipboard(data, info)将数据复制到剪贴板中,第一个参数是要复制的数据,第二个参数是MIME类型,用于指定复制的数据类型。 GM_log(message)将日志打印到...
GM教程+GM函数手册 函数手册: GM_addStyle GM_log GM_listValues GM_setValue GM_deleteValue GM_getValue GM_getResourceText GM_getResourceURL GM_openInTab GM_registerMenuCommand GM_setClipboard GM_xmlhttpRequest 其他 headers 对象 method 字符串 ...
油猴脚本设置自动更新的方法如下:1、可以使用GM_setValue()方法来设置定时自动更新的功能。2、设置每天检查更新的时间,如果需要更新,可以运行定义函数。
Tampermonkey 上有两个常用的函数 GM_setValue() 和 GM_getValue(),均为同步函数;而到了 Greasemonkey 上变成了 GM.setValue() 和 GM.getValue(),均为异步函数。总而言之,一旦你在脚本里用上任意一套中的函数,Tampermonkey 和 Greasemonkey 就互不兼容了,而 Violentmonkey 则很狡猾地支持这四个函数,完美。
intervalId = setInterval(removeWatermark, 8); // 每8ms一次 isRunning = true; e.textContent = "🐵"; } } function storeMask(nickname, uid) { GM_setValue("nickname", nickname); GM_setValue("uid", uid); } const changeMaskDiv = document.createElement("div"); ...
1.`GM_setValue`和`GM_getValue`:可以用来在用户浏览器中存储数据; 2.`GM_`:可以用来发送HTTP请求; 3.`GM_addStyle`:可以用来添加CSS样式; 4.`GM_setClipboard`:可以用来设置剪贴板内容。 六、油猴脚本的优缺点 油猴脚本具有以下几个优点: 1.可以自定义网页内容,大大提升用户的浏览体验; ...
注册菜单 点击事件 注册实例 设置默认值 将handle(手握实例的变量)赋值给一个变量 function menu_Func_click() { GM_setValue('Func', !GM_getValue('Func')); // 开关 GM_unregist