Twitter.com: un-trim images on hover

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

当前为 2020-06-17 提交的版本,查看 最新版本

  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.5
  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. div[aria-label^="Timeline: "] > div > div > div:hover [role="group"] {
  41. outline: 20px solid rgba(0, 0, 0, 0.5);
  42. background-color: rgba(0, 0, 0, 0.5);
  43. }
  44. /*
  45. ... until hovered
  46. */
  47. div[aria-label^="Timeline: "] > div > div > div:hover [role="group"]:hover,
  48. div[aria-label^="Timeline: "] > div > div > div:hover [role="link"][data-focusable="true"][href$="/media_tags"]:hover {
  49. opacity: 1 !important;
  50. }
  51.  
  52.  
  53. div[aria-label^="Timeline: "] > div > div > div [style^="flex-basis"] + div [dir][lang]:hover,
  54. div[aria-label^="Timeline: "] > div > div > div [style^="flex-basis"]:hover + div [dir][lang] {
  55. z-index: 30;
  56. background-color: rgba(0, 0, 0, 0.5);
  57. border-left: 10px solid transparent;
  58. margin-left: -10px;
  59. }
  60. /*
  61. this is it - this *invisible* image just sits there covering div with very same image as background,
  62. "squeezed" into wrapper. so let's unleash it while invisible to gain some performace
  63. */
  64. div[aria-label^="Timeline: "] > div > div > div [aria-label] > img {
  65. width: auto !important;
  66. height: auto !important;
  67. max-width: calc(100vw - 20em) !important;
  68. /* too lazy to measure sidebar for now */
  69. min-width: calc(100%) !important;
  70. /* sometimes there is small pic that would otherwise downscale */
  71. outline: 3px solid black;
  72. z-index: 100 !important;
  73. }
  74. /*
  75. tadaa, real pic an all its glory. most probably bigger
  76. */
  77. div[aria-label^="Timeline: "] > div > div > div:hover [aria-label] > img {
  78. opacity: 1 !important;
  79. }
  80. div[aria-label^="Timeline: "] > div > div > div:hover [aria-label] > img:hover {
  81. box-shadow: rgba(217, 217, 217, 0.2) 0px 0px 10px, rgba(217, 217, 217, 0.25) 0px 3px 6px 3px;
  82. }
  83.  
  84. /* 2020-06 - avatars in timeline started to follow same principle, so became hover "jumpy"
  85. since we are zooming them in detail popups anyway, just be dirty and brutal for now
  86. N.B. beautiful selector for picking avatar "cell" is sometimes [style="flex-basis: 49px;"]
  87. but pixel value changes across devices (or what)
  88. */
  89. [href^="/"][role="link"][aria-hidden="true"][tabindex="-1"] img, /* in notifications */
  90. div[aria-label^="Timeline: "]:not(#\0) [style^="flex-basis: "][style$="px;"] img {
  91. display: none !important;
  92. outline: 1px solid red !important;
  93. }
  94.  
  95. /*
  96. video player controls
  97. */
  98. 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:"],
  99. div[aria-label^="Timeline: "] > div > div > div:hover [style*="position: absolute;"]
  100. {
  101. z-index: 30;
  102. }
  103.  
  104.  
  105. /*
  106. style="transition-duration: 250ms; transition-property: opacity, height; transition-timing-function: ease; will-change: opacity; opacity: 1;"
  107. */
  108.  
  109. /*
  110. Increase size of avatar pictures in hover popup
  111. this is hell to debug, so please dont't judge
  112. the popup has bottom/top according relative placement in viewport
  113. */
  114.  
  115.  
  116. [style*="left: "] a[role="link"][tabindex="-1"][aria-hidden="true"],
  117. [style*="left: "] a[role="link"][tabindex="-1"][aria-hidden="true"] * {
  118. min-height: 12em !important;
  119. min-width: 12em !important;
  120. margin: 0 !important;
  121. padding: 0 !important;
  122. background-size: contain;
  123. }
  124.  
  125. /* WIP show alt */
  126. /*
  127. [aria-haspopup="false"][href*="/status/"] [aria-label]:not(img):not([aria-label="Image"]) {
  128. outline: 10px solid red !important;
  129. xtransform: scale(1);
  130. }
  131. *[aria-haspopup="false"][href*="/status/"] [aria-label]:not(img):not([aria-label="Image"])::after {
  132. content: attr(aria-label) !important;
  133. position: absolute;
  134. bottom: 0;
  135. left: 0;
  136. right: 0;
  137. z-index: 1000;
  138. }
  139. */
  140. }