1 /* global ajaxurl */ |
1 /* global ajaxurl */ |
2 jQuery(function($){ |
2 |
3 $( 'body' ).bind( 'click.wp-gallery', function(e){ |
3 /** |
|
4 * This file is used on media-upload.php which has been replaced by media-new.php and upload.php |
|
5 * Deprecated since 3.5.0 |
|
6 */ |
|
7 jQuery(function($) { |
|
8 /** |
|
9 * Adds a click event handler to the element with a 'wp-gallery' class. |
|
10 */ |
|
11 $( 'body' ).bind( 'click.wp-gallery', function(e) { |
4 var target = $( e.target ), id, img_size; |
12 var target = $( e.target ), id, img_size; |
5 |
13 |
6 if ( target.hasClass( 'wp-set-header' ) ) { |
14 if ( target.hasClass( 'wp-set-header' ) ) { |
|
15 // Opens the image to preview it full size. |
7 ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); |
16 ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); |
8 e.preventDefault(); |
17 e.preventDefault(); |
9 } else if ( target.hasClass( 'wp-set-background' ) ) { |
18 } else if ( target.hasClass( 'wp-set-background' ) ) { |
|
19 // Sets the image as background of the theme. |
10 id = target.data( 'attachment-id' ); |
20 id = target.data( 'attachment-id' ); |
11 img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); |
21 img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); |
12 |
22 |
|
23 /** |
|
24 * This AJAX action has been deprecated since 3.5.0, see custom-background.php |
|
25 */ |
13 jQuery.post(ajaxurl, { |
26 jQuery.post(ajaxurl, { |
14 action: 'set-background-image', |
27 action: 'set-background-image', |
15 attachment_id: id, |
28 attachment_id: id, |
16 size: img_size |
29 size: img_size |
17 }, function(){ |
30 }, function() { |
18 var win = window.dialogArguments || opener || parent || top; |
31 var win = window.dialogArguments || opener || parent || top; |
19 win.tb_remove(); |
32 win.tb_remove(); |
20 win.location.reload(); |
33 win.location.reload(); |
21 }); |
34 }); |
22 |
35 |