]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/image-edit.js
WordPress 4.0
[autoinstalls/wordpress.git] / wp-admin / js / image-edit.js
index 0a592d901e56a7d2e102359f4f6319a5b792ac34..7bf292880bc8ccb772dab4ac89330ab23dfebc0b 100644 (file)
@@ -274,7 +274,7 @@ var imageEdit = window.imageEdit = {
                        var ret = JSON.parse(r);
 
                        if ( ret.error ) {
-                               $('#imgedit-response-' + postid).html('<div class="error"><p>' + ret.error + '</p><div>');
+                               $('#imgedit-response-' + postid).html('<div class="error"><p>' + ret.error + '</p></div>');
                                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) );