[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/js/ -> set-post-thumbnail.js (source)

   1  /**
   2   * @output wp-admin/js/set-post-thumbnail.js
   3   */
   4  
   5  /* global setPostThumbnailL10n, ajaxurl, post_id, alert */
   6  /* exported WPSetAsThumbnail */
   7  
   8  window.WPSetAsThumbnail = function( id, nonce ) {
   9      var $link = jQuery('a#wp-post-thumbnail-' + id);
  10  
  11      $link.text( setPostThumbnailL10n.saving );
  12      jQuery.post(ajaxurl, {
  13          action: 'set-post-thumbnail', post_id: post_id, thumbnail_id: id, _ajax_nonce: nonce, cookie: encodeURIComponent( document.cookie )
  14      }, function(str){
  15          var win = window.dialogArguments || opener || parent || top;
  16          $link.text( setPostThumbnailL10n.setThumbnail );
  17          if ( str == '0' ) {
  18              alert( setPostThumbnailL10n.error );
  19          } else {
  20              jQuery('a.wp-post-thumbnail').show();
  21              $link.text( setPostThumbnailL10n.done );
  22              $link.fadeOut( 2000 );
  23              win.WPSetThumbnailID(id);
  24              win.WPSetThumbnailHTML(str);
  25          }
  26      }
  27      );
  28  };


Generated: Tue Jul 23 01:00:03 2019 Cross-referenced by PHPXref 0.7.1