Skip to content

Instantly share code, notes, and snippets.

@hinxx
Created February 13, 2022 12:13
Show Gist options
  • Save hinxx/d00836c4d335a80a1bebce2917952a44 to your computer and use it in GitHub Desktop.
Save hinxx/d00836c4d335a80a1bebce2917952a44 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name Stackoverflow cleanup
// @description Remove the right sidebar, left sidebar, post form, footer, cookie consent. Based on https://greasyfork.org/users/293891.
// @version 1
// @grant none
// @include http*://stackoverflow.com/questions/*
// @include http*://serverfault.com/questions/*
// @include http*://superuser.com/questions/*
// @include http*://stackapps.com/questions/*
// @include http*://meta.stackoverflow.com/questions/*
// @include http*://*.stackexchange.com/questions/*
// @include http*://askubuntu.com/questions/*
// @include http*://answers.onstartups.com/questions/*
// @include http*://meta.mathoverflow.net/questions/*
// @include http*://mathoverflow.net/questions/*
// ==/UserScript==
(function(d){
var esidebar = d.getElementById('left-sidebar');
esidebar.parentNode.removeChild(esidebar);
esidebar = d.getElementById('sidebar');
esidebar.parentNode.removeChild(esidebar);
var efooter = d.getElementById('footer');
efooter.parentNode.removeChild(efooter);
var epostform = d.getElementById('post-form');
if (epostform != undefined) {
epostform.parentNode.removeChild(epostform);
}
var emainbar = d.getElementById('mainbar');
emainbar.style.width = "100%"
// cookie consent
var e = d.getElementsByClassName('js-consent-banner');
if (e.length != 0) {
e = e[0];
e.parentNode.removeChild(e);
}
e = d.getElementsByClassName('js-dismissable-hero');
if (e.length != 0) {
e = e[0];
e.parentNode.removeChild(e);
}
})(document);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment