mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-16 23:55:12 +01:00
ef007d1a40
props tommcfarlin. fixes #25942, #25943, #25944. Built from https://develop.svn.wordpress.org/trunk@26232 git-svn-id: http://core.svn.wordpress.org/trunk@26139 1a063a9b-81f0-0310-95a4-ce76da25c4cd
27 lines
769 B
JavaScript
27 lines
769 B
JavaScript
/* global ajaxurl */
|
|
jQuery(function($){
|
|
$( 'body' ).bind( 'click.wp-gallery', function(e){
|
|
var target = $( e.target ), id, img_size;
|
|
|
|
if ( target.hasClass( 'wp-set-header' ) ) {
|
|
( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
|
|
e.preventDefault();
|
|
} else if ( target.hasClass( 'wp-set-background' ) ) {
|
|
id = target.data( 'attachment-id' );
|
|
img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
|
|
|
|
jQuery.post(ajaxurl, {
|
|
action: 'set-background-image',
|
|
attachment_id: id,
|
|
size: img_size
|
|
}, function(){
|
|
var win = window.dialogArguments || opener || parent || top;
|
|
win.tb_remove();
|
|
win.location.reload();
|
|
});
|
|
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|