web/wp-admin/js/media-gallery.dev.js
changeset 204 09a1c134465b
parent 203 f507feede89a
child 205 a4f7897e21a9
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     1 jQuery(function($){
       
     2 	$( 'body' ).bind( 'click.wp-gallery', function(e){
       
     3 		var target = $( e.target ), id, img_size;
       
     4 
       
     5 		if ( target.hasClass( 'wp-set-header' ) ) {
       
     6 			( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
       
     7 			e.preventDefault();
       
     8 		} else if ( target.hasClass( 'wp-set-background' ) ) {
       
     9 			id = target.data( 'attachment-id' );
       
    10 			img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
       
    11 
       
    12 			jQuery.post(ajaxurl, {
       
    13 				action: 'set-background-image',
       
    14 				attachment_id: id,
       
    15 				size: img_size
       
    16 			}, function(){
       
    17 				var win = window.dialogArguments || opener || parent || top;
       
    18 				win.tb_remove();
       
    19 				win.location.reload();
       
    20 			});
       
    21 
       
    22 			e.preventDefault();
       
    23 		}
       
    24 	});
       
    25 });