Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 
 

40 строки
1.2 KiB

  1. /* global ajaxurl */
  2. /**
  3. * This file is used on media-upload.php which has been replaced by media-new.php and upload.php
  4. * Deprecated since 3.5.0
  5. */
  6. jQuery(function($) {
  7. /**
  8. * Adds a click event handler to the element with a 'wp-gallery' class.
  9. */
  10. $( 'body' ).bind( 'click.wp-gallery', function(e) {
  11. var target = $( e.target ), id, img_size;
  12. if ( target.hasClass( 'wp-set-header' ) ) {
  13. // Opens the image to preview it full size.
  14. ( window.dialogArguments || opener || parent || top ).location.href = target.data( 'location' );
  15. e.preventDefault();
  16. } else if ( target.hasClass( 'wp-set-background' ) ) {
  17. // Sets the image as background of the theme.
  18. id = target.data( 'attachment-id' );
  19. img_size = $( 'input[name="attachments[' + id + '][image-size]"]:checked').val();
  20. /**
  21. * This AJAX action has been deprecated since 3.5.0, see custom-background.php
  22. */
  23. jQuery.post(ajaxurl, {
  24. action: 'set-background-image',
  25. attachment_id: id,
  26. size: img_size
  27. }, function() {
  28. var win = window.dialogArguments || opener || parent || top;
  29. win.tb_remove();
  30. win.location.reload();
  31. });
  32. e.preventDefault();
  33. }
  34. });
  35. });