Skip to content

Instantly share code, notes, and snippets.

@MadameMinty
MadameMinty / compact-messenger.user.js
Last active May 20, 2020 20:22 — forked from realies/compact-messenger.user.js
Making the Messenger sidebar narrow. Adapted the original script to handle dynamic CSS names, and better work with vertical screens. This will compact the sidebar when you keep Messenger window on a vertical HD screen (1080px) or snap its window to a side of a HD (960px) or ultrawide (1280px width available) screen, but will expand it on e.g. HD…
// ==UserScript==
// @name Compact Messenger Sidebar
// @version 2
// @match https://www.messenger.com/*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// ==/UserScript==
const targetCSS = document.getElementsByTagName("head")[0].querySelectorAll("link[href*='.css']")[2];
GM_xmlhttpRequest({