Skip to content

Instantly share code, notes, and snippets.

@masukomi
Created January 31, 2023 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masukomi/7afd2b5d0e0e96cf2be8d9c65e10f9a4 to your computer and use it in GitHub Desktop.
Save masukomi/7afd2b5d0e0e96cf2be8d9c65e10f9a4 to your computer and use it in GitHub Desktop.
remove the right sidebar and enbiggen body text in elk
/*
Elk.zone (v0.6.2) has a wide empty right sidebar which serves no purpose.
In addition to being a useless waste of space, it's an accessibility
issue for folks who need larger fonts, because it gives us less area
for the real content.
This gets rid of that sidebar, and expands the main content.
*/
// ==UserScript==
// @name Elk Right Sidebar Remover
// @name:en-US Elk Right Sidebar Remover
// @namespace http://masukomi.org/
// @version 1.0.0
// @description remove empty right sidebar, and expand main content
// @author masukomi
// @match https://elk.zone/*
// @icon https://elk.zone/logo.svg
// @grant none
// @license MIT
// ==/UserScript==
// compatible with elk v0.6.2
function styleIt(){
// Your code here...
var aside = getAside();
console.log("aside: " + aside)
aside.style.display='none';
var contentElement = document.querySelector("#__nuxt > div:nth-child(2) > main > div");
console.log("contentElement: " + contentElement)
contentElement.style.maxWidth='80%';
contentElement.style.minWidth='50%';
contentElement.style.width='80%';
}
function getAside(){
return document.querySelector("#__nuxt > div:nth-child(2) > main > aside.hidden.sm\\:none.lg\\:block.w-1\\/4.zen-hide");
}
function runIfAside(count){
var aside = getAside();
if (aside !== null) {
styleIt();
} else {
if (count < 10){
setTimeout(runIfAside, 1000);
} else {
console.log("Tampermonkey: giving up on styling this.");
}
}
}
(function() {
'use strict';
setTimeout(runIfAside(1), 200);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment