ozokfan

turns a specific user that does not like ozok into a huge ozok fan by replacing their username and profile picture

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         ozokfan
// @namespace    http://tampermonkey.net/
// @version      1
// @description  turns a specific user that does not like ozok into a huge ozok fan by replacing their username and profile picture
// @license      MIT
// @author       You
// @match        *://discord.com/*
// @run-at       document-start
// @grant        GM_addStyle
// @grant        GM_addElement
// @grant        GM_deleteValue
// @grant        GM_getValue
// @grant        GM_listValues
// @grant        GM_setValue
// @grant        GM_getResourceText
// @grant        GM_getResourceURL
// @grant        GM_registerMenuCommand
// @grant        GM_unregisterMenuCommand
// @grant        GM_notification
// @grant        GM_openInTab
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @grant        GM_download
// @grant        GM_log
// @grant        GM_info
// @grant        unsafeWindow
// ==/UserScript==

(function () {
    'use strict';
    const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
    const LOOP_INTERVAL_MS = 5;
    const src = "https://cdn.discordapp.com/avatars/1404082971224576132/592f7a18ca9a0bf993233006a20cc708.webp"
    const juser = "Anti-Ozok"

    async function doWork() {
        let elements = document.querySelectorAll('[src^="' + src + '"]');
        if (!(elements)) {
            return
        }
        elements.forEach((e, i) => {
            e.src = e.src.replace(src, "https://cdn.discordapp.com/avatars/1502128701821812836/10cffb0282b0190bdc54667da6dc4c06.webp")
            if (e.className.includes("clickable")) {
                e.setAttribute("name", "jason")
            }
            if (e.className == "avatar__44b0c") {
                e.setAttribute("name", "jason2")
            }
        });
        elements = document.getElementsByName("jason")
        if (!(elements)) {
            return
        }
        elements.forEach((e, i) => {
            let elm = e.parentElement.children[1]
            if (elm) {
                elm = elm.firstElementChild
                let ozokfan = document.createElement("span");
                ozokfan.className = "username_c19a55 clickable_c19a55"
                ozokfan.setAttribute('aria-expanded', 'false');
                ozokfan.dataset.text = "I ❤️ Ozok"
                ozokfan.role = elm.role
                ozokfan.tabIndex = 0
                ozokfan.innerHTML = 'I <span class="emoji_e5de78">❤️</span> Ozok'
                elm.replaceWith(ozokfan);
            }
        });
        elements = document.getElementsByName("jason2")
        if (!elements) {return}
        elements.forEach((e, i) => {
            if(e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getAttribute('aria-label')) {
                if(e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.getAttribute('aria-label').includes(juser)) {
                e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.children[1].firstElementChild.firstElementChild.firstElementChild.innerHTML = "I ❤️ Ozok"}
            }
            else if(e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className == "inner_c0bea0") {
                e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.children[2].firstElementChild.firstElementChild.firstElementChild.firstElementChild.innerHTML = "I ❤️ Ozok"
                e.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.firstElementChild.children[2].firstElementChild.children[1].children[2].firstElementChild.children[1].innerHTML = "I ❤️ Ozok"
            }
        });
    }
    (async function loop() {
        while (true) {
            try {
                await doWork();
            } catch (e) {
                console.log(e)
            }
            await delay(LOOP_INTERVAL_MS);
        }
    })();
})();