Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save machavity/420197ff9108e0b757c9bbb7d487f965 to your computer and use it in GitHub Desktop.
Save machavity/420197ff9108e0b757c9bbb7d487f965 to your computer and use it in GitHub Desktop.
Hide Stack Overflow Sidebar Userscript
// ==UserScript==
// @name Hide Stack Overflow Sidebar
// @namespace SOCVR
// @version 0.1
// @description Hides the sidebar
// @author Machavity
// @include /^https?:\/\/(.*\.)?stackoverflow\.com/.*$/
// @exclude *://chat.stackexchange.com/*
// ==/UserScript==
(function() {
'use strict';
document.getElementById('sidebar').style.display = 'none';
document.getElementById('mainbar').style = 'width: auto';
})();
@eriksmoljan
Copy link

Simple and it works. Thank you!

@xDroni
Copy link

xDroni commented Jun 25, 2023

It works, but the sidebar is still visible for a split second when the page loads. And you need to have user script manager installed.

A better option for me was to add an additional filter in uBlock Origin. I use this addon anyway, and it solves the above inconveniences.

! 2023-06-24 https://stackoverflow.com
stackoverflow.com###sidebar
stackoverflow.com###mainbar:style(width: auto !important)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment