Skip to content

Instantly share code, notes, and snippets.

@realies
Created February 7, 2020 03:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save realies/bd723b5917d79d248a95199407491a5f to your computer and use it in GitHub Desktop.
Save realies/bd723b5917d79d248a95199407491a5f to your computer and use it in GitHub Desktop.
making the messenger side-bar always narrow
// ==UserScript==
// @name Compact Messenger
// @version 0.1
// @match https://www.messenger.com/*
// @grant GM_xmlhttpRequest
// @grant GM_addStyle
// ==/UserScript==
const targetCSS = document.querySelector("link[href*='FD_uqE-4yZN.css']");
GM_xmlhttpRequest({
method: "GET",
url: targetCSS.href,
onload: response => {
targetCSS.parentNode.removeChild(targetCSS);
GM_addStyle(response.responseText.replace(/max-width: 900px/g, "min-width: 0px"));
}
});
@MadameMinty
Copy link

MadameMinty commented May 18, 2020

Exactly what I looked for! However, it worked only after I replaced the targetCSS file with 'hXBH2TDOrgy.css' - the name is dynamic and I settled on replacing line 8 with:
const targetCSS = document.getElementsByTagName("head")[0].querySelectorAll("link[href*='.css']")[2];

  • so far it didn't break!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment