1 line
1.0 KiB
JavaScript
1 line
1.0 KiB
JavaScript
!function(a){var b={},c={updateCoords:function(b){a("#crop-x").val(b.x),a("#crop-y").val(b.y),a("#crop-width").val(b.w),a("#crop-height").val(b.h),c.showPreview(b)},showPreview:function(b){var c=64/b.w,d=64/b.h,e=16/b.w,f=16/b.h;a("#preview-homeicon").css({width:Math.round(c*wpSiteIconCropData.width)+"px",height:Math.round(d*wpSiteIconCropData.height)+"px",marginLeft:"-"+Math.round(c*b.x)+"px",marginTop:"-"+Math.round(d*b.y)+"px"}),a("#preview-favicon").css({width:Math.round(e*wpSiteIconCropData.width)+"px",height:Math.round(f*wpSiteIconCropData.height)+"px",marginLeft:"-"+Math.round(e*b.x)+"px",marginTop:"-"+Math.floor(f*b.y)+"px"})},ready:function(){b=a.Jcrop("#crop-image"),b.setOptions({bgColor:"transparent",aspectRatio:1,onSelect:c.updateCoords,onChange:c.updateCoords,trueSize:[wpSiteIconCropData.width,wpSiteIconCropData.height],minSize:[wpSiteIconCropData.min_size,wpSiteIconCropData.min_size]}),b.animateTo([wpSiteIconCropData.init_x,wpSiteIconCropData.init_y,wpSiteIconCropData.init_size,wpSiteIconCropData.init_size])}};c.ready()}(jQuery); |