2

我必须点击“Ik neem er een!” 与 Greasemonkey 链接。

链接(位于http://www.ibood.com/nl/nl):

<div class="box_order_btn">
    <a class="btn_order nl" href="https://order.ibood.com/nl/nl/order/?id=33869&amp;h=e82f93d244de247a3b73477381eb8a40" title="Ik neem er een!">Ik neem er een!</a>
    <span class="sold_out">Uitverkocht!</span>
</div>

我试过的 Greasemonkey 脚本:

// ==UserScript==
// @name           Click the link
// @include        https://*.ibood.com/*
// @version       1.0
// @history       1.0 Initial release       
// ==/UserScript==

var TargetLink          = $("a:contains('Ik neem er een!')")

if (TargetLink  &&  TargetLink.length) 
    window.location.href    = TargetLink[0].href
4

1 回答 1

1

该脚本使用 jQuery(该$(...)位是一个强有力的指标),但在元数据部分没有使用@requirejQuery。

利用:

// ==UserScript==
// @name     Ibood, click the link
// @include  https://*.ibood.com/*
// @include  http://*.ibood.com/*
// @version  1.0
// @history  1.0 Initial release
// @require  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.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 TargetLink          = $("a:contains('Ik neem er een!')")
if (TargetLink.length)
    window.location.assign (TargetLink[0].href);
于 2013-02-24T09:40:45.077 回答