Greasy Fork

Greasy Fork is available in English.

[Premium] Coinpayu.com

Open and close Framed and Frameless Ads

当前为 2024-05-13 提交的版本,查看 最新版本

在您安装前,Greasy Fork 希望您知道此脚本声明其包含了一些负面功能。这些功能也许会使脚本作者获利,而不能给您带来任何直接的金钱收益。

作者可从这份脚本获得佣金,例如通过修改链接地址或提供优惠券代码以包含推荐或附属代码。 脚本作者的说明: Referral-Link is in this Script integrated.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         [Premium] Coinpayu.com
// @namespace    http://greasyfork.icu/users/1162863
// @version      2.4
// @description  Open and close Framed and Frameless Ads
// @author       Andrewblood
// @icon         https://coinfinity.top/favicon.ico
// @match        *://*.coinpayu.com/*
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        window.close
// @grant        window.focus
// @antifeature  referral-link     Referral-Link is in this Script integrated.
// @license      Copyright Andrewblood
// ==/UserScript==

(async function() {
    'use strict';

    var overlayStyle = `
    #overlay {
        position: fixed !important;
        right: 10px !important;
        bottom: 10px !important;
        width: 300px !important;
        height: 230px !important;
        background-color: rgba(0, 0, 0, 0.8) !important;
        color: white !important;
        padding: 10px !important;
        z-index: 9999 !important;
        font-size: 16px !important;
        display: flex;
        flex-direction: column;
    }

    #overlay h2 {
        font-size: 20px;
        margin-bottom: 10px;
        text-align: center;
        color: white;
    }

    .checkbox-container {
        display: flex;
        align-items: center;
        margin-left: 40px;
        margin-bottom: 5px;
    }

    .checkbox-container label {
        color: white;
        margin-left: 5px;
    }

    #overlay button {
        margin-top: auto;
        align-self: center;
    }

    #info-overlay {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 80%;
        height: 80%;
        background-color: rgba(0, 0, 0, 0.8);
        color: white;
        z-index: 99999;
        padding: 20px;
        display: none;
        overflow-y: auto;
    }

    #info-overlay h2 {
        text-align: center;
        color: white;
    }

    #info-overlay a {
        color: red;
    }
`;

    GM_addStyle(overlayStyle);


    var overlay = document.createElement('div');
    overlay.id = 'overlay';

    overlay.innerHTML = '<h2>Coinpayu.com Script</h2>';

    var framedadsCheckboxContainer = document.createElement('div');
    framedadsCheckboxContainer.classList.add('checkbox-container');
    framedadsCheckboxContainer.innerHTML = `
        <input type="checkbox" id="framedads-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="framedads-checkbox">Framed Ads</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(framedadsCheckboxContainer);

    var framelessadsCheckboxContainer = document.createElement('div');
    framelessadsCheckboxContainer.classList.add('checkbox-container');
    framelessadsCheckboxContainer.innerHTML = `
        <input type="checkbox" id="framelessads-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="framelessads-checkbox">Frameless Ads</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(framelessadsCheckboxContainer);

    var closeCheckboxContainer = document.createElement('div');
    closeCheckboxContainer.classList.add('checkbox-container');
    closeCheckboxContainer.innerHTML = `
        <input type="checkbox" id="close-checkbox"> <!-- Kästchen zum Ankreuzen -->
        <label for="close-checkbox">Close after work</label> <!-- Text neben dem Kästchen -->
    `;
    overlay.appendChild(closeCheckboxContainer);

    var moreInfoButton = document.createElement('button');
    moreInfoButton.textContent = 'More Info';
    moreInfoButton.addEventListener('click', openInfoOverlay);

    overlay.appendChild(moreInfoButton);

    document.body.appendChild(overlay);

    function openInfoOverlay() {
        var infoOverlay = document.getElementById('info-overlay');
        if (!infoOverlay) {
            infoOverlay = document.createElement('div');
            infoOverlay.id = 'info-overlay';
            infoOverlay.innerHTML = `
                <h2>Additional Information</h2>
                <p>
                	At first the Script is only tested with an active Membership. (update comes)<br>
                    Go to the Ad page and it start after reloading the page.<br>
                    Framed Ads: It opens the first aviable site in the list and stay on it, when one site is completed it starts with the Next.<br>
	                When all sites completed it goes to Framless Ads.<br>
	                Frameless Ads: It opens and close site by site.<br>
	                When all sites completed it close coinpayu or go after 3 hour to Framless Ads and begin from new.<br>
                    You can activate and deactivate the functions in the Overlay as desired.<br>
                </p>
                <br>

           <h2>Download Captcha Solver</h2>
            <p>
				<b>HCaptcha + ReCaptcha:</b> NoCoding Data Scraper and CAPTCHA Solver - <a href="https://chromewebstore.google.com/search/minirpa" target="_blank">Install Here</a><br>
				<b>Antibot Words:</b> AB Links Solver - <a href="http://greasyfork.icu/de/scripts/459453-ab-links-solver" target="_blank">Install Here</a><br>
				<b>Cf-Turnstile:</b> Autopass Cloudflare CAPTCHA - <a href="http://greasyfork.icu/de/scripts/464785-autopass-cloudflare-captcha" target="_blank">Install Here</a><br>
            </p>
            <br>

    <h2>Support</h2>
    <p>
        If you have any questions or need assistance, don't hesitate to reach out the creator and supporter, <a href="http://greasyfork.icu/users/1162863" target="_blank">Andrewblood</a>.<br>
    </p>
    <br>

    <h2>Privacy Policy</h2>
    <p>
        This script stores user data locally within TamperMonkey and is exclusively used for script functionality.<br>
        It is not shared with the script creator or third parties.<br>
    </p>
    <br>

    <h2>Changelog</h2>
    <p>
        <b>Version v.2.3</b><br>
        Improved Ad closing<br>
        Improved waiting for ending of last activated function before start the next<br>
        <br>
        <b>Version v.2.2</b><br>
        New waiting for ending of last activated function before start the next<br>
        New Button/Overlay with more Infos<br>
        <br>
        <b>Version v.2.1</b><br>
        Improved Ad closing<br>
        <br>
        <b>Version v.2.0</b><br>
        New Overlay to chance the functions<br>
    </p>
            `;
            document.body.appendChild(infoOverlay);
        }
        infoOverlay.style.display = 'block';

        document.addEventListener('click', function(event) {
            if (!infoOverlay.contains(event.target) && event.target !== moreInfoButton) {
                closeInfoOverlay();
            }
        });
    }

    function closeInfoOverlay() {
        var infoOverlay = document.getElementById('info-overlay');
        if (infoOverlay) {
            infoOverlay.style.display = 'none';
        }
    }

    var framedadsCheckbox = document.getElementById('framedads-checkbox');
    framedadsCheckbox.addEventListener('change', function() {
        GM_setValue('framedadsStatus', framedadsCheckbox.checked);
    });

    var savedFramedAdsStatus = GM_getValue('framedadsStatus');
    if (savedFramedAdsStatus !== undefined) {
        framedadsCheckbox.checked = savedFramedAdsStatus;
    }

    var framelessadsCheckbox = document.getElementById('framelessads-checkbox');
    framelessadsCheckbox.addEventListener('change', function() {
        GM_setValue('framelessadsStatus', framelessadsCheckbox.checked);
    });

    var savedFramelessAdsStatus = GM_getValue('framelessadsStatus');
    if (savedFramelessAdsStatus !== undefined) {
        framelessadsCheckbox.checked = savedFramelessAdsStatus;
    }

    var closeCheckbox = document.getElementById('close-checkbox');
    closeCheckbox.addEventListener('change', function() {
        GM_setValue('closeStatus', closeCheckbox.checked);
    });

    var savedCloseStatus = GM_getValue('closeStatus');
    if (savedCloseStatus !== undefined) {
        closeCheckbox.checked = savedCloseStatus;
    }

    if (window.location.href.includes("register")) {
        if (!document.cookie.includes("Andrewblood")) {
            window.location.href = "https://www.coinpayu.com/?r=Andrewblood";
        }
    }

    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();
    };

    // Funktion zur Ausführung der Framed-Ads-Aktion
    async function performFramedAdsAction() {
        if (savedFramedAdsStatus) {
            if (window.location.href.includes("coinpayu.com/dashboard/ads_active")) {
                await new Promise(resolve => {
                    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 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() {
                                            window.focus();
                                            window.location.reload();
                                        }, 1000);
                                    }
                                }, 1000);
                            }
                        } else {
                            window.location.replace("https://www.coinpayu.com/dashboard/ads_surf");
                        }
                        resolve();
                    }, 1000 * 3);
                });
            }

            if (window.location.href.includes("coinpayu.com/dashboard/view_active?id=")) {
                await new Promise(resolve => {
                    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);
                    resolve();

                });
            }
        }
    }

    // Funktion zur Ausführung der Frameless-Ads-Aktion
    async function performFramelessAdsAction() {
        if (savedFramelessAdsStatus && window.location.href.includes("coinpayu.com/dashboard/ads_surf")) {
            await new Promise(resolve => {
                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);
                                    resolve();
                                    window.location.reload();
                                }
                            }, 1000);
                        }
                    } else {
                        resolve();
                    }
                }, 1000 * 3);
            });
        }
    }

    // Funktion zur Ausführung der Schließ-Aktion
    async function performCloseAction() {
        if (savedCloseStatus && window.location.href !== "https://www.coinpayu.com/") {
            await new Promise(resolve => {
                setTimeout(function() {
                    window.close();
                    resolve();
                }, 1000 * 5);
            });
        } else {
            await new Promise(resolve => {
                setTimeout(function() {
                    window.location.replace("https://www.coinpayu.com/dashboard/ads_active");
                    resolve();
                }, 1000*60*60*3);
            });
        }
    }
    // Die Aktionen werden nacheinander ausgeführt
    await performFramedAdsAction();
    await performFramelessAdsAction();
    await performCloseAction();

})();