CoreFiles by mySites.guru
media-gallery.js26 lines, 769 bytes, from wordpress-4.2.21.zip
Raw History Compare with 4.2.20
md5
7cf21db8661f9201a784f638f77d2b26
sha1
98b8e0d7a81acf2e36d0f210eea7df4d3efbacc8
sha256
240fdbc998aa52c8b8b31210f30e280644929f4bb21baa0436546dd8617952d6
/* 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();
		}
	});
});

The same content is in 313 releases, WordPress 3.8-beta-1 to 4.6.19. See them all, or every version of this file.