aland / stackexchange hide side panels

// ==UserScript==
// @name           stackexchange hide side panels
// @description    Hide the unrelated and hot questions which distract me
// @version        2024-02-02
// @namespace      aland
// @author         aland
// @updateURL      https://openuserjs.org/install/aland/stackexchange_hide_side_panels.user.js
// @downloadURL    https://openuserjs.org/install/aland/stackexchange_hide_side_panels.user.js
// @include        http*://stackoverflow.com/*
// @include        http*://serverfault.com/*
// @include        http*://superuser.com/*
// @include        http*://askubuntu.com/*
// @include        http*://*.stackexchange.com/*
// @grant          none
// @license        MIT
// ==/UserScript==


function toggle_visibility(element, id) {
	if(id) {
		let el = document.getElementById(element);
		if (el) {
			el.style.display = 'none';
		}
	}
	else {
		let elements = document.getElementsByClassName(element);
		let n = elements.length;
		if(n > 0) {
			for (var i = 0; i < n; i++) {
				elements[i].style.display = 'none';
			}
		}
	}
}

toggle_visibility('community-bulletin', false);
toggle_visibility('everyonelovesstackoverflow', false);
toggle_visibility('jobs', false);
toggle_visibility('hireme', true);
toggle_visibility('hot-network-questions', true);
toggle_visibility('mb16', false);
toggle_visibility('z-nav', false);
toggle_visibility('left-sidebar', true);


// OTT - but works in a pinch if the above isn't catching them all
//document.getElementById('sidebar').style.display = 'none';