2014-12-25 21:25:59 +00:00
|
|
|
// ==UserScript==
|
|
|
|
// @name Reddit hide sidebar
|
|
|
|
// @namespace reddit.com/u/GoldenSights
|
|
|
|
// @version 0.2
|
|
|
|
// @description Hide the reddit sidebar with a simple button
|
|
|
|
// @author GoldenSights
|
|
|
|
// @match *://*.reddit.com/*
|
|
|
|
// @grant none
|
2014-12-26 01:30:36 +00:00
|
|
|
// @updateURL http://raw.githubusercontent.com/voussoir/else/master/RedditHidebar/hidebar.js
|
2014-12-25 21:25:59 +00:00
|
|
|
// ==/UserScript==
|
|
|
|
|
|
|
|
function togglesidebar()
|
|
|
|
{
|
|
|
|
var sidebar = document.querySelector(".side");
|
|
|
|
if (sidebar.style.overflow == "hidden")
|
|
|
|
{
|
|
|
|
sidebar.style.height = "";
|
|
|
|
sidebar.style.width = "";
|
|
|
|
sidebar.style.overflow = "visible";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sidebar.style.height = "19px";
|
|
|
|
sidebar.style.width = "47px";
|
|
|
|
sidebar.style.overflow = "hidden";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var togglebutton = document.createElement("button");
|
|
|
|
var toggletext = document.createTextNode("Hidebar");
|
|
|
|
togglebutton.appendChild(toggletext);
|
|
|
|
|
|
|
|
togglebutton.addEventListener("click", togglesidebar);
|
|
|
|
togglebutton.style.fontSize = "9px";
|
|
|
|
togglebutton.style.position = "absolute";
|
|
|
|
togglebutton.style.right = "4px";
|
|
|
|
togglebutton.style.zIndex = "2";
|
|
|
|
togglebutton.style.color = "#000";
|
|
|
|
|
|
|
|
var sidebar = document.querySelector(".side");
|
|
|
|
var spacer = sidebar.querySelector(".spacer");
|
|
|
|
sidebar.insertBefore(togglebutton, spacer);
|