]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/js/media-gallery.js
WordPress 3.6.1
[autoinstalls/wordpress.git] / wp-admin / js / media-gallery.js
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 });