WordPress.org

Make WordPress Core

Changeset 38293


Ignore:
Timestamp:
08/20/2016 10:58:34 PM (3 years ago)
Author:
wonderboymusic
Message:

Media: Add some docs to media-gallery.js RIP.

Props jipmoors.
Fixes #37717.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/media-gallery.js

    r26232 r38293  
    11/* global ajaxurl */
    2 jQuery(function($){
    3     $( 'body' ).bind( 'click.wp-gallery', function(e){
     2
     3/**
     4 * This file is used on media-upload.php which has been replaced by media-new.php and upload.php
     5 * Deprecated since 3.5.0
     6 */
     7jQuery(function($) {
     8    /**
     9     * Adds a click event handler to the element with a 'wp-gallery' class.
     10     */
     11    $( 'body' ).bind( 'click.wp-gallery', function(e) {
    412        var target = $( e.target ), id, img_size;
    513
    614        if ( target.hasClass( 'wp-set-header' ) ) {
     15            // Opens the image to preview it full size.
    716            ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
    817            e.preventDefault();
    918        } else if ( target.hasClass( 'wp-set-background' ) ) {
     19            // Sets the image as background of the theme.
    1020            id = target.data( 'attachment-id' );
    1121            img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
    1222
     23            /**
     24             * This AJAX action has been deprecated since 3.5.0, see custom-background.php
     25             */
    1326            jQuery.post(ajaxurl, {
    1427                action: 'set-background-image',
    1528                attachment_id: id,
    1629                size: img_size
    17             }, function(){
     30            }, function() {
    1831                var win = window.dialogArguments || opener || parent || top;
    1932                win.tb_remove();
Note: See TracChangeset for help on using the changeset viewer.