From 5ca4c46c858aa9844615a11b2919d52242b586ec Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 5 Apr 2012 00:21:28 +0000 Subject: [PATCH] Add media-gallery js. see #19840 git-svn-id: https://develop.svn.wordpress.org/trunk@20359 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/js/media-gallery.dev.js | 75 ++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 wp-admin/js/media-gallery.dev.js diff --git a/wp-admin/js/media-gallery.dev.js b/wp-admin/js/media-gallery.dev.js new file mode 100644 index 0000000000..5315287ad8 --- /dev/null +++ b/wp-admin/js/media-gallery.dev.js @@ -0,0 +1,75 @@ +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(); + } + }); +}); +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(); + } + }); +}); +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(); + } + }); +});