WhatIsMyName / Best PetriDish.pw Mod. Stable

// ==UserScript==
// @name         Best PetriDish.pw Mod. Stable
// @version      2.51
// @description  DARK THEME. Macro feed/play/change color. Bots. Extra Zoom. Spam. And More. Final.
// @match        http://petridish.pw/ru/
// @match        http://petridish.pw/en/
// @match        http://petridish.pw/fr/
// ==/UserScript==
/**Thx for install!**/
function keydown(a) {
    r.dev && r.log("Click = " + a.keyCode), 81 != a.keyCode || r.feed || (r.feed = !0, feed()), 113 != a.keyCode || r.connect ||
        (r.connect = !0, conr()), 88 != a.keyCode || isSpectating || (r.zoom = !0, setUnlimitedZoom(!0), setSpectate(!0)),
        115 != a.keyCode || r.recon || (r.prevnick = $("#nick")
            .val(), r.prevpass = $("#password")
            .val(), insert(r.bot, "WTF"), r.recon = !0, recon()), 120 == a.keyCode && !r.next && selectedServer && (r.prevnick =
            $("#nick")
            .val(), r.prevpass = $("#password")
            .val(), insert(r.bot, "WTF"), r.next = !0, r.servv = $('li[style="display: flex;"]'), nextserv())
}

function keyup(a) {
    81 == a.keyCode && (r.feed = !1), 113 == a.keyCode && (r.connect = !1), 88 == a.keyCode && r.zoom && (r.zoom = !1,
        setUnlimitedZoom(!1), setSpectate(!1)), 115 == a.keyCode && r.recon && (r.recon = !1, socketStateNew = 1,
        setTimeout(insert(r.prevnick, r.prevpass), r.speedr)), 120 == a.keyCode && r.next && (r.next = !1,
        setTimeout(insert(r.prevnick, r.prevpass), r.speedr))
}

function conr() {
    r.connect && (playbtnclick(), setTimeout(conr, r.speedc))
}

function feed() {
    r.feed && "SNAKERDISH" !== currentmode && (window.onkeydown({
        keyCode: 87
    }), window.onkeyup({
        keyCode: 87
    }), setTimeout(feed, r.speedw))
}

function recon() {
    r.recon && (socketStateNew = 0, playbtnclick(), playbtnclick(), setTimeout(recon, r.speedr))
}

function nextserv() {
    r.next && (0 === $(".server-item.active")
        .next('[style="display: flex;"]')
        .length ? $('.server-item[style="display: flex;"]')[0].click() : $(".server-item.active")
        .next('[style="display: flex;"]')
        .click(), playbtnclick(), setTimeout(nextserv, 600))
}
$("#option-common ul")
    .append(
        '<li><span>Color Blink</span> <input type="checkbox" class="checkbox" id="cblink"> <label for="cblink"></label> </li><li><span>Style OFF</span> <input type="checkbox" class="checkbox" id="stule"> <label for="stule"></label> </li><li><span>Dev-Mode</span> <input type="checkbox" class="checkbox" id="devm"> <label for="devm"></label> </li>'
    ), $(".add")
    .replaceWith(
        '<div class="info-landing" style="min-width: 300px; max-height: 280px;"> <h2>Mod support!</h2> <div style="height: 10px;"></div><div class="set-group"> <div class="set"> <div class="hot-latter"><span>Q</span></div><p>– Feed</p></div><div class="set"> <div class="hot-latter"><span>F2</span></div><p>– Fast click play</p></div><div class="set"> <div class="hot-latter"><span>F4</span></div><p>– Reconnect</p></div><div class="set"> <div class="hot-latter"><span>F9</span></div><p>– Next Server</p></div><div class="set"> <div class="hot-latter"><span>X</span></div><p>– Inf zoom</p></div><div class="set"> <h3> Check settings!</h3> </div></div></div>'
    ), $("body")
    .append(
        '<link id="stylish-1" rel="stylesheet" type="text/css" href="https://dl.dropbox.com/s/tqi6mflpreg94j3/darkmin.css">'
    );
var r = {
    speedw: 10,
    speedc: 50,
    speedr: 400,
    bot: "ня.su/bqy",
    style: $("#stylish-1"),
    stule: $("#stule"),
    cblink: $("#cblink"),
    devm: $("#devm"),
    log: function (a) {
        console.log("%cModPD:%c%s", "background: #F64747; color: #fff; padding: 4px;",
            "background: #E4F1FE; color: #000; padding: 2px;", a)
    }
};
readCookie("offstyle") ? (r.stule.attr("checked", "checked"), r.style.detach(), r.log("Style is off")) : r.log(
        "Style is on"), readCookie("dev") && (r.dev = !0, r.devm.attr("checked", "checked"), r.log("Dev-Mode is on")),
    window.addEventListener("keydown", keydown), window.addEventListener("keyup", keyup), r.cblink.click(function () {
        $("#cblink")
            .is(":checked") ? (r.log("Color blink start"), sendCol(), interval = setInterval(function () {
                clickColor("#FFFFFF", 0), sendCol()
            }, 1e4)) : (clearInterval(interval), r.log("Color blink end."))
    }), r.devm.click(function () {
        r.devm.is(":checked") ? (createCookie("dev", !0, 10), r.dev = !0) : (eraseCookie("dev"), r.dev = void 0)
    }), r.stule.click(function () {
        r.stule.is(":checked") ? (r.style.detach(), createCookie("offstyle", !0, 10)) : (r.style.appendTo("body"),
            eraseCookie("offstyle"))
    });