ACMS.Dispatch._imgresize=function(elm){var obj=new ACMS.Dispatch.Imgresize(elm);obj.resize()};ACMS.Dispatch.Imgresize=function(elm){this.elm=elm;this.dropAreaMark=".js-drop_area";this.inputMark=ACMS.Config.resizeImageInputMark;this.previewMark=ACMS.Config.resizeImagePreviewMark;this.targetMark=ACMS.Config.resizeImageTargetMark;this.targetMarkCF=ACMS.Config.resizeImageTargetMarkCF;this.dropSelect=false;this.dragging=0;this.previewOnly=ACMS.Config.resizeImage!=="on";var inputs=$(this.inputMark,elm);if(inputs.length>1){_.each(inputs,function(input,i){input.name=input.name.replace(/\[\d*\]$/,"["+i+"]")})}};ACMS.Dispatch.Imgresize.prototype.resize=function(){var self=this;if($(self.targetMark,self.elm).length>0){_.each($(self.targetMark,self.elm),function(v){self.exec(v)})}else if(1&&$(self.elm).hasClass(self.targetMarkCF.substr(1))&&!$(self.elm).hasClass("resizeImage")){$(self.elm).addClass("resizeImage");self.exec(self.elm)}};ACMS.Dispatch.Imgresize.prototype.exec=function(target){var self=this;self.previewBox=$(self.previewMark,target).clone();$(self.previewMark,target).after($.parseHTML('<div class="js-img_resize_preview_location" />'));self.listener(target)};ACMS.Dispatch.Imgresize.prototype.listener=function(target){var self=this;ACMS.Library.setDropArea(target,this.dropAreaMark,function(files){self.dropSelect=true;self.readFiles(files,target)});$(self.inputMark,target).on("change",function(event){self.readFiles(event.target.files,target)})};ACMS.Dispatch.Imgresize.prototype.readFiles=function(files,target){var self=this,$sizeSelect=$("[name^=image_size_]",target),$bannerSize=$(".js-banner_size_large"),$bannerSizeCriterion=$(".js-banner_size_large_criterion"),rawSize=$sizeSelect.length>0&&$sizeSelect.val().length<2;if($sizeSelect.length>1){return false}if($bannerSize.length>=1&&$bannerSize.val()){ACMS.Config.lgImg=$bannerSizeCriterion.val()+":"+$bannerSize.val()}$(self.previewMark,target).remove();$(".js-img_resize_data",target).remove();var lgImageSize=ACMS.Config.lgImg;var lgImgAry=lgImageSize.split(":");var lgImgSide=lgImgAry[0];var lgImgSize=lgImgAry[1];var multi=files.length>1;if(rawSize){lgImgSize=999999999}for(var i=0;i<files.length;i++){var file=files[i];if(!file)continue;ACMS.Library.resizeImage.getDataUrlFromFile(file,lgImgSide,lgImgSize,function(dataUrl,resize){if(rawSize){resize=false}if(multi){resize=true}if(!self.dropSelect&&file.type==="image/gif"){resize=false}if(self.previewOnly){resize=false}self.set(target,dataUrl,resize||self.dropSelect)})}};