🏠 Home 

Expandify Twitter Media

Uncrops and expands Twitter image previews to their original ratios while browsing. View media pages in full-width and uncover rounded edges for a better viewing experience. Written in SCSS.


Install this script?
  1. // ==UserScript==
  2. // @name Expandify Twitter Media
  3. // @version 4.9.1a
  4. // @description Uncrops and expands Twitter image previews to their original ratios while browsing. View media pages in full-width and uncover rounded edges for a better viewing experience. Written in SCSS.
  5. // @author Neuvalence, JayeVisual.com
  6. // @match https://*.twitter.com/*
  7. // @match https://*.x.com/*
  8. // @grant GM_addStyle
  9. // @license MIT
  10. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  11. // @require https://code.jquery.com/ui/1.13.3/jquery-ui.js
  12. // @icon https://upload.wikimedia.org/wikipedia/commons/thumb/6/6f/Logo_of_Twitter.svg/292px-Logo_of_Twitter.svg.png
  13. // @namespace https://greasyfork.org/users/1275871
  14. // ==/UserScript==
  15. (function () {
  16. 'use strict';
  17. function onElementAvailable(selector, callback) {
  18. const observer = new MutationObserver(mutations => {
  19. if (document.querySelector(selector)) {
  20. observer.disconnect();
  21. callback();
  22. }
  23. });
  24. observer.observe(document.body, {
  25. childList: true,
  26. subtree: true
  27. });
  28. }
  29. const rafraichir = 2000;
  30. setInterval(() => {
  31. const ogTwt__Header = document.querySelector("header");
  32. let ogTwt__HeaderSubArea = document.querySelector("header > div:nth-child(1) > div:nth-child(1)");
  33. ogTwt__Header.id = "ogTwt__Header";
  34. ogTwt__HeaderSubArea.id = "ogTwt__HeaderSubArea";
  35. $(ogTwt__Header).append(ogTwt__HeaderSubArea);
  36. }, rafraichir);
  37. (function () {
  38. let css = `
  39. header {
  40. overflow: hidden !important;
  41. height: 100vh !important;
  42. max-height: 100vh !important;
  43. display: block !important;
  44. .r-pt392 {
  45. margin-left: unset !important;
  46. }
  47. #ogTwt__HeaderSubArea {
  48. width: unset !important;
  49. transform: scale(0.9) !important;
  50. max-width: unset !important;
  51. min-width: unset !important;
  52. }
  53. }
  54. header *, header,
  55. header::-webkit-scrollbar,
  56. header *::-webkit-scrollbar {
  57. -ms-overflow-style: none;
  58. scrollbar-width: none;
  59. }
  60. main {
  61. width: 100% !important;
  62. max-width: 100% !important;
  63. display: block !important;
  64. position: relative !important;
  65. & > div:nth-child(1),
  66. & > div > div:nth-child(1),
  67. & > div > div > div:nth-child(1) {
  68. width: 100% !important;
  69. max-width: 100% !important;
  70. display: block !important;
  71. position: relative !important;
  72. }
  73. }
  74. article *,
  75. article [aria-label] img,
  76. article [aria-label] div *,
  77. article [aria-label] *,
  78. [data-testid='tweet'] * {
  79. border: unset !important;
  80. border-radius: unset !important;
  81. clip-path: unset !important;
  82. border-style: none !important;
  83. }
  84. [data-testid="cellInnerDiv"] * {
  85. border: none;
  86. }
  87. article {
  88. border: #ffffff11 0.3px solid !important;
  89. border-radius: 3px !important;
  90. }
  91. article [aria-label] img {
  92. border-radius: 2px !important;
  93. }
  94. [data-testid='Tweet-User-Avatar'] a * {
  95. border-radius: 10rem !important;
  96. }
  97. main > div:nth-child(1),
  98. main > div:nth-child(1) > div:nth-child(1),
  99. main > div:nth-child(1) > div:nth-child(1) > div:nth-child(1)
  100. {
  101. width: 100% !important;
  102. max-width: 100% !important;
  103. }
  104. main div[data-testid*='primary'] > div > div:nth-child(3) > div > div > div:nth-child(1),
  105. main div[data-testid*='primary'] > div > div:nth-child(3) > div > div > nav,
  106. main div[data-testid*='primary'] section
  107. {
  108. width: 100% !important;
  109. max-width: 875px !important;
  110. margin: 0 auto !important;
  111. margin-left: 10vw !important;
  112. }
  113. main div[data-testid*='primary'] > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) > div:nth-child(1),
  114. main div[data-testid*='primary'] > div:nth-child(1) > div:nth-child(1) > div:nth-child(1) nav {
  115. max-width: calc(100% - 350px) !important;
  116. }
  117. main div[data-testid*='primary'],
  118. main div[data-testid*='primary'] > div,
  119. main div[data-testid*='primary'] > div > div, /* all 3 */
  120. main div[data-testid*='primary'] .r-1ye8kvj,
  121. main div[data-testid*='primary'] > div > div,
  122. main div[data-testid*='primary'] > div > div > div,
  123. main div[data-testid*='primary'] > div > div > div > div,
  124. main div[data-testid*='primary'] > div > div > div > .r-1ye8kvj, /* troisième */
  125. main div[data-testid*='primary'] > div > div > div > div > .r-1ye8kvj, /* troisième avc sous-mâitre */
  126. main:has(a[href*="/media"]) div[data-testid*='primary']:has(div[data-testid*="ScrollSnap-List"] > div:last-child > a[aria-selected*="true"]) section
  127. {
  128. width: 100% !important;
  129. max-width: 100% !important;
  130. }
  131. main div[data-testid*='primary'] section:has([id*='verticalGridItem']),
  132. main div[data-testid*='primary']:has([id*='verticalGridItem'])
  133. {
  134. width: 100% !important;
  135. min-width: 100% !important;
  136. max-width: 100% !important;
  137. margin: 0 auto !important;
  138. margin-right: 0% !important;
  139. }
  140. main div[data-testid*='primary'] li img {
  141. inset: unset !important;
  142. opacity: 1 !important;
  143. border-radius: 2px !important;
  144. position: relative !important;
  145. left: unset !important;
  146. top: unset !important;
  147. width: 100% !important;
  148. height: auto !important;
  149. object-fit: contain !important;
  150. min-height: auto !important;
  151. max-height: 100% !important;
  152. max-width: 100% !important;
  153. }
  154. div[data-testid*='primary'] [data-testid="tweetPhoto"] > img,
  155. div[data-testid*='primary'] [aria-label] > img {
  156. width: auto !important;
  157. height: 100% !important;
  158. background: none !important;
  159. position: relative !important;
  160. z-index: 1 !important;
  161. inset: unset !important;
  162. opacity: 1 !important;
  163. object-fit: contain !important;
  164. }
  165. div[data-testid*='primary'] li a > div > div:nth-child(2) > div > div:nth-child(1),
  166. div[data-testid*='primary'] [aria-label]:has(> img) > div:nth-child(1),
  167. div[data-testid*='primary'] [data-testid="tweetPhoto"]:has(> img) > div:nth-child(1) {
  168. background: none !important;
  169. display: none !important;
  170. visibility: hidden !important;
  171. }
  172. [data-testid="tweetText"] span {
  173. font-size: 1.2rem !important;
  174. line-height: 1.1 !important;
  175. }
  176. div[data-testid*='sidebar'] {
  177. position: absolute !important;
  178. right: 2rem !important;
  179. top: 0 !important;
  180. height: 80px !important;
  181. z-index: 9000;
  182. margin: 0 !important;
  183. padding: 5px !important;
  184. background-color: unset !important;
  185. div[aria-label] > div:nth-child(1) > div:nth-child(1) {
  186. margin-top: 5px !important;
  187. }
  188. & > div > div:nth-child(2) {
  189. padding: 10px;
  190. }
  191. & > div > div:nth-child(2) > div > div > div > div {
  192. display: none;
  193. }
  194. & > div > div:nth-child(2) > div > div > div > div:nth-child(1) {
  195. display: block !important;
  196. }
  197. & > div > div:nth-child(2) > div > div > div > div:nth-child(1) {
  198. background: none !important;
  199. }
  200. &:hover {
  201. height: 100% !important;
  202. div[aria-label],
  203. div:nth-child(1) > div,
  204. div:nth-child(1) > div > div,
  205. div > div:nth-child(2) > div > div > div > div:nth-child(1) {
  206. background-color: #000000 !important;
  207. border-radius: 20px;
  208. }
  209. & > div > div:nth-child(2) > div > div > div > div {
  210. display: block !important;
  211. }
  212. }
  213. }
  214. `;
  215. if (typeof GM_addStyle !== "undefined") {
  216. GM_addStyle(css);
  217. } else {
  218. let styleNode = document.createElement("style");
  219. styleNode.appendChild(document.createTextNode(css));
  220. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  221. }
  222. })(); /* End CSS*/
  223. })(); /* End ALL */