gpt4 book ai didi

jquery - 为什么此链接 -"clicking"Greasemonkey 代码不起作用?

转载 作者:行者123 更新时间:2023-12-01 04:54:56 25 4
gpt4 key购买 nike

我必须点击“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

最佳答案

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

用途:

// ==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);

关于jquery - 为什么此链接 -"clicking"Greasemonkey 代码不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15050273/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com