| 
									
										
										
										
											2017-12-30 02:58:24 +01:00
										 |  |  | if(Debug.debug) | 
					
						
							|  |  |  |   console.log("Loading: PageInfo.js"); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  | class PageInfo { | 
					
						
							|  |  |  |   constructor(){ | 
					
						
							|  |  |  |     this.hasVideos = false; | 
					
						
							|  |  |  |     this.siteDisabled = false; | 
					
						
							|  |  |  |     this.videos = []; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |     this.rescan(); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   rescan(count){ | 
					
						
							|  |  |  |     var vids = document.getElementsByTagName('video'); | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |     if(!vids || vids.length == 0){ | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  |       this.hasVideos = false; | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |     debugger; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  |     // add new videos
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |     for(var video of vids){ | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  |       var existing = this.videos.find( (x) => { | 
					
						
							|  |  |  |         if (x == video.video) | 
					
						
							|  |  |  |           return x; | 
					
						
							|  |  |  |         if (x.currentSrc == video.video.currentSrc){ | 
					
						
							|  |  |  |           return x; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       }) | 
					
						
							|  |  |  |        | 
					
						
							|  |  |  |       if(existing){ | 
					
						
							|  |  |  |         video.video = existing; | 
					
						
							|  |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |         this.videos.push( | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  |           new VideoData(video) | 
					
						
							|  |  |  |         ); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |   initAr(){ | 
					
						
							|  |  |  |     for(var vd in this.videos){ | 
					
						
							|  |  |  |       vd.initAr(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2018-05-13 13:49:25 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |   setAr(ar){ | 
					
						
							|  |  |  |     // TODO: find a way to only change aspect ratio for one video
 | 
					
						
							|  |  |  |     for(var vd in this.videos){ | 
					
						
							|  |  |  |       vd.setAr(ar) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2017-12-30 02:58:24 +01:00
										 |  |  |    | 
					
						
							| 
									
										
										
										
											2018-05-13 21:05:11 +02:00
										 |  |  |   setStretchMode(sm){ | 
					
						
							|  |  |  |     for(var vd in this.videos){ | 
					
						
							|  |  |  |       vd.setStretchMode(ar) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } |