repeat the scroll two times to ensure proper webpage load
This commit is contained in:
		
							parent
							
								
									a3749c71d2
								
							
						
					
					
						commit
						f4821010b0
					
				
					 1 changed files with 9 additions and 3 deletions
				
			
		
							
								
								
									
										12
									
								
								scripts/external/scraper.js
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										12
									
								
								scripts/external/scraper.js
									
										
									
									
										vendored
									
									
								
							|  | @ -10,9 +10,15 @@ export default class scraper { | ||||||
| 		function autoscroll() { | 		function autoscroll() { | ||||||
| 			let SCROLL = {"x": window.scrollX, "y": window.scrollY}; | 			let SCROLL = {"x": window.scrollX, "y": window.scrollY}; | ||||||
| 
 | 
 | ||||||
| 			[{"top": 0, "left": 0, "behavior": "smooth"}, {"top": document.body.scrollHeight, "left": document.body.scrollWidth, "behavior": "smooth"}, {"top": SCROLL[`y`], "left": SCROLL[`x`], "behavior": "smooth"}].forEach((POSITION) => { | 			// Repeat two times to ensure proper webpage load. 
 | ||||||
| 				window.scrollTo(POSITION); | 			for (let TIMES = 1; TIMES <= 2; TIMES++) { | ||||||
| 			}) | 				[{"top": 0, "left": 0, "behavior": "smooth"}, {"top": document.body.scrollHeight, "left": document.body.scrollWidth, "behavior": "smooth"}].forEach((POSITION) => { | ||||||
|  | 					window.scrollTo(POSITION); | ||||||
|  | 				}) | ||||||
|  | 			}; | ||||||
|  | 
 | ||||||
|  | 			// Scroll back to user's previous position.
 | ||||||
|  | 			window.scrollTo({"top": SCROLL[`y`], "left": SCROLL[`x`], "behavior": "smooth"}); | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
| 		autoscroll(); | 		autoscroll(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue