← Commit history

adom-video: read the inlined manifest after parse; no frame scrollbar

John Lauer ·9422382411 ·8d ago ·parent 656aa8f
1 file changed +9−3
widgets/video-widget.js+9−3
@@ -263,8 +263,14 @@      connectedCallback() {       if (!active) active = this;-      if (location.pathname.includes('/widget/') && window.top === window) { this.classList.add('page'); this.p.classList.add('page'); }-      this._load();+      if (location.pathname.includes('/widget/')) {+        if (window.top === window) { this.classList.add('page'); this.p.classList.add('page'); }+        // the frame grows to fit the player; a scrollbar would narrow it, shrink the player and stick there+        else document.documentElement.style.overflow = 'hidden';+      }+      // the wiki inlines the manifest as a child script, which is not parsed yet when a head script connects us+      if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', () => this._load(), { once: true });+      else this._load();     }     disconnectedCallback() { if (active === this) active = null; clearTimeout(this._t.hide); this.v.pause(); }     attributeChangedCallback(n, a, b) { if (a !== b && this.isConnected && this._loaded) { if (n === 'video' || n === 'src') this._load(); else if (n === 'chapters') this._chapters(); else if (n === 'captions') this._captions(); else if (n === 'title') this.$('.top').textContent = b || ''; } }@@ -284,7 +290,7 @@     _opt(n) { const a = this.getAttribute(n); if (a != null && a !== '') return a; const m = this._manifest(); return m && m[n] != null ? m[n] : null; }      _load() {-      this._loaded = true;+      this._loaded = true; this._man = undefined;       const m = this._manifest();       const src = this.getAttribute('video') || (m && m.video) || (m ? null : this.getAttribute('src'));       const v = this.v;