Make WordPress Core

Changeset 20369


Ignore:
Timestamp:
04/05/2012 11:14:32 AM (12 years ago)
Author:
duck_
Message:

Remove duplicate JavaScript. Props aaroncampbell. See #19840, fixes #20363.

File:
1 edited

Legend:

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

    r20359 r20369  
    2424    });
    2525});
    26 jQuery(function($){
    27     $( 'body' ).bind( 'click.wp-gallery', function(e){
    28         var target = $( e.target ), id, img_size;
    29 
    30         if ( target.hasClass( 'wp-set-header' ) ) {
    31             ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
    32             e.preventDefault();
    33         } else if ( target.hasClass( 'wp-set-background' ) ) {
    34             id = target.data( 'attachment-id' );
    35             img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
    36 
    37             jQuery.post(ajaxurl, {
    38                 action: 'set-background-image',
    39                 attachment_id: id,
    40                 size: img_size
    41             }, function(){
    42                 var win = window.dialogArguments || opener || parent || top;
    43                 win.tb_remove();
    44                 win.location.reload();
    45             });
    46 
    47             e.preventDefault();
    48         }
    49     });
    50 });
    51 jQuery(function($){
    52     $( 'body' ).bind( 'click.wp-gallery', function(e){
    53         var target = $( e.target ), id, img_size;
    54 
    55         if ( target.hasClass( 'wp-set-header' ) ) {
    56             ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
    57             e.preventDefault();
    58         } else if ( target.hasClass( 'wp-set-background' ) ) {
    59             id = target.data( 'attachment-id' );
    60             img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
    61 
    62             jQuery.post(ajaxurl, {
    63                 action: 'set-background-image',
    64                 attachment_id: id,
    65                 size: img_size
    66             }, function(){
    67                 var win = window.dialogArguments || opener || parent || top;
    68                 win.tb_remove();
    69                 win.location.reload();
    70             });
    71 
    72             e.preventDefault();
    73         }
    74     });
    75 });
Note: See TracChangeset for help on using the changeset viewer.