2024-10-22 18:52:57 +02:00
|
|
|
jQuery( function( $ ) {
|
|
|
|
// Accordion handling in various areas.
|
2024-12-05 16:16:30 +01:00
|
|
|
$( '.event-bridge-for-activitypub-settings-accordion' ).on( 'click', '.event-bridge-for-activitypub-settings-accordion-trigger', function() {
|
2024-10-22 18:52:57 +02:00
|
|
|
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 );
|
|
|
|
}
|
|
|
|
} );
|
2024-12-15 17:01:15 +01:00
|
|
|
|
|
|
|
// Function to toggle visibility of custom details based on selected radio button.
|
|
|
|
function toggleCustomDetailsForSummary() {
|
|
|
|
if ($("#event_bridge_for_activitypub_summary_type_custom").is(':checked')) {
|
|
|
|
$("#event_bridge_for_activitypub_summary_type_custom-details").show();
|
|
|
|
} else {
|
|
|
|
$("#event_bridge_for_activitypub_summary_type_custom-details").hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run the toggle function on page load.
|
|
|
|
$(document).ready(function() {
|
|
|
|
toggleCustomDetailsForSummary(); // Set the correct state on load.
|
|
|
|
|
|
|
|
// Listen for changes on the radio buttons
|
|
|
|
$("input[name=event_bridge_for_activitypub_summary_type]").change(function() {
|
|
|
|
toggleCustomDetailsForSummary(); // Update visibility on change.
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2024-10-22 18:52:57 +02:00
|
|
|
} );
|