X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/0461a5f2e55c8d5f1fde96ca2e83117152573c7d..refs/tags/wordpress-4.0:/wp-admin/js/image-edit.js diff --git a/wp-admin/js/image-edit.js b/wp-admin/js/image-edit.js index 0a592d90..7bf29288 100644 --- a/wp-admin/js/image-edit.js +++ b/wp-admin/js/image-edit.js @@ -274,7 +274,7 @@ var imageEdit = window.imageEdit = { var ret = JSON.parse(r); if ( ret.error ) { - $('#imgedit-response-' + postid).html('

' + ret.error + '

'); + $('#imgedit-response-' + postid).html('

' + ret.error + '

'); imageEdit.close(postid); return; } @@ -302,7 +302,7 @@ var imageEdit = window.imageEdit = { open : function( postid, nonce, view ) { this._view = view; - var data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid), + var dfd, data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid), btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('.spinner'); btn.prop('disabled', true); @@ -315,13 +315,20 @@ var imageEdit = window.imageEdit = { 'do': 'open' }; - elem.load(ajaxurl, data, function() { - elem.fadeIn('fast'); + dfd = $.ajax({ + url: ajaxurl, + type: 'post', + data: data + }).done(function( html ) { + elem.html( html ); head.fadeOut('fast', function(){ + elem.fadeIn('fast'); btn.removeAttr('disabled'); spin.hide(); }); }); + + return dfd; }, imgLoaded : function(postid) { @@ -385,10 +392,9 @@ var imageEdit = window.imageEdit = { }, setCropSelection : function(postid, c) { - var sel, min = $('#imgedit-minthumb-' + postid).val() || '128:128', - sizer = this.hold.sizer; - min = min.split(':'); - c = c || 0; + var sel; + + c = c || 0; if ( !c || ( c.width < 3 && c.height < 3 ) ) { this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0); @@ -399,12 +405,6 @@ var imageEdit = window.imageEdit = { return false; } - if ( c.width < (min[0] * sizer) && c.height < (min[1] * sizer) ) { - this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 0); - $('#imgedit-selection-' + postid).val(''); - return false; - } - sel = { 'x': c.x1, 'y': c.y1, 'w': c.width, 'h': c.height }; this.setDisabled($('.imgedit-crop', '#imgedit-panel-' + postid), 1); $('#imgedit-selection-' + postid).val( JSON.stringify(sel) );