您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

Greasemonkey 1.0中的jQuery与使用jQuery的网站冲突

Greasemonkey 1.0中的jQuery与使用jQuery的网站冲突

Greasemonkey 1.0彻底改变了沙箱的工作方式,破坏了数千个脚本。这是一个很大的问题,我希望您能与我一起就该问题的主要错误报告表达您的意见/经验。

this.$ = this.jQuery = jQuery.noConflict(true);

…我不确定在所有情况下都可以使用。从副作用避免,DRY原理,原子编码原理来看,这是完全错误方法。我认为,最好的策略是还原沙箱。

通过指定一个@grant值(除外none)重新激活沙盒。编辑您的:

// @grant       GM_addStyle
// @grant       GM.getValue
// ==/UserScript==
/*- The @grant directive is needed to work around a design flaws introduced in GM 1.0
    and again in GM 4.0.
    It restores the sand@R_790_2419@.
*/

沙箱将被还原,所有冲突将得到解决。这些脚本将与Tampermonkey和Violentmonkey等高级引擎兼容。

JS 2022/1/1 18:12:31 有892人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶