Reddit Hidebar
This commit is contained in:
Voussoir 2014-12-25 13:25:59 -08:00
parent b078e9cf28
commit 6f74966b56
2 changed files with 48 additions and 0 deletions

8
RedditHidebar/README.md Normal file
View file

@ -0,0 +1,8 @@
Hidebar
======
"I thought this repository was for non-reddit stuff". Yeah, whatever.
This is a script to be used with the Tampermonkey extension on Google Chrome, or probably the FF equivalent. It creates a button that hides the reddit sidebar.
http://imgur.com/a/uz4r0

40
RedditHidebar/hidebar.js Normal file
View file

@ -0,0 +1,40 @@
// ==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
// ==/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);