ACMS.Dispatch._imgresize=function(context){function resize(target){var createObjectURL=window.URL&&window.URL.createObjectURL,$previewBox=$(ACMS.Config.resizeImagePreviewMark,target).clone();$(ACMS.Config.resizeImagePreviewMark,target).after($.parseHTML('<div class="js-img_resize_preview_location" />'));if($("[name^=image_size_]",target).length>0&&$("[name^=image_size_]",target).val().length<2)return false;$(ACMS.Config.resizeImageInputMark,target).on("change",function(event){var i=0,multiple=event.target.files.length>
1;$(ACMS.Config.resizeImagePreviewMark,target).remove();$(".js-img_resize_data",target).remove();for(i=0;i<event.target.files.length;i++){var file=event.target.files[i],image=new Image;if(!file)continue;image.force=multiple;image.target=target;image.mime=file.type;image.onload=ACMS.Dispatch.Utility.imgToDataURL;image.src=createObjectURL(file);image.callback=function(elm,dataUrl,resize){var image=elm,target=image.target;ACMS.Dispatch._imgresize.set(target,dataUrl,resize,$previewBox)}}})}if($(ACMS.Config.resizeImageTargetMark,
context).length>0)_.each($(ACMS.Config.resizeImageTargetMark,context),function(v){resize(v)});else if(1&&$(context).hasClass(ACMS.Config.resizeImageTargetMarkCF.substr(1))&&!$(context).hasClass("resizeImage")){$(context).addClass("resizeImage");resize(context)}};
ACMS.Dispatch._imgresize.set=function(target,dataUrl,resize,$previewBox){if(!$previewBox){$previewBox=$(ACMS.Config.resizeImagePreviewMark,target).clone();$(ACMS.Config.resizeImagePreviewMark,target).remove();$(".js-img_resize_data",target).remove()}$(".js-img_resize_preview_location",target).before($previewBox.clone().show().prop("src",dataUrl));$(".js-img_data_url",target).attr("data-src",dataUrl);if(resize){dataUrl=dataUrl.replace(/^data:image\/.*;base64,/,"");$(ACMS.Config.resizeImageInputMark,
target).replaceWith($(ACMS.Config.resizeImageInputMark,target).clone(true))}else dataUrl="";var $dataForm=$('<input class="js-img_resize_data" accept="image/*">').prop({type:"hidden",name:$(ACMS.Config.resizeImageInputMark,target).prop("name"),value:dataUrl});$(ACMS.Config.resizeImageInputMark,target).after($dataForm)};
