@@ -10,6 +10,7 @@ const pausedPosterAttribute = 'data-paused-gif-use-poster';
1010const pausedBackgroundImageVar = '--xkit-paused-gif-background-image' ;
1111const hoverContainerAttribute = 'data-paused-gif-hover-container' ;
1212const labelAttribute = 'data-paused-gif-label' ;
13+ const hoverFixAttribute = 'data-paused-gif-hover-fix' ;
1314const containerClass = 'xkit-paused-gif-container' ;
1415
1516let loadingMode ;
@@ -75,6 +76,11 @@ ${keyToCss('background')}[${labelAttribute}]::after {
7576[style*="${ pausedBackgroundImageVar } "]:not(${ hovered } ) {
7677 background-image: var(${ pausedBackgroundImageVar } ) !important;
7778}
79+
80+ [${ hoverFixAttribute } ] {
81+ position: relative;
82+ pointer-events: auto !important;
83+ }
7884` ) ;
7985
8086const addLabel = ( element , inside = false ) => {
@@ -164,6 +170,10 @@ const pauseGif = async function (gifElement) {
164170 canvas . getContext ( '2d' ) . drawImage ( image , 0 , 0 ) ;
165171 gifElement . after ( canvas ) ;
166172 addLabel ( gifElement ) ;
173+
174+ gifElement . closest ( keyToCss (
175+ 'imgLink' // trending tag: https://www.tumblr.com/explore/trending
176+ ) ) ?. setAttribute ( hoverFixAttribute , '' ) ;
167177 }
168178 } ;
169179} ;
@@ -218,6 +228,11 @@ const processBackgroundGifs = function (gifBackgroundElements) {
218228 sourceValue . replace ( sourceUrlRegex , `url("${ pausedUrl } ")` )
219229 ) ;
220230 addLabel ( gifBackgroundElement , true ) ;
231+
232+ gifBackgroundElement . closest ( keyToCss (
233+ 'media' , // old activity item: "liked your post", "reblogged your post", "mentioned you in a post"
234+ 'activityMedia' // new activity item: "replied to your post", "replied to you in a post"
235+ ) ) ?. setAttribute ( hoverFixAttribute , '' ) ;
221236 } ) ;
222237} ;
223238
@@ -262,6 +277,7 @@ export const main = async function () {
262277 'typeaheadRow' , // modal search dropdown entry
263278 'tagImage' , // search page sidebar related tags, recommended tag carousel entry: https://www.tumblr.com/search/gif, https://www.tumblr.com/explore/recommended-for-you
264279 'topPost' , // activity page top post
280+ 'colorfulListItemWrapper' , // trending tag: https://www.tumblr.com/explore/trending
265281 'takeoverBanner' // advertisement
266282 ) }
267283 ) img:is([srcset*=".gif"], [src*=".gif"], [srcset*=".webp"], [src*=".webp"]):not(${ keyToCss ( 'poster' ) } )
@@ -270,6 +286,8 @@ export const main = async function () {
270286
271287 const gifBackgroundImage = `
272288 ${ keyToCss (
289+ 'media' , // old activity item: "liked your post", "reblogged your post", "mentioned you in a post"
290+ 'activityMedia' , // new activity item: "replied to your post", "replied to you in a post"
273291 'communityHeaderImage' , // search page tags section header: https://www.tumblr.com/search/gif?v=tag
274292 'bannerImage' , // tagged page sidebar header: https://www.tumblr.com/tagged/gif
275293 'tagChicletWrapper' , // "trending" / "your tags" timeline carousel entry: https://www.tumblr.com/dashboard/trending, https://www.tumblr.com/dashboard/hubs
@@ -281,6 +299,7 @@ export const main = async function () {
281299 const hoverableElement = [
282300 `${ keyToCss ( 'listTimelineObject' ) } ${ keyToCss ( 'carouselWrapper' ) } ${ keyToCss ( 'postCard' ) } ` , // recommended blog carousel entry
283301 `div:has(> a${ keyToCss ( 'cover' ) } ):has(${ keyToCss ( 'communityCategoryImage' ) } )` , // tumblr communities browse page entry: https://www.tumblr.com/communities/browse
302+ `${ keyToCss ( 'gridTimelineObject' ) } ` // likes page or patio grid view post: https://www.tumblr.com/likes
284303 ] . join ( ', ' ) ;
285304 pageModifications . register ( hoverableElement , processHoverableElements ) ;
286305
@@ -308,6 +327,7 @@ export const clean = async function () {
308327 $ ( `[${ labelAttribute } ]` ) . removeAttr ( labelAttribute ) ;
309328 $ ( `[${ pausedPosterAttribute } ]` ) . removeAttr ( pausedPosterAttribute ) ;
310329 $ ( `[${ hoverContainerAttribute } ]` ) . removeAttr ( hoverContainerAttribute ) ;
330+ $ ( `[${ hoverFixAttribute } ]` ) . removeAttr ( hoverFixAttribute ) ;
311331 [ ...document . querySelectorAll ( `[style*="${ pausedBackgroundImageVar } "]` ) ]
312332 . forEach ( element => element . style . removeProperty ( pausedBackgroundImageVar ) ) ;
313333} ;
0 commit comments