相关疑难解决方法(0)

GM_setValue在哪里存储数据?

GM_setValue将数据存储在chrome中的哪个位置.我试图确定数据的去向,但无法弄明白.我用进程监视器进行监视,看到当我存储一个值时,chrome正在更新chrome_iwoeoiifoi2h3iofhufsdfnvdf类型的文件,然后用sqlite浏览器打开它但数据不存在.我查看了所有最近修改过的文件,试图查找数据但找不到它.

最新的chrome/TM.

google-chrome tampermonkey

6
推荐指数
1
解决办法
6703
查看次数

GM_getValue未定义(在注入的代码中)?

我看到GM_getValue未定义的错误,但我没有补助GM_getValueGM_setValue与定义的默认值.

示例代码:

// ==UserScript==
// @name        SO_test
// @include     https://stackoverflow.com/*
// @version     1
// @grant       GM_getValue
// @grant       GM_setValue
// ==/UserScript==

// Get jQuery thanks to this SO post:
// https://stackoverflow.com/a/3550261/2730823
function addJQuery(callback) {
    var script = document.createElement("script");
    script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js");
    script.addEventListener('load', function() {
        var script = document.createElement("script");
        script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
        document.body.appendChild(script);
    }, false);
    document.body.appendChild(script);
}

function main() {
$("#wmd-input").on("contextmenu", function(e) {
    e.preventDefault();
    console.log("GM_getValue: " + GM_getValue("extra_markdown", True));
});
}
addJQuery(main); …
Run Code Online (Sandbox Code Playgroud)

greasemonkey code-injection

6
推荐指数
1
解决办法
8332
查看次数

从网页调用Greasemonkey函数

我可以从我的页面调用我的自定义Greasemonkey的function()吗?

例如,

我创建了一个包含do_this()函数的GM脚本.我希望my-web-site.com调用do_this()函数.但我不能.

我知道,我可以通过做unsafeWindow.do_this()但这样做阻止我调用GM_xmlhttpRequest().

有任何想法吗?

greasemonkey

4
推荐指数
1
解决办法
5889
查看次数