web/wp-admin/js/image-edit.dev.js
changeset 194 32102edaa81b
parent 136 bde1974c263b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    14 		if ( s ) {
    14 		if ( s ) {
    15 			el.removeClass('disabled');
    15 			el.removeClass('disabled');
    16 			$('input', el).removeAttr('disabled');
    16 			$('input', el).removeAttr('disabled');
    17 		} else {
    17 		} else {
    18 			el.addClass('disabled');
    18 			el.addClass('disabled');
    19 			$('input', el).attr('disabled', 'disabled');
    19 			$('input', el).prop('disabled', true);
    20 		}
    20 		}
    21 	},
    21 	},
    22 
    22 
    23 	init : function(postid, nonce) {
    23 	init : function(postid, nonce) {
    24 		var t = this, old = $('#image-editor-' + t.postid),
    24 		var t = this, old = $('#image-editor-' + t.postid),
    62 		$(el).siblings('.imgedit-help').slideToggle('fast');
    62 		$(el).siblings('.imgedit-help').slideToggle('fast');
    63 		return false;
    63 		return false;
    64 	},
    64 	},
    65 
    65 
    66 	getTarget : function(postid) {
    66 	getTarget : function(postid) {
    67 		return $('input[name=imgedit-target-' + postid + ']:checked', '#imgedit-save-target-' + postid).val() || 'full';
    67 		return $('input[name="imgedit-target-' + postid + '"]:checked', '#imgedit-save-target-' + postid).val() || 'full';
    68 	},
    68 	},
    69 
    69 
    70 	scaleChanged : function(postid, x) {
    70 	scaleChanged : function(postid, x) {
    71 		var w = $('#imgedit-scale-width-' + postid), h = $('#imgedit-scale-height-' + postid),
    71 		var w = $('#imgedit-scale-width-' + postid), h = $('#imgedit-scale-height-' + postid),
    72 		warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '';
    72 		warn = $('#imgedit-scale-warn-' + postid), w1 = '', h1 = '';
   176 				callback();
   176 				callback();
   177 
   177 
   178 			if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 )
   178 			if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() == 0 )
   179 				$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled');
   179 				$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled');
   180 			else
   180 			else
   181 				$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).attr('disabled', 'disabled');
   181 				$('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true);
   182 
   182 
       
   183 			t.toggleEditor(postid, 0);
       
   184 		}).error(function(){
       
   185 			$('#imgedit-crop-' + postid).empty().append('<div class="error"><p>' + imageEditL10n.error + '</p></div>');
   183 			t.toggleEditor(postid, 0);
   186 			t.toggleEditor(postid, 0);
   184 		}).attr('src', ajaxurl + '?' + $.param(data));
   187 		}).attr('src', ajaxurl + '?' + $.param(data));
   185 	},
   188 	},
   186 
   189 
   187 	action : function(postid, nonce, action) {
   190 	action : function(postid, nonce, action) {
   202 			fw = t.intval(w.val()),
   205 			fw = t.intval(w.val()),
   203 			fh = t.intval(h.val());
   206 			fh = t.intval(h.val());
   204 
   207 
   205 			if ( fw < 1 ) {
   208 			if ( fw < 1 ) {
   206 				w.focus();
   209 				w.focus();
   207 				return false;;
   210 				return false;
   208 			} else if ( fh < 1 ) {
   211 			} else if ( fh < 1 ) {
   209 				h.focus();
   212 				h.focus();
   210 				return false;;
   213 				return false;
   211 			}
   214 			}
   212 
   215 
   213 			if ( fw == t.hold.ow || fh == t.hold.oh )
   216 			if ( fw == t.hold.ow || fh == t.hold.oh )
   214 				return false;
   217 				return false;
   215 
   218 
   269 
   272 
   270 	open : function(postid, nonce) {
   273 	open : function(postid, nonce) {
   271 		var data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid),
   274 		var data, elem = $('#image-editor-' + postid), head = $('#media-head-' + postid),
   272 			btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('img');
   275 			btn = $('#imgedit-open-btn-' + postid), spin = btn.siblings('img');
   273 
   276 
   274 		btn.attr('disabled', 'disabled');
   277 		btn.prop('disabled', true);
   275 		spin.css('visibility', 'visible');
   278 		spin.css('visibility', 'visible');
   276 
   279 
   277 		data = {
   280 		data = {
   278 			'action': 'image-editor',
   281 			'action': 'image-editor',
   279 			'_ajax_nonce': nonce,
   282 			'_ajax_nonce': nonce,