Simplified Twitter

Remove distractions from the new Twitter layout; UserScript version of https://github.com/brunolemos/simplified-twitter

  1. // ==UserScript==
  2. // @name Simplified Twitter
  3. // @namespace https://github.com/dnek
  4. // @version 1.8.1
  5. // @description Remove distractions from the new Twitter layout; UserScript version of https://github.com/brunolemos/simplified-twitter
  6. // @author DNEK
  7. // @copyright 2019 Bruno Lemos
  8. // @copyright 2025 DNEK
  9. // @license MIT
  10. // @match https://x.com/*
  11. // @grant GM_addStyle
  12. // ==/UserScript==
  13.  
  14. /*!
  15. * MIT License
  16. *
  17. * Original Project: Simplified Twitter
  18. * https://github.com/brunolemos/simplified-twitter
  19. *
  20. * Copyright (c) 2019 Bruno Lemos
  21. * Copyright (c) 2025 DNEK
  22. *
  23. * This software is released under the MIT License.
  24. * https://opensource.org/licenses/MIT
  25. */
  26.  
  27. (function () {
  28. 'use strict';
  29.  
  30. GM_addStyle(`
  31. #react-root main {
  32. -webkit-flex-grow: 1 !important;
  33. flex-grow: 1 !important;
  34. }
  35.  
  36. @media (min-width: 800px) {
  37. [role='listbox'] {
  38. max-width: 500px !important;
  39. }
  40. }
  41. `)
  42.  
  43. function update () {
  44. const width = Math.min(document.documentElement.offsetWidth || 800, 800)
  45. if (window.innerWidth === width && document.documentElement.clientWidth === width) return
  46.  
  47. window.__defineGetter__('innerWidth', () => width)
  48. document.documentElement.__defineGetter__('clientWidth', () => width)
  49. if (window.visualViewport) window.visualViewport.__defineGetter__('width', () => width)
  50.  
  51. window.dispatchEvent(new Event('resize'))
  52. if (window.visualViewport) window.visualViewport.dispatchEvent(new Event('resize'))
  53. }
  54.  
  55. window.addEventListener('load', update)
  56. window.addEventListener('resize', update)
  57. if (window.visualViewport) window.visualViewport.addEventListener('resize', update)
  58. document.addEventListener('visibilitychange', update)
  59. update()
  60. })();