Skip to content

Instantly share code, notes, and snippets.

@jh3y
Created July 25, 2019 00:59
Show Gist options
  • Save jh3y/e4df23eac6a6b074b4e2e8527b1aa718 to your computer and use it in GitHub Desktop.
Save jh3y/e4df23eac6a6b074b4e2e8527b1aa718 to your computer and use it in GitHub Desktop.
Bookmarklet for "Focussed Twitter" 🐦
// Create a new bookmark in your browsers' Bookmark Manager pointing at the following script:
javascript:(function(){let a;const b=new CSSStyleSheet;b.insertRule("header, [data-testid=\"sidebarColumn\"] { transition: opacity .5s ease; }"),b.insertRule(".fade-noise header, .fade-noise [data-testid=\"sidebarColumn\"] { opacity: 0.005; }"),document.adoptedStyleSheets=[b];const c=()=>{document.body.classList.add("fade-noise"),a&&clearTimeout(a),a=setTimeout(()=>{document.body.classList.remove("fade-noise")},2500)};window.addEventListener("scroll",c)})();
// NOTE:: You can modify the behavior by updating the values in the injected CSS
// 1. transition time for opacity (0.5s default)
// 2. opacity of non-focussed items (0.05 default)
// 3. time it takes for non-focussed items to return to full opacity (2500ms default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment