mirror of
				https://github.com/SoPat712/videospeed.git
				synced 2025-10-29 18:30:35 -04:00 
			
		
		
		
	Moved ratechange listener into its own function
Placed call for adding listener after call to document ready/disabled check Placed setupListener within try/catch block
This commit is contained in:
		
							
								
								
									
										18
									
								
								inject.js
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								inject.js
									
									
									
									
									
								
							| @@ -374,11 +374,7 @@ function refreshCoolDown() { | ||||
|   log("End refreshCoolDown", 5); | ||||
| } | ||||
|  | ||||
| function initializeWhenReady(document) { | ||||
|   log("Begin initializeWhenReady", 5); | ||||
|   if (isBlacklisted()) { | ||||
|     return; | ||||
|   } | ||||
| function setupListener() { | ||||
|   document.body.addEventListener( | ||||
|     "ratechange", | ||||
|     function(event) { | ||||
| @@ -391,6 +387,13 @@ function initializeWhenReady(document) { | ||||
|     }, | ||||
|     true | ||||
|   ); | ||||
| } | ||||
|  | ||||
| function initializeWhenReady(document) { | ||||
|   log("Begin initializeWhenReady", 5); | ||||
|   if (isBlacklisted()) { | ||||
|     return; | ||||
|   } | ||||
|   window.onload = () => { | ||||
|     initializeNow(window.document); | ||||
|   }; | ||||
| @@ -449,6 +452,11 @@ function initializeNow(document) { | ||||
|   if (!document.body || document.body.classList.contains("vsc-initialized")) { | ||||
|     return; | ||||
|   } | ||||
|   try { | ||||
|     setupListener(); | ||||
|   } catch { | ||||
|     // no operation | ||||
|   } | ||||
|   document.body.classList.add("vsc-initialized"); | ||||
|   log("initializeNow: vsc-initialized added to document body", 5); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Chad Bailey
					Chad Bailey