@@ -39,7 +39,7 @@ embed_url.searchParams.delete('v');
3939var short_url = location . origin + '/' + video_data . id + embed_url . search ;
4040embed_url = location . origin + '/embed/' + video_data . id + embed_url . search ;
4141
42- var save_player_pos_key = " save_player_pos" ;
42+ var save_player_pos_key = ' save_player_pos' ;
4343
4444videojs . Vhs . xhr . beforeRequest = function ( options ) {
4545 if ( options . uri . indexOf ( 'videoplayback' ) === - 1 && options . uri . indexOf ( 'local=true' ) === - 1 ) {
@@ -112,8 +112,8 @@ var shareOptions = {
112112 description : player_data . description ,
113113 image : player_data . thumbnail ,
114114 get embedCode ( ) {
115- return " <iframe id=' ivplayer' width=' 640' height=' 360' src='" +
116- addCurrentTimeToURL ( embed_url ) + "' style=' border:none;' ></iframe>" ;
115+ return ' <iframe id=" ivplayer" width=" 640" height=" 360" src="' +
116+ addCurrentTimeToURL ( embed_url ) + '" style=" border:none;" ></iframe>' ;
117117 }
118118} ;
119119
@@ -138,57 +138,57 @@ if (location.pathname.startsWith('/embed/')) {
138138// Detection code taken from https://stackoverflow.com/a/20293441
139139
140140function isMobile ( ) {
141- try { document . createEvent ( " TouchEvent" ) ; return true ; }
141+ try { document . createEvent ( ' TouchEvent' ) ; return true ; }
142142 catch ( e ) { return false ; }
143143}
144144
145145if ( isMobile ( ) ) {
146146 player . mobileUi ( ) ;
147147
148- buttons = [ " playToggle" , " volumePanel" , " captionsButton" ] ;
148+ buttons = [ ' playToggle' , ' volumePanel' , ' captionsButton' ] ;
149149
150- if ( video_data . params . quality !== 'dash' ) buttons . push ( " qualitySelector" ) ;
150+ if ( video_data . params . quality !== 'dash' ) buttons . push ( ' qualitySelector' ) ;
151151
152152 // Create new control bar object for operation buttons
153- const ControlBar = videojs . getComponent ( " controlBar" ) ;
153+ const ControlBar = videojs . getComponent ( ' controlBar' ) ;
154154 let operations_bar = new ControlBar ( player , {
155155 children : [ ] ,
156156 playbackRates : [ 0.25 , 0.5 , 0.75 , 1.0 , 1.25 , 1.5 , 1.75 , 2.0 ]
157157 } ) ;
158158 buttons . slice ( 1 ) . forEach ( function ( child ) { operations_bar . addChild ( child ) ; } ) ;
159159
160160 // Remove operation buttons from primary control bar
161- primary_control_bar = player . getChild ( " controlBar" ) ;
161+ primary_control_bar = player . getChild ( ' controlBar' ) ;
162162 buttons . forEach ( function ( child ) { primary_control_bar . removeChild ( child ) ; } ) ;
163163
164164 operations_bar_element = operations_bar . el ( ) ;
165- operations_bar_element . className += " mobile-operations-bar" ;
165+ operations_bar_element . className += ' mobile-operations-bar' ;
166166 player . addChild ( operations_bar ) ;
167167
168168 // Playback menu doesn't work when it's initialized outside of the primary control bar
169- playback_element = document . getElementsByClassName ( " vjs-playback-rate" ) [ 0 ] ;
169+ playback_element = document . getElementsByClassName ( ' vjs-playback-rate' ) [ 0 ] ;
170170 operations_bar_element . append ( playback_element ) ;
171171
172172 // The share and http source selector element can't be fetched till the players ready.
173- player . one ( " playing" , function ( ) {
174- share_element = document . getElementsByClassName ( " vjs-share-control" ) [ 0 ] ;
173+ player . one ( ' playing' , function ( ) {
174+ share_element = document . getElementsByClassName ( ' vjs-share-control' ) [ 0 ] ;
175175 operations_bar_element . append ( share_element ) ;
176176
177177 if ( video_data . params . quality === 'dash' ) {
178- http_source_selector = document . getElementsByClassName ( " vjs-http-source-selector vjs-menu-button" ) [ 0 ] ;
178+ http_source_selector = document . getElementsByClassName ( ' vjs-http-source-selector vjs-menu-button' ) [ 0 ] ;
179179 operations_bar_element . append ( http_source_selector ) ;
180180 }
181181 } ) ;
182182}
183183
184184// Enable VR video support
185185if ( ! video_data . params . listen && video_data . vr && video_data . params . vr_mode ) {
186- player . crossOrigin ( " anonymous" ) ;
186+ player . crossOrigin ( ' anonymous' ) ;
187187 switch ( video_data . projection_type ) {
188- case " EQUIRECTANGULAR" :
189- player . vr ( { projection : " equirectangular" } ) ;
190- default : // Should only be " MESH" but we'll use this as a fallback.
191- player . vr ( { projection : " EAC" } ) ;
188+ case ' EQUIRECTANGULAR' :
189+ player . vr ( { projection : ' equirectangular' } ) ;
190+ default : // Should only be ' MESH' but we'll use this as a fallback.
191+ player . vr ( { projection : ' EAC' } ) ;
192192 }
193193}
194194
@@ -223,15 +223,15 @@ player.playbackRate(video_data.params.speed);
223223 * @returns cookieValue
224224 */
225225function getCookieValue ( name ) {
226- var value = document . cookie . split ( ";" ) . filter ( function ( item ) { return item . includes ( name + "=" ) ; } ) ;
226+ var value = document . cookie . split ( ';' ) . filter ( function ( item ) { return item . includes ( name + '=' ) ; } ) ;
227227
228228 return ( value . length >= 1 )
229- ? value [ 0 ] . substring ( ( name + "=" ) . length , value [ 0 ] . length )
229+ ? value [ 0 ] . substring ( ( name + '=' ) . length , value [ 0 ] . length )
230230 : null ;
231231}
232232
233233/**
234- * Method for updating the " PREFS" cookie (or creating it if missing)
234+ * Method for updating the ' PREFS' cookie (or creating it if missing)
235235 *
236236 * @param {number } newVolume New volume defined (null if unchanged)
237237 * @param {number } newSpeed New speed defined (null if unchanged)
@@ -291,7 +291,7 @@ if (video_data.premiere_timestamp && Math.round(new Date() / 1000) < video_data.
291291
292292if ( video_data . params . save_player_pos ) {
293293 const url = new URL ( location ) ;
294- const hasTimeParam = url . searchParams . has ( "t" ) ;
294+ const hasTimeParam = url . searchParams . has ( 't' ) ;
295295 const remeberedTime = get_video_time ( ) ;
296296 let lastUpdated = 0 ;
297297
@@ -307,7 +307,7 @@ if (video_data.params.save_player_pos) {
307307 }
308308 } ;
309309
310- player . on ( " timeupdate" , updateTime ) ;
310+ player . on ( ' timeupdate' , updateTime ) ;
311311}
312312else remove_all_video_times ( ) ;
313313
@@ -334,16 +334,16 @@ if (video_data.params.autoplay) {
334334if ( ! video_data . params . listen && video_data . params . quality === 'dash' ) {
335335 player . httpSourceSelector ( ) ;
336336
337- if ( video_data . params . quality_dash !== " auto" ) {
337+ if ( video_data . params . quality_dash !== ' auto' ) {
338338 player . ready ( function ( ) {
339- player . on ( " loadedmetadata" , function ( ) {
339+ player . on ( ' loadedmetadata' , function ( ) {
340340 const qualityLevels = Array . from ( player . qualityLevels ( ) ) . sort ( function ( a , b ) { return a . height - b . height ; } ) ;
341341 let targetQualityLevel ;
342342 switch ( video_data . params . quality_dash ) {
343- case " best" :
343+ case ' best' :
344344 targetQualityLevel = qualityLevels . length - 1 ;
345345 break ;
346- case " worst" :
346+ case ' worst' :
347347 targetQualityLevel = 0 ;
348348 break ;
349349 default :
@@ -734,7 +734,7 @@ window.addEventListener('keydown', function (e) {
734734 } ;
735735
736736 player . on ( 'mousewheel' , mouseScroll ) ;
737- player . on ( " DOMMouseScroll" , mouseScroll ) ;
737+ player . on ( ' DOMMouseScroll' , mouseScroll ) ;
738738} ( ) ) ;
739739
740740// Since videojs-share can sometimes be blocked, we defer it until last
@@ -750,7 +750,7 @@ if (player_data.preferred_caption_found) {
750750}
751751
752752// Safari audio double duration fix
753- if ( navigator . vendor === " Apple Computer, Inc." && video_data . params . listen ) {
753+ if ( navigator . vendor === ' Apple Computer, Inc.' && video_data . params . listen ) {
754754 player . on ( 'loadedmetadata' , function ( ) {
755755 player . on ( 'timeupdate' , function ( ) {
756756 if ( player . remainingTime ( ) < player . duration ( ) / 2 && player . remainingTime ( ) >= 2 ) {
@@ -761,17 +761,17 @@ if (navigator.vendor === "Apple Computer, Inc." && video_data.params.listen) {
761761}
762762
763763// Watch on Invidious link
764- if ( window . location . pathname . startsWith ( " /embed/" ) ) {
764+ if ( window . location . pathname . startsWith ( ' /embed/' ) ) {
765765 const Button = videojs . getComponent ( 'Button' ) ;
766766 let watch_on_invidious_button = new Button ( player ) ;
767767
768768 // Create hyperlink for current instance
769- redirect_element = document . createElement ( "a" ) ;
770- redirect_element . setAttribute ( " href" , `//${ window . location . host } /watch?v=${ window . location . pathname . replace ( " /embed/" , "" ) } ` ) ;
771- redirect_element . appendChild ( document . createTextNode ( " Invidious" ) ) ;
769+ redirect_element = document . createElement ( 'a' ) ;
770+ redirect_element . setAttribute ( ' href' , `//${ window . location . host } /watch?v=${ window . location . pathname . replace ( ' /embed/' , '' ) } ` ) ;
771+ redirect_element . appendChild ( document . createTextNode ( ' Invidious' ) ) ;
772772
773773 watch_on_invidious_button . el ( ) . appendChild ( redirect_element ) ;
774- watch_on_invidious_button . addClass ( " watch-on-invidious" ) ;
774+ watch_on_invidious_button . addClass ( ' watch-on-invidious' ) ;
775775
776776 cb = player . getChild ( 'ControlBar' ) ;
777777 cb . addChild ( watch_on_invidious_button ) ;
0 commit comments