diff --git a/src/js/_enqueues/lib/image-edit.js b/src/js/_enqueues/lib/image-edit.js index adcc2a3803..6d9f3e09a5 100644 --- a/src/js/_enqueues/lib/image-edit.js +++ b/src/js/_enqueues/lib/image-edit.js @@ -122,7 +122,7 @@ t.postid = postid; $('#imgedit-response-' + postid).empty(); - $('input[type="text"]', '#imgedit-panel-' + postid).keypress(function(e) { + $('#imgedit-panel-' + postid).on( 'keypress', 'input[type="text"]', function(e) { var k = e.keyCode; // Key codes 37 through 40 are the arrow keys. @@ -384,7 +384,7 @@ */ t.setDisabled( $( '#image-undo-' + postid) , true ); // Move focus to the undo button to avoid a focus loss. - $( '#image-undo-' + postid ).focus(); + $( '#image-undo-' + postid ).trigger( 'focus' ); } } @@ -402,7 +402,7 @@ } if ( $('#imgedit-history-' + postid).val() && $('#imgedit-undone-' + postid).val() === '0' ) { - $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).removeAttr('disabled'); + $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', false); } else { $('input.imgedit-submit-btn', '#imgedit-panel-' + postid).prop('disabled', true); } @@ -458,10 +458,10 @@ fh = t.intval(h.val()); if ( fw < 1 ) { - w.focus(); + w.trigger( 'focus' ); return false; } else if ( fh < 1 ) { - h.focus(); + h.trigger( 'focus' ); return false; } @@ -689,7 +689,7 @@ elementToSetFocusTo = $( '.imgedit-wrap' ).find( ':tabbable:first' ); } - elementToSetFocusTo.focus(); + elementToSetFocusTo.trigger( 'focus' ); }, 100 ); }, @@ -867,7 +867,7 @@ $('#image-editor-' + postid).fadeOut('fast', function() { $( '#media-head-' + postid ).fadeIn( 'fast', function() { // Move focus back to the Edit Image button. Runs also when saving. - $( '#imgedit-open-btn-' + postid ).focus(); + $( '#imgedit-open-btn-' + postid ).trigger( 'focus' ); }); $(this).empty(); }); @@ -1042,7 +1042,7 @@ t.setDisabled(button, pop < history.length); // When undo gets disabled, move focus to the redo button to avoid a focus loss. if ( history.length === pop ) { - $( '#image-redo-' + postid ).focus(); + $( '#image-redo-' + postid ).trigger( 'focus' ); } }); }, @@ -1073,7 +1073,7 @@ t.setDisabled(button, pop > 0); // When redo gets disabled, move focus to the undo button to avoid a focus loss. if ( 0 === pop ) { - $( '#image-undo-' + postid ).focus(); + $( '#image-undo-' + postid ).trigger( 'focus' ); } }); }, diff --git a/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js b/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js index 2bfefd1b9a..c0b573934f 100644 --- a/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js +++ b/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.js @@ -1,6 +1,6 @@ /* * imgAreaSelect jQuery plugin - * version 0.9.10-monkey + * version 0.9.10-wp * * Copyright (c) 2008-2013 Michal Wojciechowski (odyniec.net) * @@ -388,7 +388,7 @@ $.imgAreaSelect = function (img, options) { * current handler */ if ($.imgAreaSelect.onKeyPress != docKeyPress) - $(document).unbind($.imgAreaSelect.keyPress, + $(document).off($.imgAreaSelect.keyPress, $.imgAreaSelect.onKeyPress); if (options.keys) @@ -396,8 +396,9 @@ $.imgAreaSelect = function (img, options) { * Set the document keypress event handler to this instance's * docKeyPress() function */ - $(document)[$.imgAreaSelect.keyPress]( - $.imgAreaSelect.onKeyPress = docKeyPress); + $(document).on( $.imgAreaSelect.keyPress, function() { + $.imgAreaSelect.onKeyPress = docKeyPress; + }); } /* @@ -931,7 +932,7 @@ $.imgAreaSelect = function (img, options) { * The font-size property needs to be set to zero, otherwise * Internet Explorer makes the handles too large */ - fontSize: 0, + fontSize: '0', zIndex: zIndex + 1 || 1 }); @@ -1010,7 +1011,7 @@ $.imgAreaSelect = function (img, options) { /* Calculate the aspect ratio factor */ aspectRatio = (d = (options.aspectRatio || '').split(/:/))[0] / d[1]; - $img.add($outer).unbind('mousedown', imgMouseDown); + $img.add($outer).off('mousedown', imgMouseDown); if (options.disable || options.enable === false) { /* Disable the plugin */ @@ -1025,7 +1026,7 @@ $.imgAreaSelect = function (img, options) { $box.on({ 'mousemove touchmove': areaMouseMove, 'mousedown touchstart': areaMouseDown }); - $(window).resize(windowResize); + $(window).on( 'resize', windowResize); } if (!options.persistent) @@ -1162,7 +1163,7 @@ $.imgAreaSelect = function (img, options) { $box.add($outer).css({ visibility: 'hidden', position: position, overflow: 'hidden', zIndex: zIndex || '0' }); $box.css({ zIndex: zIndex + 2 || 2 }); - $area.add($border).css({ position: 'absolute', fontSize: 0 }); + $area.add($border).css({ position: 'absolute', fontSize: '0' }); /* * If the image has been fully loaded, or if it is not really an image (eg. diff --git a/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.min.js b/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.min.js index f81ced0f9b..f2b1c8b4a6 100644 --- a/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.min.js +++ b/src/js/_enqueues/vendor/imgareaselect/jquery.imgareaselect.min.js @@ -1 +1 @@ -!function(a){function b(){return a("
")}var c=Math.abs,d=Math.max,e=Math.min,f=Math.round;a.imgAreaSelect=function(g,h){function i(a){return a+ra.left-sa.left}function j(a){return a+ra.top-sa.top}function k(a){return a-ra.left+sa.left}function l(a){return a-ra.top+sa.top}function m(a){return d(a.pageX||0,o(a).x)-sa.left}function n(a){return d(a.pageY||0,o(a).y)-sa.top}function o(a){var b=a.originalEvent||{};return b.touches&&b.touches.length?{x:b.touches[0].pageX,y:b.touches[0].pageY}:{x:0,y:0}}function p(a){var b=a||T,c=a||U;return{x1:f(va.x1*b),y1:f(va.y1*c),x2:f(va.x2*b),y2:f(va.y2*c),width:f(va.x2*b)-f(va.x1*b),height:f(va.y2*c)-f(va.y1*c)}}function q(a,b,c,d,e){var g=e||T,h=e||U;va={x1:f(a/g||0),y1:f(b/h||0),x2:f(c/g||0),y2:f(d/h||0)},va.width=va.x2-va.x1,va.height=va.y2-va.y1}function r(){K&&la.width()&&(ra={left:f(la.offset().left),top:f(la.offset().top)},O=la.innerWidth(),P=la.innerHeight(),ra.top+=la.outerHeight()-P>>1,ra.left+=la.outerWidth()-O>>1,W=f(h.minWidth/T)||0,X=f(h.minHeight/U)||0,Y=f(e(h.maxWidth/T||1<<24,O)),Z=f(e(h.maxHeight/U||1<<24,P)),"1.3.2"!=a().jquery||"fixed"!=ua||wa.getBoundingClientRect||(ra.top+=d(document.body.scrollTop,wa.scrollTop),ra.left+=d(document.body.scrollLeft,wa.scrollLeft)),sa=/absolute|relative/.test(Q.css("position"))?{left:f(Q.offset().left)-Q.scrollLeft(),top:f(Q.offset().top)-Q.scrollTop()}:"fixed"==ua?{left:a(document).scrollLeft(),top:a(document).scrollTop()}:{left:0,top:0},M=i(0),N=j(0),(va.x2>O||va.y2>P)&&z())}function s(b){if(_){switch(ma.css({left:i(va.x1),top:j(va.y1)}).add(na).width(ia=va.width).height(ja=va.height),na.add(oa).add(qa).css({left:0,top:0}),oa.width(d(ia-oa.outerWidth()+oa.innerWidth(),0)).height(d(ja-oa.outerHeight()+oa.innerHeight(),0)),a(pa[0]).css({left:M,top:N,width:va.x1,height:P}),a(pa[1]).css({left:M+va.x1,top:N,width:ia,height:va.y1}),a(pa[2]).css({left:M+va.x2,top:N,width:O-va.x2,height:P}),a(pa[3]).css({left:M+va.x1,top:N+va.y2,width:ia,height:P-va.y2}),ia-=qa.outerWidth(),ja-=qa.outerHeight(),qa.length){case 8:a(qa[4]).css({left:ia>>1}),a(qa[5]).css({left:ia,top:ja>>1}),a(qa[6]).css({left:ia>>1,top:ja}),a(qa[7]).css({top:ja>>1});case 4:qa.slice(1,3).css({left:ia}),qa.slice(2,4).css({top:ja})}b!==!1&&(a.imgAreaSelect.onKeyPress!=ya&&a(document).unbind(a.imgAreaSelect.keyPress,a.imgAreaSelect.onKeyPress),h.keys&&a(document)[a.imgAreaSelect.keyPress](a.imgAreaSelect.onKeyPress=ya)),za&&oa.outerWidth()-oa.innerWidth()==2&&(oa.css("margin",0),setTimeout(function(){oa.css("margin","auto")},0))}}function t(a){r(),s(a),aa=i(va.x1),ba=j(va.y1),ca=i(va.x2),da=j(va.y2)}function u(a,b){h.fadeSpeed?a.fadeOut(h.fadeSpeed,b):a.hide()}function v(a){var b=k(m(a))-va.x1,c=l(n(a))-va.y1;ka||(r(),ka=!0,ma.one("mouseout",function(){ka=!1})),V="",h.resizable&&(c<=h.resizeMargin?V="n":c>=va.height-h.resizeMargin&&(V="s"),b<=h.resizeMargin?V+="w":b>=va.width-h.resizeMargin&&(V+="e")),ma.css("cursor",V?V+"-resize":h.movable?"move":""),L&&L.toggle()}function w(b){a("body").css("cursor",""),(h.autoHide||va.width*va.height==0)&&u(ma.add(pa),function(){a(this).hide()}),a(document).off("mousemove touchmove",A),ma.on("mousemove touchmove",v),h.onSelectEnd(g,p())}function x(b){return("mousedown"!=b.type||1==b.which)&&(v(b),r(),V?(a("body").css("cursor",V+"-resize"),aa=i(va[/w/.test(V)?"x2":"x1"]),ba=j(va[/n/.test(V)?"y2":"y1"]),a(document).on("mousemove touchmove",A).one("mouseup touchend",w),ma.off("mousemove touchmove",v)):h.movable?(R=M+va.x1-m(b),S=N+va.y1-n(b),ma.off("mousemove touchmove",v),a(document).on("mousemove touchmove",C).one("mouseup touchend",function(){h.onSelectEnd(g,p()),a(document).off("mousemove touchmove",C),ma.on("mousemove touchmove",v)})):la.mousedown(b),!1)}function y(a){$&&(a?(ca=d(M,e(M+O,aa+c(da-ba)*$*(ca>aa||-1))),da=f(d(N,e(N+P,ba+c(ca-aa)/$*(da>ba||-1)))),ca=f(ca)):(da=d(N,e(N+P,ba+c(ca-aa)/$*(da>ba||-1))),ca=f(d(M,e(M+O,aa+c(da-ba)*$*(ca>aa||-1)))),da=f(da)))}function z(){aa=e(aa,M+O),ba=e(ba,N+P),c(ca-aa)