Reddit Sidebar Offscreen

Moves Reddit right sidebar offscreen, uses "q" to toggle

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Reddit Sidebar Offscreen
// @namespace    https://jyoko.github.io/
// @version      1.4
// @description  Moves Reddit right sidebar offscreen, uses "q" to toggle
// @author       jyoko
// @include      http*://*.reddit.com*
// @grant        none
// ==/UserScript==
/* jshint -W097 */
'use strict';

if (window.hasOwnProperty('$')) {
  window.addEventListener('keyup', function(e) {
    if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return;
    if (e.keyCode === 81) { // q
      toggler($('.side'));
    }
  });
  toggler($('.side'));
}
// Full credit to /u/GameFreak4321 here, excellent idea
// https://www.reddit.com/r/Enhancement/comments/swp8s/feature_request_a_button_to_hide_the_sidebar
function toggler(side) {
  if (side.hasClass('RESSidebarHide')){
    side.css('margin-right', '0px').removeClass('RESSidebarHide');
  } else {
    side.css('margin-right','-'+side.width()+'px').addClass('RESSidebarHide');
  }            
}