Media: Add some docs to media-gallery.js
RIP.
Props jipmoors. Fixes #37717. git-svn-id: https://develop.svn.wordpress.org/trunk@38293 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
29a5d46701
commit
a26f7f7d28
@ -1,20 +1,33 @@
|
|||||||
/* global ajaxurl */
|
/* 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;
|
var target = $( e.target ), id, img_size;
|
||||||
|
|
||||||
if ( target.hasClass( 'wp-set-header' ) ) {
|
if ( target.hasClass( 'wp-set-header' ) ) {
|
||||||
|
// Opens the image to preview it full size.
|
||||||
( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
|
( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if ( target.hasClass( 'wp-set-background' ) ) {
|
} else if ( target.hasClass( 'wp-set-background' ) ) {
|
||||||
|
// Sets the image as background of the theme.
|
||||||
id = target.data( 'attachment-id' );
|
id = target.data( 'attachment-id' );
|
||||||
img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
|
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, {
|
jQuery.post(ajaxurl, {
|
||||||
action: 'set-background-image',
|
action: 'set-background-image',
|
||||||
attachment_id: id,
|
attachment_id: id,
|
||||||
size: img_size
|
size: img_size
|
||||||
}, function(){
|
}, function() {
|
||||||
var win = window.dialogArguments || opener || parent || top;
|
var win = window.dialogArguments || opener || parent || top;
|
||||||
win.tb_remove();
|
win.tb_remove();
|
||||||
win.location.reload();
|
win.location.reload();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user