From b3c66e7bd024e426023d881b21600fc234846ed5 Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Sat, 21 Sep 2013 11:23:32 +0000 Subject: [PATCH] Image Edit: Replace deprecated $.load() and $.error() methods to prevent warnings by jQuery Migrate, fixes #25371. git-svn-id: https://develop.svn.wordpress.org/trunk@25547 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/image-edit.js | 44 ++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/wp-admin/js/image-edit.js b/src/wp-admin/js/image-edit.js index b11e2d3ab0..88eb2922e3 100644 --- a/src/wp-admin/js/image-edit.js +++ b/src/wp-admin/js/image-edit.js @@ -158,33 +158,35 @@ imageEdit = { 'rand': t.intval(Math.random() * 1000000) }; - img = $(''); - img.load( function() { - var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit; + img = $('') + .on('load', function() { + var max1, max2, parent = $('#imgedit-crop-' + postid), t = imageEdit; - parent.empty().append(img); + parent.empty().append(img); - // w, h are the new full size dims - max1 = Math.max( t.hold.w, t.hold.h ); - max2 = Math.max( $(img).width(), $(img).height() ); - t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1; + // w, h are the new full size dims + max1 = Math.max( t.hold.w, t.hold.h ); + max2 = Math.max( $(img).width(), $(img).height() ); + t.hold['sizer'] = max1 > max2 ? max2 / max1 : 1; - t.initCrop(postid, img, parent); - t.setCropSelection(postid, 0); + t.initCrop(postid, img, parent); + t.setCropSelection(postid, 0); - if ( (typeof callback != "unknown") && callback != null ) - callback(); + if ( (typeof callback != "unknown") && callback != null ) + callback(); - if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 ) - $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); - else - $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); + if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 ) + $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); + else + $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); - t.toggleEditor(postid, 0); - }).error(function(){ - $('#imgedit-crop-' + postid).empty().append('

' + imageEditL10n.error + '

'); - t.toggleEditor(postid, 0); - }).attr('src', ajaxurl + '?' + $.param(data)); + t.toggleEditor(postid, 0); + }) + .on('error', function() { + $('#imgedit-crop-' + postid).empty().append('

' + imageEditL10n.error + '

'); + t.toggleEditor(postid, 0); + }) + .attr('src', ajaxurl + '?' + $.param(data)); }, action : function(postid, nonce, action) {