wp/wp-admin/js/media-gallery.js
changeset 0 d970ebf37754
child 5 5e2f62d02dcd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wp/wp-admin/js/media-gallery.js	Wed Nov 06 03:21:17 2013 +0000
@@ -0,0 +1,25 @@
+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();
+		}
+	});
+});