Changeset 1329
- Timestamp:
- 02/25/2015 09:08:03 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/js/search.js
r1326 r1329 24 24 }); 25 25 26 // Register keypress events for shortcuts. 27 $( 'body' ).keypress( function(e) { 28 29 var keypress = String.fromCharCode( e.which ).toLowerCase(); 30 31 switch ( keypress ) { 32 case 's': // Toggle display of search bar (unless currently focused on editable form element) 33 if ( e.target.nodeName == 'INPUT' || e.target.nodeName == 'TEXTAREA' || e.target.isContentEditable ) { 34 return; 35 } 36 37 e.preventDefault(); 38 toggle_search_bar(); 39 break; 40 } 41 42 }); 43 44 // Register keydown event for search bar so 'escape' hides search bar. 45 $( '#inner-search .search-section' ).keydown( function(e) { 46 if ( 27 == e.which ) { 47 toggle_search_bar(); 48 } 49 }); 50 26 51 } )( jQuery );
Note: See TracChangeset
for help on using the changeset viewer.