CGChat

The CodinGame web-chat without CodinGame.

目前為 2020-08-26 提交的版本,檢視 最新版本

// ==UserScript==
// @name        CGChat
// @namespace   BlaiseEbuth
// @match       https://www.codingame.com/*
// @grant       none
// @version     1.1.0
// @author      BlaiseEbuth
// @description The CodinGame web-chat without CodinGame.
// @icon https://i.imgur.com/E39sADi.png
// ==/UserScript==

'use strict';

function signin()
{
    document.getElementById("navigation").style.display = "none";
    document.getElementsByClassName("cg-cookies-banner")[0].style.display = "none";
    document.getElementsByClassName("cg-login-form_footer")[0].style.display = "none";
}

function chat()
{
    document.getElementsByClassName("left-column")[0].style.display = "none"; 
    document.getElementById("navigation").style.display = "none";
    
    document.getElementsByClassName("chat-wrapper")[0].style.cssText = "width:100% !important"; 
    document.getElementById("chat").style.cssText = "display:flex !important";
    
    var small = document.getElementsByClassName("small-chat");

    if(small.length == 1)
    {
        small[0].click();
    }

    document.getElementsByClassName("chat")[0].style.width = "100%";
    document.getElementById("messages").style.width = "100%";

    document.getElementsByTagName("cg-discord-disclaimer")[0].style.display = "none";

    document.getElementsByClassName("hide-wrapper")[0].style.display = "none";
    document.getElementsByClassName("help-center")[0].style.display = "none";

    var settings = document.getElementsByClassName("settings-popup");

    if(settings.length == 1)
    {
        for(var i = 0; i < 3; i++)
        {
            settings[0].children[i].style.display = "none";
        }
    }
}

var main = function()
{
    var path = window.location.pathname;  

    if(path  == "/start")
    {
        window.location.replace("/signin");
    }
    else if(path == "/signin")
    {
        signin();
    }
    else
    {
        chat();
    }
}

setInterval(main, 100);