Greasy Fork is available in English.
Remove the adclick nag and auto-click the buttons.
当前为
// ==UserScript==
// @name gplinks auto-skip
// @author BlazeFTL
// @namespace http://tampermonkey.net/
// @description Remove the adclick nag and auto-click the buttons.
// @version 2.1
// @match *://*/*
// @supportURL https://github.com/uBlockOrigin/uAssets/discussions/27472#discussioncomment-12725221
// @icon https://www.google.com/s2/favicons?domain=gplinks.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Function to execute the trick (fake iframe creation, remove SmileyBanner, and set ad cookie)
function executeTrick() {
// Create a fake iframe and set it as the active element (using your provided code)
const i = document.createElement('iframe');
i.style = 'height:0;width:0;border:0;';
i.id = 'a';
document.body.appendChild(i);
i.focus();
// Simulate the removal of SmileyBanner and trigger subsequent actions
$(".SmileyBanner").css("display", "none");
setTimeout(function () {
$(".myWaitingDiv").css("display", "block");
}, 3000);
// Simulate setting the ad cookie
var expireTime = new Date(new Date().getTime() + 2 * 60 * 1000); // 2 minutes
Cookies.set("adexp", 1, { expires: expireTime });
}
// Automatically click the Verify and Next buttons
let verifyClicked = false;
let nextClicked = false;
// Function to click a button if it's visible
function clickButtonIfVisible(buttonId) {
var button = document.getElementById(buttonId);
if (button && button.offsetWidth > 0 && button.offsetHeight > 0) {
button.click();
console.log(`Clicked ${buttonId}`);
return true;
}
return false;
}
// Function to handle the button clicks
function handleButtonClicks() {
// Only click VerifyBtn if not already clicked
if (!verifyClicked) {
verifyClicked = clickButtonIfVisible('VerifyBtn');
}
// Once VerifyBtn is clicked, check and click NextBtn (check the class 'NextBtn' for visibility and text)
if (verifyClicked && !nextClicked) {
var nextBtn = document.querySelector('.NextBtn');
if (nextBtn && nextBtn.offsetWidth > 0 && nextBtn.offsetHeight > 0) {
// Check if the text content is "CONTINUE"
if (nextBtn.textContent.trim() === "CONTINUE") {
nextBtn.click();
nextClicked = true; // Mark NextBtn as clicked
console.log("Clicked NextBtn");
}
}
}
}
// Check you are in the right site by checking that the buttons exits
const button1 = document.querySelector('#VerifyBtn');
const button2 = document.querySelector('#NextBtn');
if (button1 && button2){
// Run the trick after page load
window.onload = function() {
executeTrick();
};
// Set an interval to check for button clicks every second
setInterval(handleButtonClicks, 1000); // Check every second
}
})();