mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-13 22:26:06 +01:00
bde558be2f
These annotations make it clear to the reader of a JavaScript source where the build process outputs to. These annotations can later be integrated in a webpack configuration. This way there is one source of truth. The `build` folder is omitted from the paths, because a single JS file shouldn't not be responsible of knowing where outputs in general will end up at. A file only knows its output location relative to the project. Props adamsilverstein, herregroen, omarreiss, pento. Fixes #44361. Built from https://develop.svn.wordpress.org/trunk@43347 git-svn-id: http://core.svn.wordpress.org/trunk@43175 1a063a9b-81f0-0310-95a4-ce76da25c4cd
42 lines
1.2 KiB
JavaScript
42 lines
1.2 KiB
JavaScript
/**
|
|
* This file is used on media-upload.php which has been replaced by media-new.php and upload.php
|
|
*
|
|
* @deprecated 3.5.0
|
|
* @output wp-admin/js/media-gallery.js
|
|
*/
|
|
|
|
/* global ajaxurl */
|
|
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() {
|
|
var win = window.dialogArguments || opener || parent || top;
|
|
win.tb_remove();
|
|
win.location.reload();
|
|
});
|
|
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
});
|