2 * Vector-specific scripts
4 jQuery( function ( $ ) {
5 $( 'div.vectorMenu' ).each( function () {
7 $el.find( '> h3 > a' ).parent()
8 .attr( 'tabindex', '0' )
9 // For accessibility, show the menu when the h3 is clicked (bug 24298/46486)
10 .on( 'click keypress', function ( e ) {
11 if( e.type === 'click' || e.which === 13 ) {
12 $el.find( '.menu:first' ).toggleClass( 'menuForceShow' );
16 // When the heading has focus, also set a class that will change the arrow icon
18 $el.find( '> a' ).addClass( 'vectorMenuFocus' );
21 $el.find( '> a' ).removeClass( 'vectorMenuFocus' );
24 // As the h3 can already be focused there's no need for the link to be focusable
25 .attr( 'tabindex', '-1' );
29 * Collapsible tabs for Vector
31 var $cactions = $( '#p-cactions' );
33 // Bind callback functions to animate our drop down menu in and out
34 // and then call the collapsibleTabs function on the menu
36 .bind( 'beforeTabCollapse', function () {
37 // If the dropdown was hidden, show it
38 if ( $cactions.hasClass( 'emptyPortlet' ) ) {
40 .removeClass( 'emptyPortlet' )
42 .css( 'width', '1px' ).animate( { 'width': '24px' }, 390 );
45 .bind( 'beforeTabExpand', function () {
46 // If we're removing the last child node right now, hide the dropdown
47 if ( $cactions.find( 'li' ).length === 1 ) {
48 $cactions.find( 'h3' ).animate( { 'width': '1px' }, 390, function () {
49 $( this ).attr( 'style', '' )
50 .parent().addClass( 'emptyPortlet' );