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等高级引擎兼容。