Skip to content

Instantly share code, notes, and snippets.

@sunsetsonwheels
Last active January 9, 2022 12:08
Show Gist options
  • Save sunsetsonwheels/a1864fc08a965516b9c5c582a5bcbea8 to your computer and use it in GitHub Desktop.
Save sunsetsonwheels/a1864fc08a965516b9c5c582a5bcbea8 to your computer and use it in GitHub Desktop.
Collapse Instagram sidebar (thanks to simplified-twitter)
// ==UserScript==
// @name Collapse Instagram Suggestions
// @description This collapses the Instagram suggestions sidebar to make everything centered.
// @match *://*.instagram.com/
// @run-at document-end
// ==/UserScript==
function update() {
const width = Math.min(document.documentElement.offsetWidth || 800, 800)
if (window.innerWidth === width && document.documentElement.clientWidth === width) return
window.__defineGetter__('innerWidth', () => width)
document.documentElement.__defineGetter__('clientWidth', () => width)
window.dispatchEvent(new Event('resize'))
}
window.addEventListener('load', update)
window.addEventListener('resize', update)
document.addEventListener('visibilitychange', update)
update()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment