Changeset 25547
- Timestamp:
- 09/21/2013 11:23:32 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/js/image-edit.js
r22807 r25547 159 159 }; 160 160 161 img = $('<img id="image-preview-' + postid + '" />'); 162 img.load( function() { 163 var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit; 164 165 parent.empty().append(img); 166 167 // w, h are the new full size dims 168 max1 = Math.max( t.hold.w, t.hold.h ); 169 max2 = Math.max( $(img).width(), $(img).height() ); 170 t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1; 171 172 t.initCrop(postid, img, parent); 173 t.setCropSelection(postid, 0); 174 175 if ( (typeof callback != "unknown") && callback != null ) 176 callback(); 177 178 if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 ) 179 $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); 180 else 181 $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); 182 183 t.toggleEditor(postid, 0); 184 }).error(function(){ 185 $('#imgedit-crop-' + postid).empty().append('<div class="error"><p>' + imageEditL10n.error + '</p></div>'); 186 t.toggleEditor(postid, 0); 187 }).attr('src', ajaxurl + '?' + $.param(data)); 161 img = $('<img id="image-preview-' + postid + '" />') 162 .on('load', function() { 163 var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit; 164 165 parent.empty().append(img); 166 167 // w, h are the new full size dims 168 max1 = Math.max( t.hold.w, t.hold.h ); 169 max2 = Math.max( $(img).width(), $(img).height() ); 170 t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1; 171 172 t.initCrop(postid, img, parent); 173 t.setCropSelection(postid, 0); 174 175 if ( (typeof callback != "unknown") && callback != null ) 176 callback(); 177 178 if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 ) 179 $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); 180 else 181 $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); 182 183 t.toggleEditor(postid, 0); 184 }) 185 .on('error', function() { 186 $('#imgedit-crop-' + postid).empty().append('<div class="error"><p>' + imageEditL10n.error + '</p></div>'); 187 t.toggleEditor(postid, 0); 188 }) 189 .attr('src', ajaxurl + '?' + $.param(data)); 188 190 }, 189 191
Note: See TracChangeset
for help on using the changeset viewer.