web/wp-admin/js/media-gallery.js
changeset 204 09a1c134465b
parent 194 32102edaa81b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
     1 jQuery(function(a){a("body").bind("click.wp-gallery",function(d){var c=a(d.target),f,b;if(c.hasClass("wp-set-header")){(window.dialogArguments||opener||parent||top).location.href=c.data("location");d.preventDefault()}else{if(c.hasClass("wp-set-background")){f=c.data("attachment-id");b=a('input[name="attachments['+f+'][image-size]"]:checked').val();jQuery.post(ajaxurl,{action:"set-background-image",attachment_id:f,size:b},function(){var e=window.dialogArguments||opener||parent||top;e.tb_remove();e.location.reload()});d.preventDefault()}}})});
     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 });