File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -112,9 +112,10 @@ const setStyles = () => {
112112} ;
113113
114114const doVideoActions = debounce ( ( ) => {
115+ console . dev . debug ( 'Video actions' ) ;
115116 // add links on mobile to substitute hover
116117 if ( isMobile ( ) )
117- Array . from ( document . querySelectorAll < HTMLImageElement > ( `${ videoselector } img ` ) ) . forEach ( createLink ) ;
118+ Array . from ( document . querySelectorAll < HTMLTimeElement > ( `${ videoselector } time ` ) ) . forEach ( createLink ) ;
118119 // hide creators
119120 if ( isVideoListPage ( ) )
120121 Array . from ( document . querySelectorAll < HTMLElement > ( videoselector ) ) . forEach ( el =>
@@ -136,7 +137,7 @@ const hover = (e: MouseEvent) => {
136137 return ;
137138 createLink ( link . querySelector ( 'img' ) ) ;
138139} ;
139- const createLink = ( img : HTMLImageElement ) : void => {
140+ const createLink = ( img : HTMLImageElement | HTMLTimeElement ) : void => {
140141 if ( ! img || queueBottonLocation ( img ) . querySelector ( '.enhancer-queueButton' ) !== null )
141142 return ; // queue button exists
142143 // create queue button
Original file line number Diff line number Diff line change 11import { isVideoListPage } from './shared' ;
22
3- export const queueBottonLocation = ( img : HTMLImageElement ) => img . parentElement . parentElement ;
4- export const durationLocation = ( img : HTMLImageElement ) => queueBottonLocation ( img ) . querySelector ( 'time' ) . parentElement ;
5- export const watchLaterLocation = ( img : HTMLImageElement ) => queueBottonLocation ( img ) . querySelector ( '[data-icon-itself]' ) ;
3+ export const queueBottonLocation = ( img : HTMLImageElement | HTMLTimeElement ) => img . parentElement . parentElement ;
4+ export const durationLocation = ( img : HTMLImageElement | HTMLTimeElement ) => queueBottonLocation ( img ) . querySelector ( 'time' ) . parentElement ;
5+ export const watchLaterLocation = ( img : HTMLImageElement | HTMLTimeElement ) => queueBottonLocation ( img ) . querySelector ( '[data-icon-itself]' ) ;
66export const titleLocation = ( link : HTMLElement ) => link . nextElementSibling ? link . nextElementSibling . querySelector ( 'h3' ) : link . parentElement . nextElementSibling . querySelector ( 'a[href^="/videos/"] span:last-child' ) ;
77export const creatorLocation = ( link : HTMLElement ) => isVideoListPage ( ) && link . nextElementSibling ? titleLocation ( link ) . nextElementSibling . firstElementChild : document . querySelector ( 'h1, meta[property="og:title"]' ) ;
88export const watchProgressLocation = ( link : HTMLElement ) => link . querySelector ( 'picture' ) ?. parentElement ?. lastElementChild as HTMLDivElement ;
You can’t perform that action at this time.
0 commit comments