Last active
June 29, 2018 15:10
-
-
Save anovsiradj/f5ec2c289b53d0ee1e24b24be22c3e60 to your computer and use it in GitHub Desktop.
StackOverflow: Content First
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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