Bypass MoviesMod Links

Swiftly go through Techmny to reach your destination link.

// ==UserScript==
// @name         Bypass MoviesMod Links
// @namespace    https://naeembolchhi.github.io/
// @version      0.5
// @description  Swiftly go through Techmny to reach your destination link.
// @author       NaeemBolchhi
// @license      GPL-3.0-or-later
// @icon         https://moviesmod.vip/wp-content/uploads/2022/10/moviesmod.png
// @match        https://techmny.com/*
// @match        https://en.techmny.com/*
// @match        https://oddfirm.com/*
// @match        https://tech.unblockedgames.world/*
// @match        https://links.modpro.blog/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

// Make everything disappear!
const voidCSS = `* {opacity: 0;z-index: -999999;}`;
function addStyle(css) {
    let head = document.querySelector('head'),
        style = document.createElement('style');
    style.innerHTML = css;
    head.appendChild(style);
}
let headObserver = new MutationObserver(function() {
    if (document.title) {
        if (!window.location.hostname.match(/unblockedgames/)) {return;}
        addStyle(voidCSS.replace(/\;/g,' !important;'));
        headObserver.disconnect();
    }
});
headObserver.observe(document.documentElement, {childList: true, subtree: true});

// Bypass Page 1 #landing
function action1() {
    if (!window.location.hostname.match(/unblockedgames/)) {return;}
    try {
        document.querySelector('#landing').submit();
        document.title = "Bypass Action (1/3)";
    } catch {}
}

// Bypass Page 2 #verify_button directly and skip waiting time
function action2() {
    if (!window.location.hostname.match(/unblockedgames/)) {return;}
    try {
        document.querySelector('#verify_button').click();
        document.title = "Bypass Action (2/3)";
    } catch {}
}

// Bypass Page 2 #two_steps_btn by waiting and redirecting when link appears
function action3() {
    if (!window.location.hostname.match(/unblockedgames/)) {return;}
    try {
        let observer = new MutationObserver(function() {
            if (document.querySelector('#two_steps_btn').href !== "") {
                observer.disconnect();
                document.title = "Bypass Action (3/3)";
                window.location = document.querySelector('#two_steps_btn').href;
            }
        });
        observer.observe(document.querySelector('#two_steps_btn'), {attributes: true});
    } catch {}
}

// Autoclick fast server
function action4() {
    if (!window.location.hostname.match(/links.modpro.blog/)) {return;}

    try {
        window.location.assign(document.querySelectorAll('a[href*="sid"]')[0].href);
    } catch {}
}

// Wait for page to be "complete"
document.onreadystatechange = function () {
    // Modify body when document is complete.
    if (document.readyState === 'complete') {
        action1();
        action2();
        action3();
        action4();
    }
}