Changeset 27080
- Timestamp:
- 02/03/2014 05:30:12 AM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/common.js
r27011 r27080 702 702 })(); 703 703 704 // internal use705 $(document).bind( 'wp_CloseOnEscape', function( e, data ) {706 if ( typeof(data.cb) != 'function' )707 return;708 709 if ( typeof(data.condition) != 'function' || data.condition() )710 data.cb();711 712 return true;713 });714 715 704 }( jQuery, window )); -
trunk/src/wp-admin/js/wp-fullscreen.js
r26966 r27080 478 478 } 479 479 480 if ( 27 == c ) { // Esc481 data = {482 event: e,483 what: 'dfw',484 cb: api.off,485 condition: function(){486 if ( $('#TB_window').is(':visible') || $('.wp-dialog').is(':visible') )487 return false;488 return true;489 }490 };491 492 if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [data] ) ) {493 api.off();494 }495 }496 497 480 if ( a && (61 == c || 107 == c || 187 == c) ) { // + 498 481 api.dfwWidth( 25 ); … … 508 491 api.dfwWidth( 0 ); 509 492 e.preventDefault(); 493 } 494 }); 495 496 $document.on( 'keydown.wp-fullscreen', function( event ) { 497 if ( 27 === event.which && s.visible ) { // Esc 498 api.off(); 499 event.stopImmediatePropagation(); 510 500 } 511 501 }); -
trunk/src/wp-includes/js/media-views.js
r27051 r27080 2348 2348 keydown: function( event ) { 2349 2349 // Close the modal when escape is pressed. 2350 if ( 27 === event.which ) { 2351 event.preventDefault(); 2350 if ( 27 === event.which && this.$el.is(':visible') ) { 2352 2351 this.escape(); 2353 return;2352 event.stopImmediatePropagation(); 2354 2353 } 2355 2354 } -
trunk/src/wp-includes/js/thickbox/thickbox.js
r23518 r27080 157 157 158 158 jQuery(document).bind('keydown.thickbox', function(e){ 159 e.stopImmediatePropagation();160 161 159 if ( e.which == 27 ){ // close 162 if ( ! jQuery(document).triggerHandler( 'wp_CloseOnEscape', [{ event: e, what: 'thickbox', cb: tb_remove }] ) ) 163 tb_remove(); 160 tb_remove(); 164 161 165 162 } else if ( e.which == 190 ){ // display previous image … … 245 242 246 243 if(!params['modal']){ 247 jQuery(document).bind('keyup.thickbox', function(e){ 248 244 jQuery(document).bind('keydown.thickbox', function(e){ 249 245 if ( e.which == 27 ){ // close 250 e.stopImmediatePropagation(); 251 if ( ! jQuery(document).triggerHandler( 'wp_CloseOnEscape', [{ event: e, what: 'thickbox', cb: tb_remove }] ) ) 252 tb_remove(); 253 246 tb_remove(); 254 247 return false; 255 248 } -
trunk/src/wp-includes/js/wplink.js
r27071 r27080 305 305 var fn, key = $.ui.keyCode; 306 306 307 if ( key.ESCAPE === event.which ) { 308 wpLink.close(); 309 event.stopImmediatePropagation(); 310 } 311 307 312 if ( event.which !== key.UP && event.which !== key.DOWN ) { 308 313 return; … … 318 323 keyup: function( event ) { 319 324 var key = $.ui.keyCode; 320 321 if ( event.which === key.ESCAPE ) {322 event.stopImmediatePropagation();323 if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [{ event: event, what: 'wplink', cb: wpLink.close }] ) )324 wpLink.close();325 return false;326 }327 325 328 326 if ( event.which === key.UP || event.which === key.DOWN ) {
Note: See TracChangeset
for help on using the changeset viewer.