PluginProbe
ActivityPub / 9.0.1
ActivityPub v9.0.1
9.3.1 9.3.0 9.2.2 9.2.1 9.2.0 9.1.0 9.0.2 9.0.1 9.0.0 8.3.0 8.2.1 8.2.0 8.1.1 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.2.0 1.3.0 2.0.0 2.0.1 2.1.0 2.1.1 All 160 releases
activitypub / assets / js / activitypub-admin.js

activitypub-admin.js in ActivityPub 9.0.1, at assets/js/activitypub-admin.js

50 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 jQuery( function( $ ) {
2 // Accordion handling in various areas.
3 $( '.activitypub-settings-accordion' ).on( 'click', '.activitypub-settings-accordion-trigger', function() {
4 var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
5
6 if ( isExpanded ) {
7 $( this ).attr( 'aria-expanded', 'false' );
8 $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
9 } else {
10 $( this ).attr( 'aria-expanded', 'true' );
11 $( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
12 }
13 } );
14
15 $(document).on( 'wp-plugin-install-success', function( event, response ) {
16 setTimeout( function() {
17 $( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
18 }, 1200 );
19 } );
20
21 /*
22 * Lazy-load embedded iframes (e.g. the Fediverse intro video) only once their
23 * container becomes visible. Help tab panels are rendered hidden, and players
24 * like PeerTube abort with an "invalid width" error when initialized inside a
25 * zero-width container. Deferring the src until the panel is shown avoids that.
26 */
27 var lazyIframes = document.querySelectorAll( 'iframe[data-src]' );
28
29 if ( lazyIframes.length && 'IntersectionObserver' in window ) {
30 var iframeObserver = new IntersectionObserver( function( entries, observer ) {
31 entries.forEach( function( entry ) {
32 if ( entry.isIntersecting ) {
33 // Set once, then stop observing so it never reloads.
34 entry.target.src = entry.target.dataset.src;
35 observer.unobserve( entry.target );
36 }
37 } );
38 } );
39
40 lazyIframes.forEach( function( iframe ) {
41 iframeObserver.observe( iframe );
42 } );
43 } else {
44 // IntersectionObserver unsupported: load immediately as a fallback.
45 lazyIframes.forEach( function( iframe ) {
46 iframe.src = iframe.dataset.src;
47 } );
48 }
49 } );
50