// ==UserScript== // @name [New] Coinpayu.com // @namespace https://greasyfork.org/users/1162863 // @version 3.0 // @description Open and close Framed and Frameless Ads // @author Andrewblood // @match *://*.coinpayu.com/* // @match *://*.coinfinity.top/* // @icon https://www.google.com/s2/favicons?sz=64&domain=coinpayu.com // @grant window.close // @antifeature referral-link Referral-Link is in this Script integrated. // @license Copyright Andrewblood // @downloadURL none // ==/UserScript== (function() { 'use strict'; var oldfunction = unsafeWindow.open; var windowName = ""; function newFunction(params1, params2) { if (!params2 || params2 == "_blank") { windowName = "popUpWindow"; } else { windowName = params2; } return oldfunction(params1, windowName); }; unsafeWindow.open = newFunction; unsafeWindow.onbeforeunload = function() { unsafeWindow.open('', windowName).close(); }; if (window.location.href.includes("register")) { if (!window.location.href.includes("Andrewblood")) { window.location.href = "https://www.coinpayu.com/register?r=Andrewblood"; } } if (window.location.href === "https://www.coinpayu.com/" || window.location.href.includes("index")) { if (!window.location.href.includes("Andrewblood")) { window.location.href = "https://www.coinpayu.com/?r=Andrewblood"; } } setTimeout(function() { document.querySelector("#toViewAds").click(); }, 1000 * 2); setTimeout(function() { var elements = document.querySelectorAll('.clearfix.ags-list-box:not(.gray-all.clearfix.ags-list-box)'); if (elements.length > 0) { var firstElement = elements[0].querySelector('.text-overflow.ags-description > span'); var timeElement = elements[0].querySelector('.ags-detail-time span'); var urlElement = elements[0].querySelector('.text-overflow.ags-description'); var url = urlElement.getAttribute('title'); var time = parseInt(timeElement.textContent); console.log('Open ' + url + ' for ' + time + ' seconds.'); urlElement.removeAttribute('title'); if (firstElement) { firstElement.click(); unsafeWindow.open('', windowName).close(); var interval = setInterval(function() { var alertElement = document.querySelector(".alert-div.alert-green"); if (alertElement) { clearInterval(interval); window.location.reload(); } }, 1000); } } else { document.querySelector("#viewads > div:nth-child(2) > p").click(); } }, 1000 * 3); setTimeout(function() { if (document.querySelector("#app > div > div.coinpayu-dashboard-content > div.main-panel > div > div > h6").innerText.includes("Framed Ads")) { var elements = document.querySelectorAll('.clearfix.ags-list-box:not(.gray-all.clearfix.ags-list-box)'); if (elements.length > 0) { var firstElement = elements[0].querySelector('.text-overflow.ags-description > span'); var timeElement = elements[0].querySelector('.ags-detail-time span'); var url = elements[0].querySelector('.text-overflow.ags-description').getAttribute('title'); var time = parseInt(timeElement.textContent); console.log('Open ' + url + ' for ' + time + 'seconds.'); if (firstElement) { firstElement.click(); var interval = setInterval(function() { var alertElement = document.querySelector(".alert-div.alert-green"); if (alertElement) { clearInterval(interval); setTimeout(function() { unsafeWindow.open('', windowName).close(); window.location.reload(); }, 1000); } }, 1000); } } else { window.close(); } } }, 1000 * 5); if (window.location.href.includes("coinpayu.com/dashboard/view_active?id=")) { var intervalId = setInterval(function() { var waittime = document.querySelector("#app > div > div > div > div > div"); if (waittime && waittime.style.width === "100%") { clearInterval(intervalId); setTimeout(function() { window.close(); }, 500); } }, 100); } })();