Reddit SideBar Hider

Hide the right sidebar in reddit, adds a tiny button to click to get it back

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Reddit SideBar Hider
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Hide the right sidebar in reddit, adds a tiny button to click to get it back
// @author       You
// @match        http*://www.reddit.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    var wrap_el =  document.createElement("div");
    var cont_el =  document.createElement("div");
    var header = document.getElementById("header");

    wrap_el['style'] = ["width:10px",
                        "height:10px",
                        "float:right",
                        ].join(';');
    cont_el['style'] = ["position:absolute",
                        "z-index:9999",
                        "right:0",
                        "border: thin solid orange",
                        "color: #0099FF",
                        "background-color:white",
                        "cursor: pointer",
                        "user-select: none",
                        "-webkit-user-select: none",
                        "-moz-user-select: none",
                        "-ms-user-select: none",
                        "-webkit-touch-callout: none",
                        ].join(';');
    cont_el.textContent = '+';
    header.appendChild(wrap_el);
    wrap_el.appendChild(cont_el);

    var sidebar = document.querySelector(".side");
    sidebar.style.display = 'none';

    cont_el['onclick'] = function(){
        sidebar.style.display = sidebar.style.display == 'none'? '' : 'none';
        cont_el.textContent = sidebar.style.display == 'none'? '+' : '—';
    };
})();