-
Notifications
You must be signed in to change notification settings - Fork 6
/
admin.js
46 lines (39 loc) · 1.6 KB
/
admin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
jQuery( function( $ ) {
// Accordion handling in various areas.
$( '.enable-mastodon-apps-settings-accordion' ).on( 'click', '.enable-mastodon-apps-settings-accordion-trigger', function() {
var isExpanded = ( 'true' === $( this ).attr( 'aria-expanded' ) );
if ( isExpanded ) {
$( this ).attr( 'aria-expanded', 'false' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', true );
} else {
$( this ).attr( 'aria-expanded', 'true' );
$( '#' + $( this ).attr( 'aria-controls' ) ).attr( 'hidden', false );
}
} );
$(document).on( 'wp-plugin-install-success', function( event, response ) {
setTimeout( function() {
$( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
}, 1200 );
} );
$(document).on( 'click', '.enable-mastodon-apps-settings .copyable', function( event, response ) {
this.select();
} );
$(document).on( 'click', '.enable-mastodon-apps-registered-apps-page thead', function( event, response ) {
$( this ).parent().find( 'tbody' ).toggle();
} );
const iframe = $( '.enable-mastodon-apps-settings iframe');
if ( iframe.length ) {
setInterval( function() {
iframe[0].style.height = ( iframe[0].contentWindow.document.body.scrollHeight + 50 ) + 'px';
}, 1000 );
}
$(document).on( 'change', '.enable-mastodon-apps-settings .appformats', function( event, response ) {
$( this ).closest('tr').find( '[name=save-app]' ).show();
} );
$(document).on( 'click', '.enable-mastodon-apps-settings button[data-confirm]', function( event, response ) {
if ( ! confirm( this.dataset.confirm ) ) {
event.preventDefault();
return false;
}
} );
} );