2023-04-12 22:40:06 +02:00
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later
2023-11-26 11:01:54 +01:00
/ *
CryptoJS v3 . 1.2
code . google . com / p / crypto - js
( c ) 2009 - 2013 by Jeff Mott . All rights reserved .
code . google . com / p / crypto - js / wiki / License
* /
var CryptoJS = CryptoJS || function ( h , s ) { var f = { } , t = f . lib = { } , g = function ( ) { } , j = t . Base = { extend : function ( a ) { g . prototype = this ; var c = new g ; a && c . mixIn ( a ) ; c . hasOwnProperty ( "init" ) || ( c . init = function ( ) { c . $super . init . apply ( this , arguments ) } ) ; c . init . prototype = c ; c . $super = this ; return c } , create : function ( ) { var a = this . extend ( ) ; a . init . apply ( a , arguments ) ; return a } , init : function ( ) { } , mixIn : function ( a ) { for ( var c in a ) a . hasOwnProperty ( c ) && ( this [ c ] = a [ c ] ) ; a . hasOwnProperty ( "toString" ) && ( this . toString = a . toString ) } , clone : function ( ) { return this . init . prototype . extend ( this ) } } ,
q = t . WordArray = j . extend ( { init : function ( a , c ) { a = this . words = a || [ ] ; this . sigBytes = c != s ? c : 4 * a . length } , toString : function ( a ) { return ( a || u ) . stringify ( this ) } , concat : function ( a ) { var c = this . words , d = a . words , b = this . sigBytes ; a = a . sigBytes ; this . clamp ( ) ; if ( b % 4 ) for ( var e = 0 ; e < a ; e ++ ) c [ b + e >>> 2 ] |= ( d [ e >>> 2 ] >>> 24 - 8 * ( e % 4 ) & 255 ) << 24 - 8 * ( ( b + e ) % 4 ) ; else if ( 65535 < d . length ) for ( e = 0 ; e < a ; e += 4 ) c [ b + e >>> 2 ] = d [ e >>> 2 ] ; else c . push . apply ( c , d ) ; this . sigBytes += a ; return this } , clamp : function ( ) { var a = this . words , c = this . sigBytes ; a [ c >>> 2 ] &= 4294967295 <<
32 - 8 * ( c % 4 ) ; a . length = h . ceil ( c / 4 ) } , clone : function ( ) { var a = j . clone . call ( this ) ; a . words = this . words . slice ( 0 ) ; return a } , random : function ( a ) { for ( var c = [ ] , d = 0 ; d < a ; d += 4 ) c . push ( 4294967296 * h . random ( ) | 0 ) ; return new q . init ( c , a ) } } ) , v = f . enc = { } , u = v . Hex = { stringify : function ( a ) { var c = a . words ; a = a . sigBytes ; for ( var d = [ ] , b = 0 ; b < a ; b ++ ) { var e = c [ b >>> 2 ] >>> 24 - 8 * ( b % 4 ) & 255 ; d . push ( ( e >>> 4 ) . toString ( 16 ) ) ; d . push ( ( e & 15 ) . toString ( 16 ) ) } return d . join ( "" ) } , parse : function ( a ) { for ( var c = a . length , d = [ ] , b = 0 ; b < c ; b += 2 ) d [ b >>> 3 ] |= parseInt ( a . substr ( b ,
2 ) , 16 ) << 24 - 4 * ( b % 8 ) ; return new q . init ( d , c / 2 ) } } , k = v . Latin1 = { stringify : function ( a ) { var c = a . words ; a = a . sigBytes ; for ( var d = [ ] , b = 0 ; b < a ; b ++ ) d . push ( String . fromCharCode ( c [ b >>> 2 ] >>> 24 - 8 * ( b % 4 ) & 255 ) ) ; return d . join ( "" ) } , parse : function ( a ) { for ( var c = a . length , d = [ ] , b = 0 ; b < c ; b ++ ) d [ b >>> 2 ] |= ( a . charCodeAt ( b ) & 255 ) << 24 - 8 * ( b % 4 ) ; return new q . init ( d , c ) } } , l = v . Utf8 = { stringify : function ( a ) { try { return decodeURIComponent ( escape ( k . stringify ( a ) ) ) } catch ( c ) { throw Error ( "Malformed UTF-8 data" ) ; } } , parse : function ( a ) { return k . parse ( unescape ( encodeURIComponent ( a ) ) ) } } ,
x = t . BufferedBlockAlgorithm = j . extend ( { reset : function ( ) { this . _data = new q . init ; this . _nDataBytes = 0 } , _append : function ( a ) { "string" == typeof a && ( a = l . parse ( a ) ) ; this . _data . concat ( a ) ; this . _nDataBytes += a . sigBytes } , _process : function ( a ) { var c = this . _data , d = c . words , b = c . sigBytes , e = this . blockSize , f = b / ( 4 * e ) , f = a ? h . ceil ( f ) : h . max ( ( f | 0 ) - this . _minBufferSize , 0 ) ; a = f * e ; b = h . min ( 4 * a , b ) ; if ( a ) { for ( var m = 0 ; m < a ; m += e ) this . _doProcessBlock ( d , m ) ; m = d . splice ( 0 , a ) ; c . sigBytes -= b } return new q . init ( m , b ) } , clone : function ( ) { var a = j . clone . call ( this ) ;
a . _data = this . _data . clone ( ) ; return a } , _minBufferSize : 0 } ) ; t . Hasher = x . extend ( { cfg : j . extend ( ) , init : function ( a ) { this . cfg = this . cfg . extend ( a ) ; this . reset ( ) } , reset : function ( ) { x . reset . call ( this ) ; this . _doReset ( ) } , update : function ( a ) { this . _append ( a ) ; this . _process ( ) ; return this } , finalize : function ( a ) { a && this . _append ( a ) ; return this . _doFinalize ( ) } , blockSize : 16 , _createHelper : function ( a ) { return function ( c , d ) { return ( new a . init ( d ) ) . finalize ( c ) } } , _createHmacHelper : function ( a ) { return function ( c , d ) { return ( new w . HMAC . init ( a ,
d ) ) . finalize ( c ) } } } ) ; var w = f . algo = { } ; return f } ( Math ) ;
( function ( h ) { for ( var s = CryptoJS , f = s . lib , t = f . WordArray , g = f . Hasher , f = s . algo , j = [ ] , q = [ ] , v = function ( a ) { return 4294967296 * ( a - ( a | 0 ) ) | 0 } , u = 2 , k = 0 ; 64 > k ; ) { var l ; a : { l = u ; for ( var x = h . sqrt ( l ) , w = 2 ; w <= x ; w ++ ) if ( ! ( l % w ) ) { l = ! 1 ; break a } l = ! 0 } l && ( 8 > k && ( j [ k ] = v ( h . pow ( u , 0.5 ) ) ) , q [ k ] = v ( h . pow ( u , 1 / 3 ) ) , k ++ ) ; u ++ } var a = [ ] , f = f . SHA256 = g . extend ( { _doReset : function ( ) { this . _hash = new t . init ( j . slice ( 0 ) ) } , _doProcessBlock : function ( c , d ) { for ( var b = this . _hash . words , e = b [ 0 ] , f = b [ 1 ] , m = b [ 2 ] , h = b [ 3 ] , p = b [ 4 ] , j = b [ 5 ] , k = b [ 6 ] , l = b [ 7 ] , n = 0 ; 64 > n ; n ++ ) { if ( 16 > n ) a [ n ] =
c [ d + n ] | 0 ; else { var r = a [ n - 15 ] , g = a [ n - 2 ] ; a [ n ] = ( ( r << 25 | r >>> 7 ) ^ ( r << 14 | r >>> 18 ) ^ r >>> 3 ) + a [ n - 7 ] + ( ( g << 15 | g >>> 17 ) ^ ( g << 13 | g >>> 19 ) ^ g >>> 10 ) + a [ n - 16 ] } r = l + ( ( p << 26 | p >>> 6 ) ^ ( p << 21 | p >>> 11 ) ^ ( p << 7 | p >>> 25 ) ) + ( p & j ^ ~ p & k ) + q [ n ] + a [ n ] ; g = ( ( e << 30 | e >>> 2 ) ^ ( e << 19 | e >>> 13 ) ^ ( e << 10 | e >>> 22 ) ) + ( e & f ^ e & m ^ f & m ) ; l = k ; k = j ; j = p ; p = h + r | 0 ; h = m ; m = f ; f = e ; e = r + g | 0 } b [ 0 ] = b [ 0 ] + e | 0 ; b [ 1 ] = b [ 1 ] + f | 0 ; b [ 2 ] = b [ 2 ] + m | 0 ; b [ 3 ] = b [ 3 ] + h | 0 ; b [ 4 ] = b [ 4 ] + p | 0 ; b [ 5 ] = b [ 5 ] + j | 0 ; b [ 6 ] = b [ 6 ] + k | 0 ; b [ 7 ] = b [ 7 ] + l | 0 } , _doFinalize : function ( ) { var a = this . _data , d = a . words , b = 8 * this . _nDataBytes , e = 8 * a . sigBytes ;
d [ e >>> 5 ] |= 128 << 24 - e % 32 ; d [ ( e + 64 >>> 9 << 4 ) + 14 ] = h . floor ( b / 4294967296 ) ; d [ ( e + 64 >>> 9 << 4 ) + 15 ] = b ; a . sigBytes = 4 * d . length ; this . _process ( ) ; return this . _hash } , clone : function ( ) { var a = g . clone . call ( this ) ; a . _hash = this . _hash . clone ( ) ; return a } } ) ; s . SHA256 = g . _createHelper ( f ) ; s . HmacSHA256 = g . _createHmacHelper ( f ) } ) ( Math ) ;
2023-11-12 15:58:48 +01:00
// Get the current URL
const url = new URL ( window . location . href ) ;
// Remove the 'fx' query parameter
url . searchParams . delete ( 'fx' ) ;
// Replace the current URL without the 'fx' parameter
history . replaceState ( null , '' , url . toString ( ) ) ;
2023-04-12 22:40:06 +02:00
// Retrieve volume from local storage or set to max if not available
const initialVolume = localStorage . getItem ( 'playerVolume' ) || 1 ;
const video = document . getElementById ( 'video' ) ;
video . volume = initialVolume ;
// Save volume to local storage whenever it changes
video . addEventListener ( 'volumechange' , function ( ) {
localStorage . setItem ( 'playerVolume' , this . volume ) ;
} ) ;
// Get the progress bar and container elements
2023-06-10 10:07:07 +02:00
const progressBar = document . querySelector ( ".progress-bar" ) ;
const progressContainer = document . querySelector ( ".progress-container" ) ;
2023-04-12 22:40:06 +02:00
// Set the initial width of the progress bar to 0%
2023-06-10 10:07:07 +02:00
progressBar . style . width = "0%" ;
progressContainer . style . display = 'block' ;
2023-04-12 22:40:06 +02:00
// Attach an event listener to the window object to listen for the 'load' event
window . addEventListener ( "load" , ( ) => {
2023-06-10 10:07:07 +02:00
progressBar . style . width = "100%" ;
2023-04-12 22:40:06 +02:00
setTimeout ( ( ) => {
2023-06-10 10:07:07 +02:00
progressContainer . style . display = 'none' ;
2023-04-12 22:40:06 +02:00
} , 500 ) ;
} ) ;
2023-06-10 10:07:07 +02:00
// Lazy load background images
2023-04-12 22:40:06 +02:00
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
2023-06-10 10:07:07 +02:00
const bgs = document . querySelectorAll ( '[data-bg]' ) ;
let bgCount = bgs . length ;
function loadBg ( index ) {
const bg = bgs [ index ] ;
const bgUrl = bg . getAttribute ( 'data-bg' ) ;
bg . style . backgroundImage = ` url( ${ bgUrl } ) ` ;
2023-04-12 22:40:06 +02:00
bg . removeAttribute ( 'data-bg' ) ;
bg . classList . add ( 'loaded' ) ;
}
function lazyLoadBg ( ) {
for ( let i = 0 ; i < bgCount ; i ++ ) {
2023-06-10 10:07:07 +02:00
const bg = bgs [ i ] ;
const bgRect = bg . getBoundingClientRect ( ) ;
2023-04-12 22:40:06 +02:00
if ( bgRect . top < window . innerHeight && bgRect . bottom > 0 ) {
loadBg ( i ) ;
}
}
}
2023-06-10 10:07:07 +02:00
2023-04-12 22:40:06 +02:00
lazyLoadBg ( ) ;
2023-06-10 10:07:07 +02:00
2023-04-12 22:40:06 +02:00
window . addEventListener ( 'scroll' , lazyLoadBg ) ;
window . addEventListener ( 'resize' , lazyLoadBg ) ;
} ) ;
2023-06-10 10:07:07 +02:00
2024-05-08 15:56:04 +02:00
const htmlContent = ` <!DOCTYPE html><html><head><title>Browser is not supported :p</title><style>body{margin-left:auto;margin-right:auto;display:flex;max-width:43em;font-family:sans-serif;background-color:white;}</style></head><body><h1>Heyo :3</h1><br><p style="margin-top:4em;margin-left:-7.4em;">hoi - poke does and <b>will not work</b> on Internet Explorer :p<br>if u wanna use poke try using Firefox (firefox.com) or Chromium :3<br>love u :3</p></body></html> ` ;
if ( /MSIE \d|Trident.*rv:/ . test ( navigator . userAgent ) ) {
document . open ( ) ;
document . write ( htmlContent ) ;
document . close ( ) ;
}
2023-06-10 10:07:07 +02:00
// Fade in elements on scroll or fullscreen change
function fadeInElements ( ) {
2023-04-12 22:40:06 +02:00
const elements = document . querySelectorAll ( '.fade-in' ) ;
const viewportHeight = window . innerHeight ;
elements . forEach ( element => {
const elementTop = element . getBoundingClientRect ( ) . top ;
const elementBottom = element . getBoundingClientRect ( ) . bottom ;
const isVisible = ( elementTop < viewportHeight && elementBottom > 0 ) ;
if ( isVisible || document . fullscreenElement ) {
element . classList . add ( 'fade-in-active' ) ;
}
} ) ;
2023-06-10 10:07:07 +02:00
}
2023-04-12 22:40:06 +02:00
2023-06-10 16:44:04 +02:00
function jumpToTime ( e ) {
e . preventDefault ( ) ;
const link = e . target ;
const video = document . getElementById ( 'video' ) ;
const time = link . dataset . jumpTime ;
video . currentTime = time ;
window . location . hash = 'top' ; // Add #video to the URL
setTimeout ( ( ) => {
history . replaceState ( null , null , ' ' ) ; // Remove #video after 1 second
} , 250 ) ;
}
2023-06-10 10:07:07 +02:00
// Handle click events for time-based links
const timeLinks = document . querySelectorAll ( 'a[data-onclick="jump_to_time"]' ) ;
timeLinks . forEach ( link => {
2023-04-12 22:40:06 +02:00
const href = link . getAttribute ( 'href' ) ;
2023-06-10 10:07:07 +02:00
if ( link . dataset . jumpTime && href && href . includes ( '&t=' ) ) {
2023-04-12 22:40:06 +02:00
const params = new URLSearchParams ( href . split ( '?' ) [ 1 ] ) ;
const time = params . get ( 't' ) ;
if ( time ) {
link . dataset . jumpTime = time ;
link . addEventListener ( 'click' , jumpToTime ) ;
link . removeAttribute ( 'href' ) ;
}
}
} ) ;
2024-04-11 10:14:43 +02:00
const videoPlayer = document . getElementById ( 'video' ) ;
function time ( seconds ) {
videoPlayer . currentTime = seconds ;
2024-04-11 10:26:47 +02:00
// Add #video to the URL
window . location . hash = 'top' ;
// Remove #video after a short delay
setTimeout ( ( ) => {
history . replaceState ( null , null , ' ' ) ;
} , 250 ) ;
2024-04-11 10:14:43 +02:00
}
2024-04-11 10:26:47 +02:00
2024-04-11 10:14:43 +02:00
document . addEventListener ( 'click' , function ( event ) {
const clickedElement = event . target ;
if ( clickedElement . classList . contains ( 'comment' ) ) {
const commentText = clickedElement . textContent . trim ( ) ;
const timestampMatch = commentText . match ( /(\d{1,2}:\d{2})/ ) ;
if ( timestampMatch ) {
const timestamp = timestampMatch [ 0 ] ;
let parts = timestamp . split ( ':' ) ;
let seconds = ( + parts [ 0 ] ) * 60 + ( + parts [ 1 ] ) ;
time ( seconds ) ;
}
}
} ) ;
2023-09-09 18:37:04 +02:00
2023-04-12 22:40:06 +02:00
2023-06-10 10:07:07 +02:00
// Save and resume video progress
2023-04-12 22:40:06 +02:00
const videoId = new URLSearchParams ( window . location . search ) . get ( 'v' ) ;
const localStorageKey = ` progress- ${ videoId } ` ;
function saveProgress ( ) {
localStorage . setItem ( localStorageKey , video . currentTime ) ;
}
function removeProgress ( ) {
localStorage . removeItem ( localStorageKey ) ;
}
function resumeProgress ( ) {
const progress = localStorage . getItem ( localStorageKey ) ;
if ( progress ) {
video . currentTime = progress ;
}
}
2024-04-21 05:16:07 +02:00
window . addEventListener ( 'beforeunload' , ( ) => {
saveProgress ( ) ;
2023-04-12 22:40:06 +02:00
} ) ;
video . addEventListener ( 'ended' , ( ) => {
removeProgress ( ) ;
} ) ;
window . addEventListener ( 'load' , ( ) => {
resumeProgress ( ) ;
} ) ;
2023-06-10 10:07:07 +02:00
// Adjust video element style on fullscreen change
2023-04-12 22:40:06 +02:00
const videoElement = document . getElementById ( "video" ) ;
videoElement . addEventListener ( "fullscreenchange" , ( ) => {
2023-06-10 10:07:07 +02:00
videoElement . style . borderRadius = document . fullscreenElement === videoElement ? "0em" : "16px" ;
} ) ;
2023-04-28 22:36:16 +02:00
2023-09-09 18:37:04 +02:00
function fetchUrls ( urls ) {
let fetchedCount = 0 ;
urls . forEach ( link => {
const url = new URL ( link . href ) ;
if ( url . host !== 'www.youtube.com' && url . host !== 'youtube.com' && url . host !== "redirect.poketube.fun" ) {
console . log ( ` Fetching ${ url . origin } ` ) ;
fetch ( url . href )
. then ( response => {
if ( response . status === 500 ) {
// do nothing
}
console . log ( ` Fetched ${ url . origin } ` ) ;
fetchedCount ++ ;
console . clear ( ) ;
if ( fetchedCount === urls . length ) {
document . body . classList . remove ( 'blur' ) ;
}
} )
. catch ( error => {
console . clear ( ) ;
if ( ! ( error instanceof TypeError && error . message . includes ( 'Failed to fetch' ) ) ) {
console . error ( ` Error fetching ${ url . origin } : ${ error } ` ) ;
}
} ) ;
}
} ) ;
}
2023-12-17 13:26:56 +01:00
function anondocumenttitle ( message , times ) {
var hash = CryptoJS . SHA256 ( message ) ;
return hash . toString ( CryptoJS . enc . Hex ) ;
}
2023-12-17 13:37:17 +01:00
if ( navigator . globalPrivacyControl ) {
var gpcValue = navigator ? . globalPrivacyControl
} else {
var gpcValue = false
}
2023-12-17 13:26:56 +01:00
2024-01-25 09:21:52 +01:00
if ( location . hostname === "poketube.fun" ) {
2023-12-17 13:26:56 +01:00
if ( typeof Ashley === "undefined" ) {
var Ashley = { } ;
}
Ashley . dntEnabled = function ( dnt , ua ) {
"use strict" ;
var dntStatus =
dnt ||
navigator . doNotTrack ||
window . doNotTrack ||
navigator . msDoNotTrack ;
var userAgent = ua || navigator . userAgent ;
var anomalousWinVersions = [
"Windows NT 6.1" ,
"Windows NT 6.2" ,
"Windows NT 6.3" ,
] ;
var fxMatch = userAgent . match ( /Firefox\/(\d+)/ ) ;
var ieRegEx = /MSIE|Trident/i ;
var isIE = ieRegEx . test ( userAgent ) ;
var platform = userAgent . match ( /Windows.+?(?=;)/g ) ;
if ( isIE && typeof Array . prototype . indexOf !== "function" ) {
return false ;
} else if ( fxMatch && parseInt ( fxMatch [ 1 ] , 10 ) < 32 ) {
dntStatus = "Unspecified" ;
} else if (
isIE &&
platform &&
anomalousWinVersions . indexOf ( platform . toString ( ) ) !== - 1
) {
dntStatus = "Unspecified" ;
} else {
dntStatus = { 0 : "Disabled" , 1 : "Enabled" } [ dntStatus ] || "Unspecified" ;
}
return dntStatus === "Enabled" ? true : false ;
} ;
// only load if DNT is not enabled
2023-12-17 13:37:17 +01:00
if ( ! gpcValue ) {
2023-12-17 13:26:56 +01:00
if ( Ashley && ! Ashley . dntEnabled ( ) ) {
var _paq = ( window . _paq = window . _paq || [ ] ) ;
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq . push ( [
"setDocumentTitle" ,
anondocumenttitle ( document . domain , 5 ) +
"/" +
anondocumenttitle ( document . title , 5 ) ,
] ) ;
_paq . push ( [ "setDoNotTrack" , true ] ) ;
_paq . push ( [ "disableCookies" ] ) ;
_paq . push ( [ "trackPageView" ] ) ;
_paq . push ( [ "enableLinkTracking" ] ) ;
( function ( ) {
var u = "//data.poketube.fun/" ;
_paq . push ( [ "setTrackerUrl" , u + "matomo.php" ] ) ;
_paq . push ( [ "setSiteId" , "2" ] ) ;
var d = document ,
g = d . createElement ( "script" ) ,
s = d . getElementsByTagName ( "script" ) [ 0 ] ;
g . async = true ;
g . src = u + "matomo.js" ;
s . parentNode . insertBefore ( g , s ) ;
} ) ( ) ;
}
}
2023-12-17 13:37:17 +01:00
}
2023-12-17 13:26:56 +01:00
2023-06-18 18:13:15 +02:00
var popupMenu = document . getElementById ( "popupMenu" ) ;
var loopOption = document . getElementById ( "loopOption" ) ;
var speedOption = document . getElementById ( "speedOption" ) ;
2024-01-01 20:08:26 +01:00
2023-06-18 18:13:15 +02:00
2024-01-01 20:08:26 +01:00
video . addEventListener ( "contextmenu" , function ( event ) {
// Check if the video is in fullscreen mode
if ( ! document . fullscreenElement && ! document . webkitFullscreenElement && ! document . mozFullScreenElement && ! document . msFullscreenElement ) {
2024-01-09 21:09:34 +01:00
event . preventDefault ( ) ;
2024-01-01 20:08:26 +01:00
2024-01-09 21:09:34 +01:00
popupMenu . style . display = "block" ;
2024-01-01 20:08:26 +01:00
popupMenu . style . left = event . pageX + "px" ;
popupMenu . style . top = event . pageY + "px" ;
}
} ) ;
2023-06-18 18:13:15 +02:00
// Hide the popup menu when clicking outside of it
window . addEventListener ( "click" , function ( event ) {
if ( event . target !== video ) {
popupMenu . style . display = "none" ;
}
} ) ;
2023-12-20 17:16:38 +01:00
var loopedIndicator = document . getElementById ( "loopedIndicator" ) ;
loopedIndicator . style . display = "none" ; // Initially hide the indicator
2023-06-18 18:13:15 +02:00
loopOption . addEventListener ( "click" , function ( ) {
2023-12-20 17:16:38 +01:00
var looped = video . loop ;
video . loop = ! looped ;
2023-12-20 18:29:05 +01:00
// Update the looped indicator popup
var displaySpecialText = Math . random ( ) < 0.5 ;
2023-12-20 17:16:38 +01:00
// Update the looped indicator popup
2023-12-20 18:29:05 +01:00
if ( displaySpecialText ) {
var specialText = looped ? "Unlooped >.<" : "Looped~ :3 >~<" ;
loopedIndicator . textContent = specialText ;
} else {
loopedIndicator . textContent = looped ? "Unlooped!" : "Looped!" ;
}
loopedIndicator . style . display = "block" ;
2023-12-20 17:16:38 +01:00
// Hide the indicator after 2 seconds
setTimeout ( function ( ) {
loopedIndicator . style . display = "none" ;
2023-12-20 21:41:27 +01:00
} , 2000 ) ;
2023-12-20 17:16:38 +01:00
2023-06-18 18:13:15 +02:00
} ) ;
speedOption . addEventListener ( "click" , function ( ) {
2024-07-03 00:09:57 +02:00
2023-06-18 18:13:15 +02:00
var currentSpeed = video . playbackRate ;
var newSpeed = getNextSpeed ( currentSpeed ) ;
video . playbackRate = newSpeed ;
2024-07-03 00:09:57 +02:00
document . getElementById ( "aud" ) . playbackRate = newSpeed ;
2023-12-07 16:43:45 +01:00
speedOption . innerHTML = "<i class='fa-light fa-gauge'></i> Speed: " + newSpeed . toFixed ( 2 ) + "x" ;
2023-06-18 18:13:15 +02:00
} ) ;
function getNextSpeed ( currentSpeed ) {
if ( currentSpeed === 2 ) {
return 0.25 ;
} else if ( currentSpeed === 0.25 ) {
return 0.5 ;
} else if ( currentSpeed === 0.5 ) {
return 0.75 ;
} else if ( currentSpeed === 0.75 ) {
return 1 ;
} else {
return 2 ;
}
}
2024-01-09 21:09:34 +01:00
const GoogleTranslateEndpoint = "https://translate.google.com/_/TranslateWebserverUi/data/batchexecute?rpcids=MkEWBc&rt=c"
2023-06-10 10:07:07 +02:00
// @license-end