]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/image-edit.min.js
Wordpress 3.7
[autoinstalls/wordpress.git] / wp-admin / js / image-edit.min.js
index 6d7e0314ca4f4a1119ca40e65e71f35ea15e3f4b..61d174451720f39c643e9df4c88e59081bb6eeee 100644 (file)
@@ -1 +1 @@
-var imageEdit;(function(a){imageEdit={iasapi:{},hold:{},postid:"",intval:function(b){return b|0},setDisabled:function(c,b){if(b){c.removeClass("disabled");a("input",c).removeAttr("disabled")}else{c.addClass("disabled");a("input",c).prop("disabled",true)}},init:function(g,e){var d=this,c=a("#image-editor-"+d.postid),b=d.intval(a("#imgedit-x-"+g).val()),f=d.intval(a("#imgedit-y-"+g).val());if(d.postid!=g&&c.length){d.close(d.postid)}d.hold.w=d.hold.ow=b;d.hold.h=d.hold.oh=f;d.hold.xy_ratio=b/f;d.hold.sizer=parseFloat(a("#imgedit-sizer-"+g).val());d.postid=g;a("#imgedit-response-"+g).empty();a('input[type="text"]',"#imgedit-panel-"+g).keypress(function(i){var h=i.keyCode;if(36<h&&h<41){a(this).blur()}if(13==h){i.preventDefault();i.stopPropagation();return false}})},toggleEditor:function(d,b){var c=a("#imgedit-wait-"+d);if(b){c.height(a("#imgedit-panel-"+d).height()).fadeIn("fast")}else{c.fadeOut("fast")}},toggleHelp:function(b){a(b).siblings(".imgedit-help").slideToggle("fast");return false},getTarget:function(b){return a('input[name="imgedit-target-'+b+'"]:checked',"#imgedit-save-target-"+b).val()||"full"},scaleChanged:function(i,b){var d=a("#imgedit-scale-width-"+i),f=a("#imgedit-scale-height-"+i),g=a("#imgedit-scale-warn-"+i),c="",e="";if(b){e=(d.val()!="")?Math.round(d.val()/this.hold.xy_ratio):"";f.val(e)}else{c=(f.val()!="")?Math.round(f.val()*this.hold.xy_ratio):"";d.val(c)}if((e&&e>this.hold.oh)||(c&&c>this.hold.ow)){g.css("visibility","visible")}else{g.css("visibility","hidden")}},getSelRatio:function(f){var b=this.hold.w,e=this.hold.h,d=this.intval(a("#imgedit-crop-width-"+f).val()),c=this.intval(a("#imgedit-crop-height-"+f).val());if(d&&c){return d+":"+c}if(b&&e){return b+":"+e}return"1:1"},filterHistory:function(j,f){var d=a("#imgedit-history-"+j).val(),b,h,e,c,g=[];if(d!=""){d=JSON.parse(d);b=this.intval(a("#imgedit-undone-"+j).val());if(b>0){while(b>0){d.pop();b--}}if(f){if(!d.length){this.hold.w=this.hold.ow;this.hold.h=this.hold.oh;return""}e=d[d.length-1];e=e.c||e.r||e.f||false;if(e){this.hold.w=e.fw;this.hold.h=e.fh}}for(h in d){c=d[h];if(c.hasOwnProperty("c")){g[h]={c:{x:c.c.x,y:c.c.y,w:c.c.w,h:c.c.h}}}else{if(c.hasOwnProperty("r")){g[h]={r:c.r.r}}else{if(c.hasOwnProperty("f")){g[h]={f:c.f.f}}}}}return JSON.stringify(g)}return""},refreshEditor:function(g,d,f){var c=this,e,b;c.toggleEditor(g,1);e={action:"imgedit-preview",_ajax_nonce:d,postid:g,history:c.filterHistory(g,1),rand:c.intval(Math.random()*1000000)};b=a('<img id="image-preview-'+g+'" />');b.load(function(){var i,h,k=a("#imgedit-crop-"+g),j=imageEdit;k.empty().append(b);i=Math.max(j.hold.w,j.hold.h);h=Math.max(a(b).width(),a(b).height());j.hold.sizer=i>h?h/i:1;j.initCrop(g,b,k);j.setCropSelection(g,0);if((typeof f!="unknown")&&f!=null){f()}if(a("#imgedit-history-"+g).val()&&a("#imgedit-undone-"+g).val()==0){a("input.imgedit-submit-btn","#imgedit-panel-"+g).removeAttr("disabled")}else{a("input.imgedit-submit-btn","#imgedit-panel-"+g).prop("disabled",true)}j.toggleEditor(g,0)}).error(function(){a("#imgedit-crop-"+g).empty().append('<div class="error"><p>'+imageEditL10n.error+"</p></div>");c.toggleEditor(g,0)}).attr("src",ajaxurl+"?"+a.param(e))},action:function(b,g,c){var j=this,e,i,f,d,k;if(j.notsaved(b)){return false}e={action:"image-editor",_ajax_nonce:g,postid:b};if("scale"==c){i=a("#imgedit-scale-width-"+b),f=a("#imgedit-scale-height-"+b),d=j.intval(i.val()),k=j.intval(f.val());if(d<1){i.focus();return false}else{if(k<1){f.focus();return false}}if(d==j.hold.ow||k==j.hold.oh){return false}e["do"]="scale";e.fwidth=d;e.fheight=k}else{if("restore"==c){e["do"]="restore"}else{return false}}j.toggleEditor(b,1);a.post(ajaxurl,e,function(h){a("#image-editor-"+b).empty().append(h);j.toggleEditor(b,0)})},save:function(f,b){var c,e=this.getTarget(f),d=this.filterHistory(f,0);if(""==d){return false}this.toggleEditor(f,1);c={action:"image-editor",_ajax_nonce:b,postid:f,history:d,target:e,context:a("#image-edit-context").length?a("#image-edit-context").val():null,"do":"save"};a.post(ajaxurl,c,function(h){var g=JSON.parse(h);if(g.error){a("#imgedit-response-"+f).html('<div class="error"><p>'+g.error+"</p><div>");imageEdit.close(f);return}if(g.fw&&g.fh){a("#media-dims-"+f).html(g.fw+" &times; "+g.fh)}if(g.thumbnail){a(".thumbnail","#thumbnail-head-"+f).attr("src",""+g.thumbnail)}if(g.msg){a("#imgedit-response-"+f).html('<div class="updated"><p>'+g.msg+"</p></div>")}imageEdit.close(f)})},open:function(h,d){var f,e=a("#image-editor-"+h),c=a("#media-head-"+h),b=a("#imgedit-open-btn-"+h),g=b.siblings(".spinner");b.prop("disabled",true);g.show();f={action:"image-editor",_ajax_nonce:d,postid:h,"do":"open"};e.load(ajaxurl,f,function(){e.fadeIn("fast");c.fadeOut("fast",function(){b.removeAttr("disabled");g.hide()})})},imgLoaded:function(d){var b=a("#image-preview-"+d),c=a("#imgedit-crop-"+d);this.initCrop(d,b,c);this.setCropSelection(d,0);this.toggleEditor(d,0)},initCrop:function(g,e,c){var b=this,d=a("#imgedit-sel-width-"+g),f=a("#imgedit-sel-height-"+g);b.iasapi=a(e).imgAreaSelect({parent:c,instance:true,handles:true,keys:true,minWidth:3,minHeight:3,onInit:function(h,i){c.children().mousedown(function(m){var k=false,l,j;if(m.shiftKey){l=b.iasapi.getSelection();j=b.getSelRatio(g);k=(l&&l.width&&l.height)?l.width+":"+l.height:j}b.iasapi.setOptions({aspectRatio:k})})},onSelectStart:function(h,i){imageEdit.setDisabled(a("#imgedit-crop-sel-"+g),1)},onSelectEnd:function(h,i){imageEdit.setCropSelection(g,i)},onSelectChange:function(h,j){var i=imageEdit.hold.sizer;d.val(imageEdit.round(j.width/i));f.val(imageEdit.round(j.height/i))}})},setCropSelection:function(g,f){var e,b=a("#imgedit-minthumb-"+g).val()||"128:128",d=this.hold.sizer;b=b.split(":");f=f||0;if(!f||(f.width<3&&f.height<3)){this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),0);this.setDisabled(a("#imgedit-crop-sel-"+g),0);a("#imgedit-sel-width-"+g).val("");a("#imgedit-sel-height-"+g).val("");a("#imgedit-selection-"+g).val("");return false}if(f.width<(b[0]*d)&&f.height<(b[1]*d)){this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),0);a("#imgedit-selection-"+g).val("");return false}e={x:f.x1,y:f.y1,w:f.width,h:f.height};this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+g),1);a("#imgedit-selection-"+g).val(JSON.stringify(e))},close:function(c,b){b=b||false;if(b&&this.notsaved(c)){return false}this.iasapi={};this.hold={};a("#image-editor-"+c).fadeOut("fast",function(){a("#media-head-"+c).fadeIn("fast");a(this).empty()})},notsaved:function(e){var c=a("#imgedit-history-"+e).val(),d=(c!="")?JSON.parse(c):new Array(),b=this.intval(a("#imgedit-undone-"+e).val());if(b<d.length){if(confirm(a("#imgedit-leaving-"+e).html())){return false}return true}return false},addStep:function(i,h,d){var c=this,e=a("#imgedit-history-"+h),g=(e.val()!="")?JSON.parse(e.val()):new Array(),f=a("#imgedit-undone-"+h),b=c.intval(f.val());while(b>0){g.pop();b--}f.val(0);g.push(i);e.val(JSON.stringify(g));c.refreshEditor(h,d,function(){c.setDisabled(a("#image-undo-"+h),true);c.setDisabled(a("#image-redo-"+h),false)})},rotate:function(d,e,c,b){if(a(b).hasClass("disabled")){return false}this.addStep({r:{r:d,fw:this.hold.h,fh:this.hold.w}},e,c)},flip:function(d,e,c,b){if(a(b).hasClass("disabled")){return false}this.addStep({f:{f:d,fw:this.hold.w,fh:this.hold.h}},e,c)},crop:function(g,e,c){var f=a("#imgedit-selection-"+g).val(),b=this.intval(a("#imgedit-sel-width-"+g).val()),d=this.intval(a("#imgedit-sel-height-"+g).val());if(a(c).hasClass("disabled")||f==""){return false}f=JSON.parse(f);if(f.w>0&&f.h>0&&b>0&&d>0){f.fw=b;f.fh=d;this.addStep({c:f},g,e)}},undo:function(g,e){var d=this,c=a("#image-undo-"+g),f=a("#imgedit-undone-"+g),b=d.intval(f.val())+1;if(c.hasClass("disabled")){return}f.val(b);d.refreshEditor(g,e,function(){var h=a("#imgedit-history-"+g),i=(h.val()!="")?JSON.parse(h.val()):new Array();d.setDisabled(a("#image-redo-"+g),true);d.setDisabled(c,b<i.length)})},redo:function(g,e){var d=this,c=a("#image-redo-"+g),f=a("#imgedit-undone-"+g),b=d.intval(f.val())-1;if(c.hasClass("disabled")){return}f.val(b);d.refreshEditor(g,e,function(){d.setDisabled(a("#image-undo-"+g),true);d.setDisabled(c,b>0)})},setNumSelection:function(c){var g,k=a("#imgedit-sel-width-"+c),j=a("#imgedit-sel-height-"+c),o=this.intval(k.val()),m=this.intval(j.val()),i=a("#image-preview-"+c),p=i.height(),h=i.width(),b=this.hold.sizer,f,n,e,l,d=this.iasapi;if(o<1){k.val("");return false}if(m<1){j.val("");return false}if(o&&m&&(g=d.getSelection())){e=g.x1+Math.round(o*b);l=g.y1+Math.round(m*b);f=g.x1;n=g.y1;if(e>h){f=0;e=h;k.val(Math.round(e/b))}if(l>p){n=0;l=p;j.val(Math.round(l/b))}d.setSelection(f,n,e,l);d.update();this.setCropSelection(c,d.getSelection())}},round:function(b){var c;b=Math.round(b);if(this.hold.sizer>0.6){return b}c=b.toString().slice(-1);if("1"==c){return b-1}else{if("9"==c){return b+1}}return b},setRatioSelection:function(j,i,d){var f,e,b=this.intval(a("#imgedit-crop-width-"+j).val()),g=this.intval(a("#imgedit-crop-height-"+j).val()),c=a("#image-preview-"+j).height();if(!this.intval(a(d).val())){a(d).val("");return}if(b&&g){this.iasapi.setOptions({aspectRatio:b+":"+g});if(f=this.iasapi.getSelection(true)){e=Math.ceil(f.y1+((f.x2-f.x1)/(b/g)));if(e>c){e=c;if(i){a("#imgedit-crop-height-"+j).val("")}else{a("#imgedit-crop-width-"+j).val("")}}this.iasapi.setSelection(f.x1,f.y1,f.x2,e);this.iasapi.update()}}}}})(jQuery);
\ No newline at end of file
+var imageEdit;!function(a){imageEdit={iasapi:{},hold:{},postid:"",intval:function(a){return 0|a},setDisabled:function(b,c){c?(b.removeClass("disabled"),a("input",b).removeAttr("disabled")):(b.addClass("disabled"),a("input",b).prop("disabled",!0))},init:function(b){var c=this,d=a("#image-editor-"+c.postid),e=c.intval(a("#imgedit-x-"+b).val()),f=c.intval(a("#imgedit-y-"+b).val());c.postid!=b&&d.length&&c.close(c.postid),c.hold.w=c.hold.ow=e,c.hold.h=c.hold.oh=f,c.hold.xy_ratio=e/f,c.hold.sizer=parseFloat(a("#imgedit-sizer-"+b).val()),c.postid=b,a("#imgedit-response-"+b).empty(),a('input[type="text"]',"#imgedit-panel-"+b).keypress(function(b){var c=b.keyCode;return c>36&&41>c&&a(this).blur(),13==c?(b.preventDefault(),b.stopPropagation(),!1):void 0})},toggleEditor:function(b,c){var d=a("#imgedit-wait-"+b);c?d.height(a("#imgedit-panel-"+b).height()).fadeIn("fast"):d.fadeOut("fast")},toggleHelp:function(b){return a(b).siblings(".imgedit-help").slideToggle("fast"),!1},getTarget:function(b){return a('input[name="imgedit-target-'+b+'"]:checked',"#imgedit-save-target-"+b).val()||"full"},scaleChanged:function(b,c){var d=a("#imgedit-scale-width-"+b),e=a("#imgedit-scale-height-"+b),f=a("#imgedit-scale-warn-"+b),g="",h="";c?(h=""!=d.val()?Math.round(d.val()/this.hold.xy_ratio):"",e.val(h)):(g=""!=e.val()?Math.round(e.val()*this.hold.xy_ratio):"",d.val(g)),h&&h>this.hold.oh||g&&g>this.hold.ow?f.css("visibility","visible"):f.css("visibility","hidden")},getSelRatio:function(b){var c=this.hold.w,d=this.hold.h,e=this.intval(a("#imgedit-crop-width-"+b).val()),f=this.intval(a("#imgedit-crop-height-"+b).val());return e&&f?e+":"+f:c&&d?c+":"+d:"1:1"},filterHistory:function(b,c){var d,e,f,g,h=a("#imgedit-history-"+b).val(),i=[];if(""!=h){if(h=JSON.parse(h),d=this.intval(a("#imgedit-undone-"+b).val()),d>0)for(;d>0;)h.pop(),d--;if(c){if(!h.length)return this.hold.w=this.hold.ow,this.hold.h=this.hold.oh,"";f=h[h.length-1],f=f.c||f.r||f.f||!1,f&&(this.hold.w=f.fw,this.hold.h=f.fh)}for(e in h)g=h[e],g.hasOwnProperty("c")?i[e]={c:{x:g.c.x,y:g.c.y,w:g.c.w,h:g.c.h}}:g.hasOwnProperty("r")?i[e]={r:g.r.r}:g.hasOwnProperty("f")&&(i[e]={f:g.f.f});return JSON.stringify(i)}return""},refreshEditor:function(b,c,d){var e,f,g=this;g.toggleEditor(b,1),e={action:"imgedit-preview",_ajax_nonce:c,postid:b,history:g.filterHistory(b,1),rand:g.intval(1e6*Math.random())},f=a('<img id="image-preview-'+b+'" />').on("load",function(){var c,e,g=a("#imgedit-crop-"+b),h=imageEdit;g.empty().append(f),c=Math.max(h.hold.w,h.hold.h),e=Math.max(a(f).width(),a(f).height()),h.hold.sizer=c>e?e/c:1,h.initCrop(b,f,g),h.setCropSelection(b,0),"unknown"!=typeof d&&null!=d&&d(),a("#imgedit-history-"+b).val()&&0==a("#imgedit-undone-"+b).val()?a("input.imgedit-submit-btn","#imgedit-panel-"+b).removeAttr("disabled"):a("input.imgedit-submit-btn","#imgedit-panel-"+b).prop("disabled",!0),h.toggleEditor(b,0)}).on("error",function(){a("#imgedit-crop-"+b).empty().append('<div class="error"><p>'+imageEditL10n.error+"</p></div>"),g.toggleEditor(b,0)}).attr("src",ajaxurl+"?"+a.param(e))},action:function(b,c,d){var e,f,g,h,i,j=this;if(j.notsaved(b))return!1;if(e={action:"image-editor",_ajax_nonce:c,postid:b},"scale"==d){if(f=a("#imgedit-scale-width-"+b),g=a("#imgedit-scale-height-"+b),h=j.intval(f.val()),i=j.intval(g.val()),1>h)return f.focus(),!1;if(1>i)return g.focus(),!1;if(h==j.hold.ow||i==j.hold.oh)return!1;e["do"]="scale",e.fwidth=h,e.fheight=i}else{if("restore"!=d)return!1;e["do"]="restore"}j.toggleEditor(b,1),a.post(ajaxurl,e,function(c){a("#image-editor-"+b).empty().append(c),j.toggleEditor(b,0)})},save:function(b,c){var d,e=this.getTarget(b),f=this.filterHistory(b,0);return""==f?!1:(this.toggleEditor(b,1),d={action:"image-editor",_ajax_nonce:c,postid:b,history:f,target:e,context:a("#image-edit-context").length?a("#image-edit-context").val():null,"do":"save"},a.post(ajaxurl,d,function(c){var d=JSON.parse(c);return d.error?(a("#imgedit-response-"+b).html('<div class="error"><p>'+d.error+"</p><div>"),imageEdit.close(b),void 0):(d.fw&&d.fh&&a("#media-dims-"+b).html(d.fw+" &times; "+d.fh),d.thumbnail&&a(".thumbnail","#thumbnail-head-"+b).attr("src",""+d.thumbnail),d.msg&&a("#imgedit-response-"+b).html('<div class="updated"><p>'+d.msg+"</p></div>"),imageEdit.close(b),void 0)}),void 0)},open:function(b,c){var d,e=a("#image-editor-"+b),f=a("#media-head-"+b),g=a("#imgedit-open-btn-"+b),h=g.siblings(".spinner");g.prop("disabled",!0),h.show(),d={action:"image-editor",_ajax_nonce:c,postid:b,"do":"open"},e.load(ajaxurl,d,function(){e.fadeIn("fast"),f.fadeOut("fast",function(){g.removeAttr("disabled"),h.hide()})})},imgLoaded:function(b){var c=a("#image-preview-"+b),d=a("#imgedit-crop-"+b);this.initCrop(b,c,d),this.setCropSelection(b,0),this.toggleEditor(b,0)},initCrop:function(b,c,d){var e=this,f=a("#imgedit-sel-width-"+b),g=a("#imgedit-sel-height-"+b);e.iasapi=a(c).imgAreaSelect({parent:d,instance:!0,handles:!0,keys:!0,minWidth:3,minHeight:3,onInit:function(){d.children().mousedown(function(a){var c,d,f=!1;a.shiftKey&&(c=e.iasapi.getSelection(),d=e.getSelRatio(b),f=c&&c.width&&c.height?c.width+":"+c.height:d),e.iasapi.setOptions({aspectRatio:f})})},onSelectStart:function(){imageEdit.setDisabled(a("#imgedit-crop-sel-"+b),1)},onSelectEnd:function(a,c){imageEdit.setCropSelection(b,c)},onSelectChange:function(a,b){var c=imageEdit.hold.sizer;f.val(imageEdit.round(b.width/c)),g.val(imageEdit.round(b.height/c))}})},setCropSelection:function(b,c){var d,e=a("#imgedit-minthumb-"+b).val()||"128:128",f=this.hold.sizer;return e=e.split(":"),c=c||0,!c||c.width<3&&c.height<3?(this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+b),0),this.setDisabled(a("#imgedit-crop-sel-"+b),0),a("#imgedit-sel-width-"+b).val(""),a("#imgedit-sel-height-"+b).val(""),a("#imgedit-selection-"+b).val(""),!1):c.width<e[0]*f&&c.height<e[1]*f?(this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+b),0),a("#imgedit-selection-"+b).val(""),!1):(d={x:c.x1,y:c.y1,w:c.width,h:c.height},this.setDisabled(a(".imgedit-crop","#imgedit-panel-"+b),1),a("#imgedit-selection-"+b).val(JSON.stringify(d)),void 0)},close:function(b,c){return c=c||!1,c&&this.notsaved(b)?!1:(this.iasapi={},this.hold={},a("#image-editor-"+b).fadeOut("fast",function(){a("#media-head-"+b).fadeIn("fast"),a(this).empty()}),void 0)},notsaved:function(b){var c=a("#imgedit-history-"+b).val(),d=""!=c?JSON.parse(c):new Array,e=this.intval(a("#imgedit-undone-"+b).val());return e<d.length?confirm(a("#imgedit-leaving-"+b).html())?!1:!0:!1},addStep:function(b,c,d){for(var e=this,f=a("#imgedit-history-"+c),g=""!=f.val()?JSON.parse(f.val()):new Array,h=a("#imgedit-undone-"+c),i=e.intval(h.val());i>0;)g.pop(),i--;h.val(0),g.push(b),f.val(JSON.stringify(g)),e.refreshEditor(c,d,function(){e.setDisabled(a("#image-undo-"+c),!0),e.setDisabled(a("#image-redo-"+c),!1)})},rotate:function(b,c,d,e){return a(e).hasClass("disabled")?!1:(this.addStep({r:{r:b,fw:this.hold.h,fh:this.hold.w}},c,d),void 0)},flip:function(b,c,d,e){return a(e).hasClass("disabled")?!1:(this.addStep({f:{f:b,fw:this.hold.w,fh:this.hold.h}},c,d),void 0)},crop:function(b,c,d){var e=a("#imgedit-selection-"+b).val(),f=this.intval(a("#imgedit-sel-width-"+b).val()),g=this.intval(a("#imgedit-sel-height-"+b).val());return a(d).hasClass("disabled")||""==e?!1:(e=JSON.parse(e),e.w>0&&e.h>0&&f>0&&g>0&&(e.fw=f,e.fh=g,this.addStep({c:e},b,c)),void 0)},undo:function(b,c){var d=this,e=a("#image-undo-"+b),f=a("#imgedit-undone-"+b),g=d.intval(f.val())+1;e.hasClass("disabled")||(f.val(g),d.refreshEditor(b,c,function(){var c=a("#imgedit-history-"+b),f=""!=c.val()?JSON.parse(c.val()):new Array;d.setDisabled(a("#image-redo-"+b),!0),d.setDisabled(e,g<f.length)}))},redo:function(b,c){var d=this,e=a("#image-redo-"+b),f=a("#imgedit-undone-"+b),g=d.intval(f.val())-1;e.hasClass("disabled")||(f.val(g),d.refreshEditor(b,c,function(){d.setDisabled(a("#image-undo-"+b),!0),d.setDisabled(e,g>0)}))},setNumSelection:function(b){var c,d,e,f,g,h=a("#imgedit-sel-width-"+b),i=a("#imgedit-sel-height-"+b),j=this.intval(h.val()),k=this.intval(i.val()),l=a("#image-preview-"+b),m=l.height(),n=l.width(),o=this.hold.sizer,p=this.iasapi;return 1>j?(h.val(""),!1):1>k?(i.val(""),!1):(j&&k&&(c=p.getSelection())&&(f=c.x1+Math.round(j*o),g=c.y1+Math.round(k*o),d=c.x1,e=c.y1,f>n&&(d=0,f=n,h.val(Math.round(f/o))),g>m&&(e=0,g=m,i.val(Math.round(g/o))),p.setSelection(d,e,f,g),p.update(),this.setCropSelection(b,p.getSelection())),void 0)},round:function(a){var b;return a=Math.round(a),this.hold.sizer>.6?a:(b=a.toString().slice(-1),"1"==b?a-1:"9"==b?a+1:a)},setRatioSelection:function(b,c,d){var e,f,g=this.intval(a("#imgedit-crop-width-"+b).val()),h=this.intval(a("#imgedit-crop-height-"+b).val()),i=a("#image-preview-"+b).height();return this.intval(a(d).val())?(g&&h&&(this.iasapi.setOptions({aspectRatio:g+":"+h}),(e=this.iasapi.getSelection(!0))&&(f=Math.ceil(e.y1+(e.x2-e.x1)/(g/h)),f>i&&(f=i,c?a("#imgedit-crop-height-"+b).val(""):a("#imgedit-crop-width-"+b).val("")),this.iasapi.setSelection(e.x1,e.y1,e.x2,f),this.iasapi.update())),void 0):(a(d).val(""),void 0)}}}(jQuery);
\ No newline at end of file