From 4a97bbd3003ef0270388a249f812b4122f7561b1 Mon Sep 17 00:00:00 2001 From: Patrick Chong Date: Sun, 28 Mar 2021 13:32:12 +0800 Subject: [PATCH] v2.15: fixes hide server button not working after discord update --- hide-discord-sidebar.js | 11 +++++++++-- manifest.json | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hide-discord-sidebar.js b/hide-discord-sidebar.js index 362dde8..9115378 100644 --- a/hide-discord-sidebar.js +++ b/hide-discord-sidebar.js @@ -1,7 +1,14 @@ function hideDiscordSidebar() { /* SERVERS */ + + // Select the server list element, which changes in some updates. const guildsWrapper = document.getElementsByClassName('guildsWrapper-5TJh6A')[0] - || document.getElementsByClassName('wrapper-1Rf91z')[0]; + || document.getElementsByClassName('wrapper-1Rf91z')[0] + || document.getElementsByClassName('wrapper-3NnKdC')[0] + // Experimenting with document.querySelector("nav[class*=wrapper-]") + // as a general fallback to select the server list. + || document.querySelector("nav[class*=wrapper-]"); + const app = document.getElementsByClassName('base-3dtUhz')[0]; const btn = document.createElement("BUTTON"); @@ -99,7 +106,7 @@ function hideDiscordSidebar() { document.onreadystatechange = function () { if (document.readyState === "complete") { // Check that the Discord page contains the base chat element - if(document.getElementsByClassName('base-3dtUhz')[0]) { + if (document.getElementsByClassName('base-3dtUhz')[0]) { hideDiscordSidebar(); } } diff --git a/manifest.json b/manifest.json index 6cadab0..d96bb72 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "name": "Hide Discord Sidebar", "short_name": "Hide Dis Bar", - "version": "2.14", + "version": "2.15", "description": "Installs an unfolding sidebar for Discord channels and a button that hides/shows the Discord server list.", "manifest_version": 2, "permissions": ["*://*.discord.com/*", "storage", "declarativeContent"],