您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hides the channel list at the press of a button
当前为
// ==UserScript== // @name Discord Hide Channel List Button // @namespace http://tampermonkey.net/ // @version 0.1 // @description Hides the channel list at the press of a button // @author 20kdc // @match https://discordapp.com/channels/*/* // @grant none // ==/UserScript== // I release this user-script into the public domain. var mainFunc; var lastTryParent; mainFunc = function() { 'use strict'; // Toolbar instance tends to change setTimeout(mainFunc, 5000); const v = document.querySelector(".header-toolbar"); if (!v) return; if (lastTryParent == v) return; lastTryParent = v; const d = document.createElement("button"); d.type = "button"; d.class = "active"; // How Discord makes this work, I have no idea. (Also note this could break horribly if they change the SVG file of the cat.) d.innerHTML = "<span style=\"background-image: url('/assets/a860a4e9c04e5cc2c8c48ebf51f7ed46.svg');\"></span>"; v.appendChild(d); var toggleState = true; d.addEventListener("click", () => { const v2 = document.querySelector(".channels-wrap"); if (!v2) return; toggleState = !toggleState; if (toggleState) { d.class = "active"; v2.style.display = "inherit"; } else { d.class = ""; v2.style.display = "none"; } }); }; mainFunc();