delete({ name: 'mycookie11' }, function(error) { if (error) { console.error('GM_cookie.delete', error); } else { console.log('Cookie deleted successfully'); } }); console.log(window.dayjs(1744189819610).format('
==-1){ setInterval( ()=>{ num++ if(num%2===0){ 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_log(message) 屏幕通知 GM_notification(details, ondone), GM_notification(text, title, image, onclick) 打开新选项卡 GM_openInTab(url, options), GM_openInTab(url, loadInBackground)菜单注册 GM_registerMenuCommand(name, callback, accessKey)菜单注销 GM_unregisterMenuCommand(menuCmd...
资源获取:GM_getResourceText和GM_getResourceURL用于获取@resource标注的资源,实现脚本内部资源的引用。 控制台打印与屏幕通知:GM_log用于控制台打印信息,GM_notification用于显示屏幕通知,实现脚本运行状态的反馈。 其他功能:包括打开新选项卡、菜单注册与注销、设置剪切板以及窗口操作等,满足脚本的各种...
修改DOM使用GM_addElement,添加样式使用GM_addStyle;下载功能由GM_download实现;获取@resource资源使用GM_getResourceText和GM_getResourceURL;控制台打印和屏幕通知通过GM_log和GM_notification实现;打开新选项卡用GM_openInTab;菜单注册和注销使用GM_registerMenuCommand和GM_unregisterMenuCommand;设置剪切...
console.log override not working in Tampermonkey 部署 一开始,我想到的是VIA浏览器可以执行脚本,但是我并没有去了解他的机制是否有区别,反正就是没有任何效果。 后来发现了一款可以安装插件的基于chromium的手机浏览器叫做Kiwi。(一直不知道为什么Chrome要在安卓端阉割掉这些)。
log(response.responseText); }, onerror: function(error) { console.error("Request failed:", error); } }); // 发送一个POST请求 GM_xmlhttpRequest({ method: "POST", url: "https://api.example.com/submit", data: "key1=value1&key2=value2", headers: { "Content-Type": "...
console.log(res); 10. } 11. }); 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 以上是部分应用程序接口,具体请查看Tampermonkey 文档 示例:(个人经验) 在开发过程中有时候会遇到标签页之间需要通信,这时GM的相关方法就起到了很好作用,可以通过它来...
首先,我们使用关键字 @match 指定匹配的网站 URL,使用 @grant 设置权限 GM_log,使用关键字@run-at 指定执行时机为页面加载完成,即:document-end // ==UserScript== // @name 新闻查看更多 // @namespace com.xag.more // @version 0.1 // @license GNU General Public License v3.0 // @description 自...
log(data); }) .catch(error => { console.error(error); }); 在上面的代码中,fetch函数用于获取API的数据,response.json()方法用于将响应转换为JSON格式,data变量用于存储获取到的数据。 需要注意的是,跨域获取数据可能会受到一些限制和限制,例如: 跨域获取数据可能会受到浏览器的限制,例如:某些浏览器可能会...