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;
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Toggle the custom distribution-mode fields based on the selected radio.
|
||||
*
|
||||
* The custom batch-size / pause inputs are only relevant when the
|
||||
* "custom" preset is active. They are rendered visible by default so the
|
||||
* form remains usable when JavaScript is disabled; this script collapses
|
||||
* them on load when another mode is selected, and toggles them when the
|
||||
* radio changes.
|
||||
*/
|
||||
|
||||
( function() {
|
||||
const radios = document.querySelectorAll( 'input[name="activitypub_distribution_mode"]' );
|
||||
const fields = document.getElementById( 'activitypub-custom-distribution-fields' );
|
||||
|
||||
if ( ! fields || ! radios.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
function updateVisibility( value ) {
|
||||
fields.style.display = 'custom' === value ? '' : 'none';
|
||||
}
|
||||
|
||||
const initial = document.querySelector( 'input[name="activitypub_distribution_mode"]:checked' );
|
||||
updateVisibility( initial ? initial.value : 'default' );
|
||||
|
||||
radios.forEach( function( radio ) {
|
||||
radio.addEventListener( 'change', function() {
|
||||
updateVisibility( this.value );
|
||||
} );
|
||||
} );
|
||||
}() );
|
||||
Reference in New Issue
Block a user