Skip to content

Instantly share code, notes, and snippets.

@panozzaj
Created March 15, 2021 14:53
Show Gist options
  • Select an option

  • Save panozzaj/d9a7d2b7591df06115cd85dc5e705e17 to your computer and use it in GitHub Desktop.

Select an option

Save panozzaj/d9a7d2b7591df06115cd85dc5e705e17 to your computer and use it in GitHub Desktop.

Revisions

  1. panozzaj created this gist Mar 15, 2021.
    91 changes: 91 additions & 0 deletions index.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,91 @@
    // ==UserScript==
    // @name StackExchange cleanup
    // @description Remove some elements on StackExchange pages
    // @include https://stackoverflow.com/*
    // @include https://meta.stackoverflow.com/*
    // @include https://superuser.com/*
    // @include https://meta.superuser.com/*
    // @include https://serverfault.com/*
    // @include https://meta.serverfault.com/*
    // @include https://askubuntu.com/*
    // @include https://meta.askubuntu.com/*
    // @include https://answers.onstartups.com/*
    // @include https://meta.answers.onstartups.com/*
    // @include https://nothingtoinstall.com/*
    // @include https://meta.nothingtoinstall.com/*
    // @include https://seasonedadvice.com/*
    // @include https://meta.seasonedadvice.com/*
    // @include https://crossvalidated.com/*
    // @include https://askdifferent.com/*
    // @include https://meta.crossvalidated.com/*
    // @include https://stackapps.com/*
    // @include https://*.stackexchange.com/*
    // @exclude https://chat.stackexchange.com/*
    // @exclude https://api.*.stackexchange.com/*
    // @exclude https://data.stackexchange.com/*
    // @exclude https://area51.stackexchange.com/*
    // @require http://code.jquery.com/jquery-latest.min.js
    // @grant none
    // @match */questions/*
    // ==/UserScript==

    console.log('here in StackOverflow cleanup script');

    var $ = window.jQuery;
    var SEsuccess = false;

    function hideStuff() {
    SEsuccess = true;

    //$('body').css({ 'background-color': '#fdf0f2' });

    // top bar stuff hiding
    $('.user-logged-in').hide();
    $('.-marketing-link').hide();

    // hide header and footer
    //$('header').hide();
    $('footer').hide();

    // Ask a question button
    $('.aside-cta').hide();

    $("#hot-network-questions").hide();
    $('#hireme').hide();
    $('.everyonelovesstackoverflow').hide();
    $(".community-bulletin").hide();
    $('.module.community-bulletin').hide();
    $('#js-gdpr-consent-banner').hide();

    // hide left sidebar
    $('.left-sidebar').hide();

    // expand main content
    $('#mainbar').css('width', '100%');

    // some random ad thing
    $('#newsletter-ad').hide();

    // RIGHT SIDEBAR
    // push to bottom of page and expand
    $('#sidebar').css({ float: 'none', width: '600px'});

    // remove StackOverflow promotions
    $('.mb16').hide()

    // remove spacer element
    $('.js-sidebar-zone').hide();

    // remove chat element
    $('.js-chat-ad-rooms').hide();
    $('#chat-feature').hide();
    // END RIGHT SIDEBAR
    }

    hideStuff();
    setTimeout(hideStuff, 100);
    setTimeout(hideStuff, 250);
    setTimeout(hideStuff, 500);
    setTimeout(hideStuff, 1000);
    setTimeout(hideStuff, 1500);
    setTimeout(hideStuff, 2000);