相关疑难解决方法(0)

多次在同一页面上运行Greasemonkey脚本?

我是Greasemonkey,javascript的新手,实际上是所有UI的东西.

要求:用户脚本在页面加载后由GS运行一次.但是,我需要在不刷新的情况下多次运行相同的脚本

使用案例:例如,使用Ajax进行Amazon.com搜索.我需要在搜索结果中嵌入自定义元素.

每次在同一页面中进行搜索时,我都需要将我的内容注入search-results-div以及结果(没有页面刷新)

我当前的脚本仅在页面刷新时运行.

我希望上面的解释清楚.请帮忙.

javascript ajax greasemonkey tampermonkey

31
推荐指数
2
解决办法
1万
查看次数

在AJAX驱动的站点上选择并激活正确的控件

因此,我每次访问任何nike.com运动鞋页面(没有HTML链接)时都会尝试将其设置在哪里,它会自动选择我的鞋子尺寸,将其添加到购物车中,然后检查我.

我目前正在尝试使用这个脚本(下面),但是每次我去运动鞋页面时,它都没有正确添加我想要的鞋子尺寸,而是直接在我的购物车中没有任何东西结账.

我被告知我需要将代码与实际的页面HTML匹配,但我不知道该怎么做.请帮忙.

// ==UserScript==
// @name     _Nike auto-buy(!!!) script
// @include  http://*/*
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
// @require  https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant    GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
    introduced in GM 1.0.   It restores the sandbox.
*/

var okayToClickAddtoCart = false;

//-- Assumes that size is a standard <option> tag or similar...
waitForKeyElements (".selectBox-label[value='10']", selectShoeSize);

function selectShoeSize (jNode) {
    jNode.prop ('selected', true);

    okayToClickAddtoCart = true;
}


waitForKeyElements (".add-to-cart.nike-button", clickAddToCart);

function clickAddToCart (jNode) …
Run Code Online (Sandbox Code Playgroud)

javascript jquery greasemonkey tampermonkey

14
推荐指数
1
解决办法
1万
查看次数

我非常简单的Greasemonkey脚本没有运行?

我遇到了这个非常基本的Greasemonkey脚本的问题,很可能是元数据配置.

这是基本文件的完整源代码

// ==UserScript==
// @name        Google Hello
// @namespace   https://google.com
// @description Basic Google Hello
// @include     *
// @version     1
// ==/UserScript==

alert("hi google!");
Run Code Online (Sandbox Code Playgroud)

我应该在访问Google.com时运行此脚本,但警报不会弹出.有什么问题?

我试图用Firefox在Ubuntu上运行这个脚本.

javascript debugging firefox greasemonkey

14
推荐指数
1
解决办法
8938
查看次数