Discord Pro Mode

Discord mod mods

目前为 2023-02-17 提交的版本。查看 最新版本

// ==UserScript==
// @name         Discord Pro Mode
// @namespace    trysten
// @version      0.1.2
// @description  Discord mod mods
// @author       trysten
// @match        https://*.discord.com/app
// @match        https://*.discord.com/channels/*
// @icon         https://discord.com/assets/847541504914fd33810e70a0ea73177e.ico
// @license      GPLv3
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    function respond(e) {
        // function showChar(e) {
        //     console.debug(`Key Pressed: ${e.key}\nCTRL key pressed: ${e.ctrlKey}\n`);
        // }
        // console.debug(showChar(e));

        if(e.ctrlKey) {
            switch (e.key) {
                // disappear left menu and use ctrl + k to be mega
                case '[':
                    var sidebar = document.getElementById('channels').parentElement.parentElement;
                    var newstate = sidebar.style.display == "none" ? "" : "none";
                    sidebar.style.display = newstate;
                    e.preventDefault();
                    break;
                // phat search
                case ']':
                    var sidebar = document.getElementById('search-results').parentElement.parentElement;
                    var newstate = sidebar.style.width == "836px" ? "418px" : "836px";
                    sidebar.style.width = newstate;
                    e.preventDefault();
                    break;
                default:
                    Function.prototype(); //noop lol
                    break;
            }
        }
    }
    document.addEventListener('keydown', respond, false);
})();