DM colorization

Makes each person DMing you have a different color for organization sake

Stan na 28-03-2023. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         DM colorization
// @namespace    https://dreamychat.com/*
// @version      0.1
// @description  Makes each person DMing you have a different color for organization sake
// @author       You
// @match        https://dreamychat.com/*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @require      http://code.jquery.com/jquery-latest.js
// @run-at   document-start
// @license MIT
// ==/UserScript==

var seed = 1;
function random() {
    var x = Math.sin(seed++) * 10000;
    return x - Math.floor(x);
}
let zzz = true;

function ChangeClr() {

    var rules = new Array();
    if (zzz) {
        zzz=false;
        for (let i = 0; i < document.styleSheets.length; i++) {

        //console.log("Here babe");
        if (document.styleSheets[i].cssRules) {
            rules = document.styleSheets[i].cssRules;
        }
        else if (document.styleSheets[i].rules) {
            rules = document.styleSheets[i].rules;
        }

        for(let j = 0; j < rules.length; j++) {
            if (String(rules[j].selectorText) == ".chat-invite.chat-self::after, .chat-invite.chat-to::after, .chat-whisper::after") {
                //document.styleSheets[0].deleteRule(rules[j]);
                rules[j].style = ".chat-invite.chat-self::after, .chat-invite.chat-to::after, .chat-whisper::after {border-width: 0 .25rem;}";
                document.styleSheets[i].cssRules[j] = rules[j];
            }
        }
    }
}
    var stuff = document.getElementsByClassName("chat-whisper");
    var bad = document.getElementsByClassName("chat-self");
    for (let i = 0; i < stuff.length; i++) {

        if (!Array.prototype.includes.call(bad, stuff[i])) {
            try {
                stuff[i].classList.remove("chat-mention");
            } catch {

            }

            var s = stuff[i].getElementsByClassName("name")[0];
            var aTags = s.getElementsByTagName("span");
            var t = aTags[0].textContent;

            //console.log(t);
            seed = t.charCodeAt(0)*t.charCodeAt(1);
            var r = random()*255;
            var g = random()*255;
            var b = random()*255;
            if (t == "RaeRae") {
                r = 189;
                g = 102;
                b = 231;
            }
            if (t == "cold_c4ssidy") {
                r = 255; g = 130; b = 201;
            }
            var color = "rgba("+r+","+g+","+b+",.35)";
            //console.log(color);
            stuff[i].style = "background: "+color+";border: solid "+color+";border-width: 0 0.25rem;";
            //stuff[i].style.display='none';
            //stuff[i].offsetHeight; // no need to store this anywhere, the reference is enough
            //stuff[i].style.display='';
        }
    }
};

var i = setInterval(ChangeClr,1000);

console.log("Dreamychat colored DMs loaded!");