awsmug/torro-forms

View on GitHub
assets/src/js/admin-form-builder/metabox-tabs.js

Summary

Maintainability
C
1 day
Test Coverage
( function( $ ) {
    'use strict';

    $( '.torro-metabox-tab' ).on( 'click', function( e ) {
        var $this = $( this );
        var $all  = $this.parent().children( '.torro-metabox-tab' );

        e.preventDefault();

        if ( 'true' === $this.attr( 'aria-selected' ) ) {
            return;
        }

        $all.each( function() {
            $( this ).attr( 'aria-selected', 'false' );
            $( $( this ).attr( 'href' ) ).attr( 'aria-hidden', 'true' );
        });

        $this.attr( 'aria-selected', 'true' );
        $( $this.attr( 'href' ) ).attr( 'aria-hidden', 'false' ).find( '.plugin-lib-map-control' ).each( function() {
            $( this ).wpMapPicker( 'refresh' );
        });
    });

})( window.jQuery );