( function( $ ) { var body = $( 'body' ), _window = $( window ); // Enable menu toggle for small screens as well as //bigger screens (should the relevant option have been selected in the customizer) ( function() { var nav = $( '#primary-navigation' ), button, menu; if ( ! nav ) { return; } button = nav.find( '.menu-toggle' ); if ( ! button ) { return; } // Hide button if menu is missing or empty. menu = nav.find( '.nav-menu' ); if ( ! menu || ! menu.children().length ) { button.hide(); return; } $( '.menu-toggle' ).on( 'click.amiable', function() { nav.toggleClass( 'toggled-on' ); } ); } )(); // The ideas for the rest of these functions comes from the Universal WordPress theme developed // by Joe Dolson (http://themes.joedolson.com/universal/) // remove target attribute e.g. target="_blank", from links // Should you really have to open links in new tabs automatically (for some or other strange reason) //you will need to comment out the line below $('a').removeAttr('target'); // Title attributes on links serve no purpose if they are the same as the actual link test, // come to think about it, they never serve a purpose. // Should a title be added to a link (why I do not know) and the title is the same as the link text // this lttle function will remove the title $('*').each( function () { var self = $(this); var theTitle = $.trim( self.attr( 'title' ) ); var theText = $.trim( self.text() ); if ( theTitle === theText ) { self.removeAttr( 'title' ); } } ); } )( jQuery );