这里有什么问题; 它不点击?
我的代码:
// ==UserScript==
// @name premiumleech
// @namespace premiumleech
// @include http://generator.premiumleech.com/link/*.html
// @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.
*/
/*
<p class="leech-btn"><button onclick="javascript:window.open('http://generator.premiumleech.com/redir/BtPpnGJv2HcZRa2BTxsEQzUdDQbb6WO1','_blank');">Leech it!</button></p>
*/
/*
/html/body/div[2]/div/section/p[2]
*/
var targBtn = $("#content > p.leech-btn > button");
if (targBtn.length) {
targBtn[0].click ();
}
我首先尝试了 JavaScript,但未能将其调整为queryselector
“在 Weired 按钮上找不到任何单词”并 get..ByTagName 至少对我来说没有明显的原因而失败
function clickc()
{
var el = document.querySelector("_blank"); or document.getElementsByTagName("TABLE");
var evt = document.createEvent("MouseEvents");
event.initMouseEvent("click", true, true, window,
0, 0, 0, 0, 0,
false, false, false, false,
0, null);
el.dispatchEvent(evt);
}