Skip to content
Snippets Groups Projects
Commit a95ae491 authored by Hugo Hörnquist's avatar Hugo Hörnquist
Browse files

Made reddit sidebar sticky.

parent 13f862ce
No related branches found
No related tags found
No related merge requests found
// ==UserScript==
// @name old.reddit hide sidebar
// @namespace http://hugo.hornquist.se
// @version 1.2.1
// @version 1.2.2
// @description Adds toggle to hide Reddit sidebar
// @author hugo@lysator.liu.se
// @match https://*.reddit.com/*
......@@ -18,18 +18,32 @@
let btn = document.createElement('button');
let div = document.createElement('div');
let inner = document.createElement('div')
div.style = `
position: absolute;
z-index: 100;
left: -2em;
width: 2em;
height: 2em;
display: grid;
height: 100%;
top: 0;
padding: 0;
`
div.appendChild(btn);
inner.style = `
position: sticky;
top: 0;
height: 2em;
`
btn.style = `
width: 100%;
height: 100%;
display: grid;
place-items: center;
`
inner.appendChild(btn)
div.appendChild(inner);
let sidebar = document.getElementsByClassName('side')[0];
sidebar.appendChild(div);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment