相关疑难解决方法(0)

在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检查是否在页面上找到了文本

我确实对google和userscripts网站做了一些研究,但没有找到答案.

那么基本上如何检查页面上是否找到特定文本?并且文本没有特殊标签或任何东西.

text greasemonkey

5
推荐指数
1
解决办法
8277
查看次数

"正常"按钮单击方法在Greasemonkey脚本中不起作用?

这是页面上的按钮:

<a id="dispatchOnJobButton" class="ui-btn ui-btn-corner-all ui-shadow ui-btn-up-c" href="#" data-role="button" data-theme="c" data-disabled="false">
<span class="ui-btn-inner ui-btn-corner-all" aria-hidden="true">
<span class="ui-btn-text">Dispatch on next job</span>
</span>
</a>
Run Code Online (Sandbox Code Playgroud)


我需要Greasemonkey来点击它.我尝试了很多不同的方法,但似乎没有任何方法可以解雇它应该运行的任何函数.

var clickEvent = document.createEvent("MouseEvents");
clickEvent.initEvent("click", true, true);
document.getElementById('dispatchOnJobButton').dispatchEvent(clickEvent);

// also tried
document.getElementById('dispatchOnJobButton').click();
// and this
unsafeWindow.document.getElementById('dispatchOnJobButton').click();
Run Code Online (Sandbox Code Playgroud)

关于我可以尝试的其他事情的任何想法?

javascript greasemonkey click

3
推荐指数
1
解决办法
3110
查看次数

标签 统计

greasemonkey ×3

javascript ×2

click ×1

jquery ×1

tampermonkey ×1

text ×1