faradayfuture commited on
Commit
4e401ad
·
verified ·
1 Parent(s): 084c25f

Refit sidebar height after videos finish loading (ResizeObserver)

Browse files
ep0/viewer.html CHANGED
@@ -431,4 +431,11 @@ function fitHand(){
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
 
 
 
 
 
 
 
434
  </script></body></html>
 
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
434
+ if(window.ResizeObserver){ // 视频异步加载后尺寸会变, 盯住左列随时重算
435
+ var __ro=new ResizeObserver(function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});
436
+ var __cam=document.querySelector('.layout > .panel'); if(__cam)__ro.observe(__cam);
437
+ videos.forEach(function(v){v.addEventListener('loadedmetadata',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});});
438
+ }
439
+ setTimeout(fitHand,2000); setTimeout(fitHand,4000);
440
+
441
  </script></body></html>
ep1/viewer.html CHANGED
@@ -431,4 +431,11 @@ function fitHand(){
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
 
 
 
 
 
 
 
434
  </script></body></html>
 
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
434
+ if(window.ResizeObserver){ // 视频异步加载后尺寸会变, 盯住左列随时重算
435
+ var __ro=new ResizeObserver(function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});
436
+ var __cam=document.querySelector('.layout > .panel'); if(__cam)__ro.observe(__cam);
437
+ videos.forEach(function(v){v.addEventListener('loadedmetadata',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});});
438
+ }
439
+ setTimeout(fitHand,2000); setTimeout(fitHand,4000);
440
+
441
  </script></body></html>
ep2/viewer.html CHANGED
@@ -431,4 +431,11 @@ function fitHand(){
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
 
 
 
 
 
 
 
434
  </script></body></html>
 
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
434
+ if(window.ResizeObserver){ // 视频异步加载后尺寸会变, 盯住左列随时重算
435
+ var __ro=new ResizeObserver(function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});
436
+ var __cam=document.querySelector('.layout > .panel'); if(__cam)__ro.observe(__cam);
437
+ videos.forEach(function(v){v.addEventListener('loadedmetadata',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});});
438
+ }
439
+ setTimeout(fitHand,2000); setTimeout(fitHand,4000);
440
+
441
  </script></body></html>
ep3/viewer.html CHANGED
@@ -431,4 +431,11 @@ function fitHand(){
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
 
 
 
 
 
 
 
434
  </script></body></html>
 
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
434
+ if(window.ResizeObserver){ // 视频异步加载后尺寸会变, 盯住左列随时重算
435
+ var __ro=new ResizeObserver(function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});
436
+ var __cam=document.querySelector('.layout > .panel'); if(__cam)__ro.observe(__cam);
437
+ videos.forEach(function(v){v.addEventListener('loadedmetadata',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});});
438
+ }
439
+ setTimeout(fitHand,2000); setTimeout(fitHand,4000);
440
+
441
  </script></body></html>
ep4/viewer.html CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6bf2fe4455605ca1af3102dd615e0d0fd8206bc8b62fe3af920f46df4ad3953d
3
- size 607139
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b4b097f8b8eb11f90af9c169aa3c6b35b1b2740e8dbc3fec33cb7587d16d706
3
+ size 607648
ep5/viewer.html CHANGED
@@ -431,4 +431,11 @@ function fitHand(){
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
 
 
 
 
 
 
 
434
  </script></body></html>
 
431
  window.addEventListener('resize',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,120);});
432
  window.addEventListener('load',function(){fitHand();setTimeout(fitHand,400);});
433
  setTimeout(fitHand,150); setTimeout(fitHand,900);
434
+ if(window.ResizeObserver){ // 视频异步加载后尺寸会变, 盯住左列随时重算
435
+ var __ro=new ResizeObserver(function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});
436
+ var __cam=document.querySelector('.layout > .panel'); if(__cam)__ro.observe(__cam);
437
+ videos.forEach(function(v){v.addEventListener('loadedmetadata',function(){clearTimeout(window.__fitT);window.__fitT=setTimeout(fitHand,80);});});
438
+ }
439
+ setTimeout(fitHand,2000); setTimeout(fitHand,4000);
440
+
441
  </script></body></html>