updated plugin ActivityPub version 9.1.0
This commit is contained in:
@ -17,4 +17,33 @@ jQuery( function( $ ) {
|
||||
$( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
|
||||
}, 1200 );
|
||||
} );
|
||||
|
||||
/*
|
||||
* Lazy-load embedded iframes (e.g. the Fediverse intro video) only once their
|
||||
* container becomes visible. Help tab panels are rendered hidden, and players
|
||||
* like PeerTube abort with an "invalid width" error when initialized inside a
|
||||
* zero-width container. Deferring the src until the panel is shown avoids that.
|
||||
*/
|
||||
var lazyIframes = document.querySelectorAll( 'iframe[data-src]' );
|
||||
|
||||
if ( lazyIframes.length && 'IntersectionObserver' in window ) {
|
||||
var iframeObserver = new IntersectionObserver( function( entries, observer ) {
|
||||
entries.forEach( function( entry ) {
|
||||
if ( entry.isIntersecting ) {
|
||||
// Set once, then stop observing so it never reloads.
|
||||
entry.target.src = entry.target.dataset.src;
|
||||
observer.unobserve( entry.target );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
|
||||
lazyIframes.forEach( function( iframe ) {
|
||||
iframeObserver.observe( iframe );
|
||||
} );
|
||||
} else {
|
||||
// IntersectionObserver unsupported: load immediately as a fallback.
|
||||
lazyIframes.forEach( function( iframe ) {
|
||||
iframe.src = iframe.dataset.src;
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user