在下面的页面中,我使用此页面测试http://nitroflare.com/view/A71F0994E20F2E0/security-privacy.jpg
下面的脚本单击缓慢下载并删除单击后显示的弹出广告。
我不想点击免费下载,它将首先弹出一个窗口,我想调用它的第二个单击函数,它是
function () {
$(this).hide();
$("#CountDownTimerContainer").show();
startFreeDownload();
}我的脚本执行$("#CountDownTimerContainer").show(),但由于某种原因它没有执行startFreeDownload()。
问题
我如何调用页面上的startFreeDownload()?
// ==UserScript==
// @name NitroFlare
// @namespace https://nitroflare.com/
// @description https://nitroflare.com/
// @include https://nitroflare.com/*
// @version 1
// @grant none
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @require https://greasyfork.org/scripts/5392-waitforkeyelements/code/WaitForKeyElements.js?version=115012
// ==/UserScript==
function SkipId(objId){
var oId = document.getElementById(objId);
oId.click();
}
window.onload = function(){
SkipId('slow-download');
};
waitForKeyElements("div.superbox-wrapper", removeSuperbox);
function removeSuperbox() {
document.getElementById('superbox-wrapper').hide();
}
$("#CountDownTimerContainer").show();
startFreeDownload();发布于 2016-11-13 14:06:58
document.getElementById返回一个DOM节点,它没有hide()方法。
可以手动使用jQuery:$('#superbox-wrapper').hide(),也可以使用waitForKeyElements,如其示例所示:
function removeSuperbox(jNode) {
jNode.hide();
}此外,由于您将自己的jQuery注入页面并使用@grant none,如果站点有自己的jQuery,则可能需要使用jQuery.noConflict()。
发布于 2016-11-13 10:42:54
(function (){
$("#CountDownTimerContainer").show();
console.log(0);
startFreeDownload();
})();
function startFreeDownload(){
console.log(1);
}试试这个,它应该对你有用。
https://stackoverflow.com/questions/40572809
复制相似问题