wordpress-activitypub-event.../assets/js/activitypub-event-bridge-admin.js

34 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

jQuery( function( $ ) {
// Accordion handling in various areas.
$( '.activitypub-event-bridge-settings-accordion' ).on( 'click', '.activitypub-event-bridge-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 );
}
} );
2024-11-19 21:05:21 +01:00
// Function to toggle visibility of custom details based on selected radio button.
function toggleCustomDetailsForSummary() {
if ($("#activitypub_summary_type_custom").is(':checked')) {
$("#activitypub_summary_type_custom-details").show();
} else {
$("#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=activitypub_summary_type]").change(function() {
toggleCustomDetailsForSummary(); // Update visibility on change.
});
});
} );