Twitter.com: un-trim images on hover

Reveal cropped portions of content while post is under mouse pointer.

Устаревшая версия за 30.06.2020. Перейдите к последней версии.

  1. /* ==UserStyle==
  2. @name Twitter.com: un-trim images on hover
  3. @description Reveal cropped portions of content while post is under mouse pointer.
  4. @namespace myfonj
  5. @version 1.0.6
  6. @license CC0 - Public Domain
  7. ==/UserStyle== */
  8.  
  9. @-moz-document domain("twitter.com") {
  10. /*
  11. Twitter.com: un-trim images on hover
  12.  
  13. https://greasyfork.org/en/scripts/402913/versions/new
  14. https://userstyles.org/styles/175427/edit
  15. div[aria-label^="Timeline: "] > div > div > div
  16. = "post item"
  17. */
  18. /*
  19. let the spice flow. over.
  20. */
  21. div[aria-label^="Timeline: "] > div > div > div:hover,
  22. div[aria-label^="Timeline: "] > div > div > div:hover * {
  23. overflow: visible !important;
  24. z-index: 10;
  25. }
  26. /*
  27. directly hovered position something always above its unhovered siblings
  28. */
  29. div[aria-label^="Timeline: "] > div > div:hover *:hover {
  30. z-index: 20;
  31. }
  32. /*
  33. counters covered by box would be inaccessible, move them above and make 'em transparent ...
  34. */
  35. div[aria-label^="Timeline: "] > div > div > div:hover [role="group"],
  36. div[aria-label^="Timeline: "] > div > div > div:hover [role="link"][data-focusable="true"][href$="/media_tags"] {
  37. z-index: 30;
  38. opacity: 0;
  39. }
  40.  
  41. /* tweet actions */
  42. div[aria-label^="Timeline: "] > div > div > div:hover [role="group"] {
  43. outline: 20px solid rgba(0, 0, 0, 0.5);
  44. background-color: rgba(0, 0, 0, 0.5);
  45. }
  46. /*
  47. ... until hovered
  48. */
  49. div[aria-label^="Timeline: "] > div > div > div:hover [role="group"]:hover,
  50. div[aria-label^="Timeline: "] > div > div > div:hover [role="link"][data-focusable="true"][href$="/media_tags"]:hover {
  51. opacity: 1 !important;
  52. }
  53.  
  54. /*
  55. fix for external link badge text underlayed by illustration producing non-contrasting text
  56. */
  57. div[aria-label^="Timeline: "] > div > div > div:hover a[href^="https://t.co/"][href$="?amp=1"][target="_blank"][role="link"][data-focusable="true"][rel=" noopener noreferrer"]:hover {
  58. background-color: rgba(0, 0, 0, 0.5);
  59. }
  60. /* tweet text */
  61. div[aria-label^="Timeline: "] > div > div > div [style^="flex-basis"] + div [dir][lang]:hover,
  62. div[aria-label^="Timeline: "] > div > div > div [style^="flex-basis"]:hover + div [dir][lang] {
  63. z-index: 30;
  64. background-color: rgba(0, 0, 0, 0.5);
  65. border-left: 10px solid transparent;
  66. margin-left: -10px;
  67. }
  68. /*
  69. this is it - this *invisible* image just sits there covering div with very same image as background,
  70. "squeezed" into wrapper. so let's unleash it while invisible to gain some performace
  71. */
  72. div[aria-label^="Timeline: "] > div > div > div [aria-label] > img {
  73. width: auto !important;
  74. height: auto !important;
  75. max-width: calc(100vw - 20em) !important;
  76. /* too lazy to measure sidebar for now */
  77. min-width: calc(100%) !important;
  78. /* sometimes there is small pic that would otherwise downscale */
  79. outline: 3px solid black;
  80. z-index: 100 !important;
  81. }
  82. /*
  83. tadaa, real pic an all its glory. most probably bigger
  84. */
  85. div[aria-label^="Timeline: "] > div > div > div:hover [aria-label] > img {
  86. opacity: 1 !important;
  87. }
  88. div[aria-label^="Timeline: "] > div > div > div:hover [aria-label] > img:hover {
  89. box-shadow: rgba(217, 217, 217, 0.2) 0px 0px 10px, rgba(217, 217, 217, 0.25) 0px 3px 6px 3px;
  90. }
  91.  
  92. /* 2020-06 - avatars in timeline started to follow same principle, so became hover "jumpy"
  93. since we are zooming them in detail popups anyway, just be dirty and brutal for now
  94. N.B. beautiful selector for picking avatar "cell" is sometimes [style="flex-basis: 49px;"]
  95. but pixel value changes across devices (or what)
  96. */
  97. [href^="/"][role="link"][aria-hidden="true"][tabindex="-1"] img, /* in notifications */
  98. div[aria-label^="Timeline: "]:not(#\0) [style^="flex-basis: "][style$="px;"] img {
  99. display: none !important;
  100. outline: 1px solid red !important;
  101. }
  102.  
  103. /*
  104. video player controls
  105. */
  106. div[aria-label^="Timeline: "] > div > div > div:hover [style^="style=\"transition-duration: 250ms; transition-property: opacity, height; transition-timing-function: ease; will-change: opacity; opacity:"],
  107. div[aria-label^="Timeline: "] > div > div > div:hover [style*="position: absolute;"]
  108. {
  109. z-index: 30;
  110. }
  111.  
  112.  
  113.  
  114. /*
  115. style="transition-duration: 250ms; transition-property: opacity, height; transition-timing-function: ease; will-change: opacity; opacity: 1;"
  116. */
  117.  
  118. /*
  119. Increase size of avatar pictures in hover popup
  120. this is hell to debug, so please dont't judge
  121. the popup has bottom/top according relative placement in viewport
  122. */
  123.  
  124.  
  125. [style*="left: "] a[role="link"][tabindex="-1"][aria-hidden="true"],
  126. [style*="left: "] a[role="link"][tabindex="-1"][aria-hidden="true"] * {
  127. min-height: 12em !important;
  128. min-width: 12em !important;
  129. margin: 0 !important;
  130. padding: 0 !important;
  131. background-size: contain;
  132. }
  133.  
  134. /* WIP show alt */
  135. /*
  136. [aria-haspopup="false"][href*="/status/"] [aria-label]:not(img):not([aria-label="Image"]) {
  137. outline: 10px solid red !important;
  138. xtransform: scale(1);
  139. }
  140. *[aria-haspopup="false"][href*="/status/"] [aria-label]:not(img):not([aria-label="Image"])::after {
  141. content: attr(aria-label) !important;
  142. position: absolute;
  143. bottom: 0;
  144. left: 0;
  145. right: 0;
  146. z-index: 1000;
  147. }
  148. */
  149. }