Skip to content

Instantly share code, notes, and snippets.

@anovsiradj
Last active June 29, 2018 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anovsiradj/f5ec2c289b53d0ee1e24b24be22c3e60 to your computer and use it in GitHub Desktop.
Save anovsiradj/f5ec2c289b53d0ee1e24b24be22c3e60 to your computer and use it in GitHub Desktop.
StackOverflow: Content First
// ==UserScript==
// @name StackOverflow: Content First
// @description remove unused html elements on stackoverflow.
// @namespace https://gist.github.com/anovsiradj
// @version 2018.06.29
// @author Mayendra Costanov (anovsiradj)
// @include *://stackoverflow.com/questions/*
// @run-at document-end
// @grant none
// ==/UserScript==
(function() {
'use strict';
$(document.scripts).each(function() {
if(this.src.indexOf('jquery') >= 0) return;
this.remove();
});
// head
$(document.head).children().each(function() {
if(/META|NOSCRIPT/.test(this.tagName)) this.remove();
if(this.tagName === 'LINK' && this.rel !== 'stylesheet') this.remove();
});
$(document.body).children('header,footer,script,noscript.iframe').remove();
// body.(unused element)
$('.everyonelovesstackoverflow', document.body).remove();
$('#custom-header,#left-sidebar,#notify-container,#hireme', document.body).remove();
// remove unused element on header
$('#question-header').each(function() {
$('div', this).remove();
});
$('#sidebar').each(function() {
$('#chat-feature', this).remove();
});
$('#mainbar').each(function() {
$('.votecell', this).find('input, .vote-up-off, .vote-down-off, .star-off').remove();
$('.user-gravatar32', this).remove();
$('#answers', this).each(function() {
$('.bottom-notice', this).remove();
});
$(this).parent().appendTo(document.body).prevAll().remove();
});
$('#post-form').remove();
document.body.style['padding-top'] = '0px';
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment