From d73964aab61b08e8f8c82b9091c9a83080ad3af6 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Sat, 20 Aug 2016 22:59:29 +0000 Subject: [PATCH] Media: Add some docs to `media-gallery.js` RIP. Props jipmoors. Fixes #37717. Built from https://develop.svn.wordpress.org/trunk@38293 git-svn-id: http://core.svn.wordpress.org/trunk@38234 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/media-gallery.js | 19 ++++++++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/wp-admin/js/media-gallery.js b/wp-admin/js/media-gallery.js index 52da393dcc..a71d8fe17f 100644 --- a/wp-admin/js/media-gallery.js +++ b/wp-admin/js/media-gallery.js @@ -1,20 +1,33 @@ /* global ajaxurl */ -jQuery(function($){ - $( 'body' ).bind( 'click.wp-gallery', function(e){ + +/** + * This file is used on media-upload.php which has been replaced by media-new.php and upload.php + * Deprecated since 3.5.0 + */ +jQuery(function($) { + /** + * Adds a click event handler to the element with a 'wp-gallery' class. + */ + $( 'body' ).bind( 'click.wp-gallery', function(e) { var target = $( e.target ), id, img_size; if ( target.hasClass( 'wp-set-header' ) ) { + // Opens the image to preview it full size. ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' ); e.preventDefault(); } else if ( target.hasClass( 'wp-set-background' ) ) { + // Sets the image as background of the theme. id = target.data( 'attachment-id' ); img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val(); + /** + * This AJAX action has been deprecated since 3.5.0, see custom-background.php + */ jQuery.post(ajaxurl, { action: 'set-background-image', attachment_id: id, size: img_size - }, function(){ + }, function() { var win = window.dialogArguments || opener || parent || top; win.tb_remove(); win.location.reload(); diff --git a/wp-includes/version.php b/wp-includes/version.php index 2bc559d81c..aa702ec7da 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-alpha-38292'; +$wp_version = '4.7-alpha-38293'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.