1(function ($) { 2 if ( 'true' === my_calendar.list ) { 3 if ( 'false' === my_calendar.links ) { 4 $('li .list-event' ).hide(); 5 $('li.current-day .list-event').show(); 6 $('li.current-day .event-date .mc-text-button' ).attr( 'aria-expanded', true ); 7 $(document).on( 'click', '.event-date button', function (e) { 8 e.preventDefault(); 9 $( this ).closest( '.mc-events' ).find( '.mc-event' ).toggle(); 10 let visible = $(this).closest( '.mc-events' ).find( '.mc-event' ).is(':visible'); 11 if ( visible ) { 12 $(this).attr('aria-expanded', 'true'); 13 } else { 14 $(this).attr('aria-expanded', 'false'); 15 } 16 e.stopImmediatePropagation(); 17 return false; 18 }); 19 } 20 } 21 22 if ( 'true' === my_calendar.list && 'true' === my_calendar.links ) { 23 let container = '.list-event'; 24 $( container + ' .single-details' ).hide(); 25 $(document).on('click', container + ' .event-title .open', 26 function (e) { 27 let visible = $(this).parents( '.mc-event' ).children( '.details' ).is(':visible'); 28 let controls = $( this ).attr( 'aria-controls' ); 29 const controlled = $( '#' + controls ); 30 if ( visible ) { 31 $(this).attr( 'aria-expanded', 'false' ); 32 } else { 33 $(this).attr( 'aria-expanded', 'true' ); 34 } 35 e.preventDefault(); 36 let current_date = $(this).parents( '.mc-event' ).children(); 37 38 $(this).closest( '.mc-main' ).toggleClass( 'grid-open' ); 39 controlled.toggle(); 40 41 const focusable = current_date.find( 'a, button:not(.event-title > button), object, :input, iframe, [tabindex]' ); 42 const lastFocus = focusable.last(); 43 const firstFocus = focusable.first(); 44 firstFocus.attr( 'data-action', 'shiftforward' ); 45 lastFocus.attr( 'data-action', 'shiftback' ); 46 47 $( container ).children( '.single-details' ).not( current_date ).hide(); 48 e.stopImmediatePropagation(); 49 return false; 50 } 51 ); 52 53 $(document).on('click', '.calendar-event .close', 54 function (e) { 55 e.preventDefault(); 56 $(this).parents( '.mc-event' ).find( 'a.open' ).attr( 'aria-expanded', 'false' ); 57 $(this).closest( '.mc-main' ).removeClass( 'grid-open' ); 58 $(this).closest('.mc-event').find('.event-title a').trigger( 'focus' ); 59 $(this).closest('div.single-details').toggle(); 60 e.stopImmediatePropagation(); 61 }); 62 63 $(document).on( 'keydown', function(e) { 64 let keycode = ( e.keyCode ? e.keyCode : e.which ); 65 if ( keycode == 27 ) { 66 $( '.mc-main ').removeClass( 'grid-open' ); 67 $( '.calendar-event div.single-details' ).hide(); 68 } 69 }); 70 71 $(document).on( 72 'keydown', '.mc-event a, .mc-event object, .mc-event :input, .mc-event iframe, .mc-event [tabindex]', 73 function(e) { 74 let keycode = ( e.keyCode ? e.keyCode : e.which ); 75 let action = $( ':focus' ).attr( 'data-action' ); 76 if ( ( !e.shiftKey && keycode == 9 ) && action == 'shiftback' ) { 77 e.preventDefault(); 78 $( '[data-action=shiftforward]' ).trigger( 'focus' ); 79 } 80 if ( ( e.shiftKey && keycode == 9 ) && action == 'shiftforward' ) { 81 e.preventDefault(); 82 $( '[data-action=shiftback]' ).trigger( 'focus' ); 83 } 84 } 85 ); 86 } 87}(jQuery));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.