Discord Pro Mode

Discord mod mods

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Discord Pro Mode
// @namespace    trysten
// @version      0.2.0
// @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.altKey) {
          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;
              console.log(sidebar.style.width);
              if (sidebar.style.width == "" || sidebar.style.width == "418px") {
                var newstate = "836px";
              }
              else if (sidebar.style.width == "836px") {
                var newstate = "100%";
              }
              else {
                var newstate = "418px"
              }
                sidebar.style.width = newstate;
                e.preventDefault();
                break;
              default:
                Function.prototype(); //noop lol
                break;
            }
        }
    }
    document.addEventListener('keydown', respond, false);
})();