Greasy Fork is available in English.

[New] Shortlink Maker

Enhances functionality on over 10 Shortlink-sites

// ==UserScript==
// @name         [New] Shortlink Maker
// @namespace    https://greasyfork.org/users/1162863
// @version      1.4.1
// @description  Enhances functionality on over 10 Shortlink-sites
// @author       Andrewblood
// @match        *://*/*
// @icon         https://coinfinity.top/favicon.ico
// @license      Copyright Andrewblood
// ==/UserScript==

(function() {
    'use strict';

    let helpers = {
        triggerMouseEvent: function (elm, eventType) {
            let clickEvent = document.createEvent('MouseEvents');
            clickEvent.initEvent (eventType, true, true);
            elm.dispatchEvent (clickEvent);
        },
        alternativeClick: function (elm) {
            helpers.triggerMouseEvent (elm, "mouseover");
            helpers.triggerMouseEvent (elm, "mousedown");
            helpers.triggerMouseEvent (elm, "mouseup");
            helpers.triggerMouseEvent (elm, "click");
        },
    }

    function waitForElementAndClick(selector) {
        let interval = setInterval(function() {
            let element = document.querySelector(selector);

            if (element && element.offsetHeight > 0 && !element.hasAttribute('disabled')) {
                helpers.alternativeClick(element);
                console.log("Element is clicked.");
                clearInterval(interval);
            }

        }, 500);
    }

    function waitForCaptchaAndClick(selector) {
        let interval = setInterval(function() {
            let element = document.querySelector(selector);
            let hcaptcha = document.querySelector(".h-captcha");
            let recaptcha = document.querySelector(".g-recaptcha");
            let recaptchaResponse = document.querySelector("#g-recaptcha-response");

            if (((hcaptcha && hcaptcha.lastElementChild.value.length > 0) || (recaptcha && recaptchaResponse.value.length > 0)) && (element && element.offsetHeight > 0 && !element.hasAttribute('disabled'))) {
                helpers.alternativeClick(element);
                console.log("Element is clicked.");
                clearInterval(interval);
            }

        }, 500);
    }

    function searchFirstButtonWithInnerText(text) {
        let interval = setInterval(function() {
            let buttons = document.querySelectorAll('button');

            for (let button of buttons) {
                if (button.innerText.includes(text) && !button.hasAttribute('disabled') && button.offsetHeight > 0) {
                    setTimeout(function () {
                        helpers.alternativeClick(button);
                        console.log("Element is clicked.");
                        clearInterval(interval);
                    }, 1000);
                    break;
                }
            }
        }, 500);
    }



    // FcLc
    if (window.location.href.includes("") ||
        window.location.href.includes("") ||
        window.location.href.includes("")){
        // waitForElementAndClick("");
        // waitForElementAndClick("");
    }

    // Ouo
    if (window.location.href.includes("ouo.press") ||
        window.location.href.includes("ouo.io")){
        waitForElementAndClick("#btn-main:not(.disabled)");
    }

    // ClksPro
    if (window.location.href.includes("financewrapper.net")){
        waitForCaptchaAndClick(".btn.btn-primary");
    }

    // Clicksfly
    if (window.location.href.includes("mythvista.com") ||
        window.location.href.includes("ss7.info") ||
        window.location.href.includes("vocalley.com") ||
        window.location.href.includes("yogablogfit.com") ||
        window.location.href.includes("healthfirstweb.com") ||
        window.location.href.includes("howifx.com")){
        waitForElementAndClick("#scroll > a > p");
        waitForElementAndClick("#getlink");
    }
    if (window.location.href.includes("clk.kim")){
        waitForElementAndClick(".btn:not(.disabled)");
        waitForCaptchaAndClick(".btn.btn-primary.btn-captcha");
    }

    // Cuty
    if (window.location.href.includes("cety.app")){
        waitForElementAndClick("#submit-button");
    }

    // CBShort
    if (window.location.href.includes("crazyblog.in") ||
        window.location.href.includes("videolyrics.in") ||
        window.location.href.includes("droplink") ||
        window.location.href.includes("tech5s.co")){
        waitForElementAndClick(".py-2.px-4");
        waitForElementAndClick(".btn.btn-success.btn-lg.get-link:not(.disabled)");
        waitForElementAndClick("#go_d");
        waitForElementAndClick("#go_d2");
        let interval = setInterval(function() {
            let element = document.querySelectorAll(".py-2.px-4")[1];
            if (element) {
                element.click();
                clearInterval(interval);
            }
        }, 500);
    }

    // Magnet + 1bitSpace
    if (window.location.href.includes("mgnet.xyz") ||
        window.location.href.includes("1bitspace.com") ||
        window.location.href.includes("1bit.space")){
        waitForElementAndClick("#continue-button");
        waitForElementAndClick(".button.is-rounded.is-fullwidth.is-outlined.is-link.rubberBand.animated.button-element-verification");
        waitForElementAndClick("#container-element-verification > div > button");
    }

    // FcLc
    if (window.location.href.includes("fc-lc.xyz") ||
        window.location.href.includes("fitdynamos.com") ||
        window.location.href.includes("gamezizo.com")){
        waitForElementAndClick("#invisibleCaptchaShortlink");
        waitForElementAndClick("#next");
        waitForElementAndClick("#scroll");
        waitForElementAndClick("#glink");
        waitForElementAndClick(".btn.btn-sm.btn-success.m-2:not(.disabled)");
    }

    // Cut-Urls
    if (window.location.href.includes("exego.app") ||
        window.location.href.includes("falpus.com")){
        waitForElementAndClick(".button.link-button:not(.disabled)");
    }

    // ClkSh
    if (window.location.href.includes("oii.la") ||
        window.location.href.includes("blogtechh.com") ||
        window.location.href.includes("wptohost.com")){
        waitForElementAndClick(".btn.btn-primary.btn-captcha");
        waitForElementAndClick("#scroll > a > p");
        waitForElementAndClick(".btn.btn-success:not(.disabled)");
    }

    // DutchyCorp2
    if (window.location.href.includes("dutchycorp.space") ||
        window.location.href.includes("dutchycorp.ovh")){
        waitForElementAndClick("#proceed > font > b");
        waitForElementAndClick("#cl1 > center > a > font > b");
        waitForElementAndClick("#click-btn > font");
        waitForElementAndClick("#invisibleCaptchaShortlink");
        waitForElementAndClick(".btn:not(.disabled)");
        let interval = setInterval(function() {
            let element = document.querySelectorAll("#click-btn > font")[1];
            if (element) {
                element.click();
                clearInterval(interval);
            }
        }, 500);
    }

    // ClkSh
    if (window.location.href.includes("blogsward.com") ||
        window.location.href.includes("blogtechh.com") ||
        window.location.href.includes("linkpay.top")){
        waitForElementAndClick("#begin-button");
        waitForElementAndClick("#continueBtn");
        waitForElementAndClick(".btn.btn-primary.btn-lg.get-link:not(.disabled)");
        if (document.querySelector("#wpsafe-link")){
            document.querySelector("#wpsafe-link").style.display = "block"
        }
    }

    // Fly
    if (window.location.href.includes("documentaryplanet.xyz") ||
        window.location.href.includes("substitutefor.com") ||
        window.location.href.includes("englishwritingsite.xyz") ||
        window.location.href.includes("sleeptube.xyz")){
        setTimeout(function () {
            if (document.querySelector("#click") && document.querySelector("#click").offsetHeight > 0){
                location.reload();
            }
        }, 1000);
        searchFirstButtonWithInnerText("Step");
    }



})();