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

Add reddit-hide-sidebar.

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #468 canceled
// ==UserScript==
// @name old.reddit hide sidebar
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Adds toggle to hide Reddit sidebar
// @author hugo@lysator.liu.se
// @match https://old.reddit.com/*
// @match https://www.reddit.com/r/*/wiki/*
// @match https://www.reddit.com/*
// @grant GM_addStyle
// @require https://code.jquery.com/jquery-3.3.1.min.js
// ==/UserScript==
(function() {
'use strict';
var visible = true;
let btn = $("<button>&gt;</button>");
let div = $("<div class='sidebar-toggle'></div>")
div.append(btn)
$("#header").append(div);
let sidebar = $(".side");
let speed = 500;
var active = false;
btn.click(function(ev) {
if (active) return;
active = true;
if (visible) {
sidebar.hide(speed, function () {
active = false;
btn.text("<");
});
} else {
sidebar.show(speed, function () {
active = false;
btn.text(">");
});
}
visible = !visible;
});
GM_addStyle(" \
.sidebar-toggle { \
position: absolute; \
z-index: 100; \
right: 0; \
bottom: 0; \
} \
.sidebar-toggle > button { \
width: 25px; \
height: 25px; \
}");
})();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment