Your IP : 3.149.214.156


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/image_uploader/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/image_uploader/bximageuploader.min.js

(function(e){e.BXUploader=function(e){this.type=e.type=="flash"?"flash":"applet";this.id=e.id;this.arGuids={};this.Watermark=new t(this)};e.BXUploader.prototype={enableExtendedUploadPane:function(e,t){var i=this;e.events.beforeUpload.push(this.exUploaderOnBeforeUpload);e.events.uploadFileCountChange.push(this.exUploaderOnUploadFileCountChange);e.events.initComplete.push(function(){if(i.uploadPane)i.uploadPane.style.display="block"});this.extendedUploadPaneConfig=t;BX.ready(function(){i.uploadPane=BX(i.id+"_UploadPane");i.uploadPaneCount=0;if(i.uploadPane&&BX.browser.IsSafari())i.uploadPane.style.height="auto"});return e},exUploaderOnUploadFileCountChange:function(){var t=e["oBXUploaderHandler_"+this.id()],i=this.files(),a=i.count(),r={},o,n,s,l;if(a<t.uploadPaneCount){for(o=0;o<a;o++)r[i.get(o).guid()+""]=true;for(o=0,n=t.uploadPane.childNodes.length;o<n;o++){s=t.uploadPane.childNodes[o];if(s.tagName&&s.tagName.toLowerCase()=="div"&&s.id.substr(0,"bxitem_".length)=="bxitem_"){l=t.arGuids[s.id.substr("bxitem_".length)];if(!r[l])s.parentNode.removeChild(s)}}}else if(a>t.uploadPaneCount){for(o=t.uploadPaneCount;o<a;o++)t.addItemToUploadPane(this,o)}t.uploadPaneCount=a},exUploaderOnBeforeUpload:function(){var t,i,a,r,o,n=e["oBXUploaderHandler_"+this.id()];for(t=0,i=n.uploadPane.childNodes.length;t<i;t++){o=n.uploadPane.childNodes[t];if(o.tagName&&o.tagName.toLowerCase()=="div"&&o.id.substr(0,"bxitem_".length)=="bxitem_"){a=o.id.substr("bxitem_".length);if(n.extendedUploadPaneConfig.showTitle){r=BX(a+"_title").value;this.metadata().addCustomField("Title_"+t,r,false)}if(n.extendedUploadPaneConfig.showDesc)this.files().get(t).description(BX(a+"_desc").value);if(n.extendedUploadPaneConfig.showTags)this.files().get(t).tag(BX(a+"_tags").value)}}},addItemToUploadPane:function(e,t){var i=e.files().get(t),a=i.guid(),r="Thumbnail_"+Math.round(Math.random()*1e3)+Math.round(Math.random()*1e3);var o=$au.thumbnail({id:r,width:"100px",height:"100px",parentControlName:e.id(),guid:a,javaControl:{codeBase:e.javaControl().codeBase()},activeXControl:{codeBase:e.activeXControl().codeBase(),codeBase64:e.activeXControl().codeBase64()}});this.arGuids[r]=a;var n=this,s,l,f,h=0,d=false,u=this.uploadPane.appendChild(BX.create("DIV",{props:{className:"bx-iu-ex-item",id:"bxitem_"+r}})),p=u.appendChild(BX.create("table"));s=p.insertRow(-1);f=BX.adjust(s.insertCell(-1),{props:{className:"bx-iu-ex-thumb"},html:o.getHtml()});l=BX.adjust(s.insertCell(-1),{props:{}});if(this.extendedUploadPaneConfig.showTitle){l.appendChild(BX.create("label",{attrs:{"for":r+"_title"},text:"Title:"}));d=l.appendChild(BX.create("input",{props:{type:"text",id:r+"_title",value:i.name()}}));d.onfocus=function(){this.select()};h++;l=p.insertRow(-1).insertCell(-1)}if(this.extendedUploadPaneConfig.showDesc){l.appendChild(BX.create("label",{attrs:{"for":r+"_desc"},text:"Description: "}));l.appendChild(BX.create("textarea",{props:{id:r+"_desc",rows:2},text:i.description()}));h++;l=p.insertRow(-1).insertCell(-1)}if(this.extendedUploadPaneConfig.showTags){l.appendChild(BX.create("label",{attrs:{"for":r+"_tags"},text:"Tags:"}));l.appendChild(BX.create("input",{props:{type:"text",id:r+"_tags",value:i.tag()}}));h++}if(h>1)f.rowSpan=h;var m=u.appendChild(BX.create("DIV",{props:{className:"bx-iu-ex-item-close",id:"bxclose_"+r}}));m.onclick=function(){var t=n.arGuids[this.id.substr("bxclose_".length)];var i=e.files();for(var a=0,r=i.count();a<r;a++){if(BX.util.trim(t)==BX.util.trim(i.get(a).guid())){i.remove(a);break}}}},enableWatermark:function(e,t){this.watermarkConfig=t;this.Watermark.use=t.values.use;this.Watermark.type=t.values.type;this.Watermark.text=t.values.text;this.Watermark.color=t.values.color;this.Watermark.position=t.values.position;this.Watermark.size=t.values.size;this.Watermark.file=t.values.file;e.events.beforeUpload.push(this.watermarkOnBeforeUpload);return e},watermarkOnBeforeUpload:function(){var t=this.converters().count(),i,a=e["oBXUploaderHandler_"+this.id()];if(a.Watermark.Using()!="Y")return;a.Watermark.WatermarkConfig(a.watermarkConfig);var r,o,n,s,l,f,h,d,u="",p=10;for(i=0;i<t;i++){if(i==1)continue;u="OffsetX="+p+";OffsetY="+p+";";u+="Position="+a.Watermark.Position()+";";if(a.Watermark.Opacity()>0&&a.Watermark.Opacity()<100)u+="Opacity="+a.Watermark.Opacity()+";";f=this.converters().get(i).thumbnailWidth();h=this.converters().get(i).thumbnailHeight();if(a.Watermark.Type()=="image"||a.Watermark.Type()=="picture"){r=a.Watermark.File();if(!r)return;u+="ImageUrl="+r+";";n=a.Watermark.Size();var m=a.Watermark.FileWidth();var g=a.Watermark.FileHeight();s=m;l=g;if(n=="big"){s=Math.round(m*.75);l=Math.round(g*.75)}else if(n=="middle"){s=Math.round(m*.5);l=Math.round(g*.5)}else if(n=="small"){s=Math.round(m*.25);l=Math.round(g*.25)}u+="Width="+s+";Height="+l+";"}else{o=a.Watermark.Text();if(!o)return;if(a.Watermark.Copyright())o=String.fromCharCode(169)+" "+o;u+='Text="'+o+'";';n=a.Watermark.Size();if(n=="big"){fontSize=Math.round(f*.11);if(fontSize>75)fontSize=75}else if(n=="middle"){fontSize=Math.round(f*.07);if(fontSize>55)fontSize=55}else{fontSize=Math.round(f*.035);if(fontSize<9)fontSize=9;if(fontSize>20)fontSize=20}u+="Size="+fontSize+";";u+="FillColor="+a.Watermark.Color()+";";u+="Font=Arial;"}this.converters().get(i).thumbnailWatermark(u)}},SetOriginalSize:function(t){if(!this.uploader)this.uploader=e[(this.type=="flash"?"BXFIU_":"BXIU_")+this.id];t=parseInt(t);if(t<=0)t=2e4;this.uploader.converters().get(0).thumbnailWidth(t);this.uploader.converters().get(0).thumbnailHeight(t);this.SaveUserOption("original_size",t==2e4?0:t)},SaveUserOption:function(e,t){BX.userOptions.save("main",this.id,e,t)}};function t(e){this.oUploadHandler=e}t.prototype={WatermarkConfig:function(e){this.watermarkConfig=e},Using:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL")return"Y";if(typeof e=="undefined")return this.use;this.use=e;if(t!==false)this.oUploadHandler.SaveUserOption("use",this.use?"Y":"N")},Type:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.type)return this.watermarkConfig.type.toLowerCase();if(typeof e=="undefined")return this.type;else this.type=e;if(t!==false)this.oUploadHandler.SaveUserOption("type",this.type)},Color:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.color)return this.watermarkConfig.color;if(typeof e=="undefined")return this.color;else this.color=e;if(t!==false)this.oUploadHandler.SaveUserOption("color",this.color)},Size:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.size)return this.watermarkConfig.size;if(typeof e=="undefined")return this.size;else this.size=e;if(t!==false)this.oUploadHandler.SaveUserOption("size",this.size)},Position:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.position)return this.watermarkConfig.position;if(typeof e=="undefined")return this.position;else this.position=e;if(t!==false)this.oUploadHandler.SaveUserOption("position",this.position)},Text:function(e){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL")return this.watermarkConfig.text;if(typeof e=="undefined")return this.text;else this.text=e},File:function(e){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.file)return this.watermarkConfig.file;if(typeof e=="undefined")return this.file;else this.file=e},FileWidth:function(e){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.fileWidth)return this.watermarkConfig.fileWidth;if(typeof e=="undefined")return this.fileWidth;else this.fileWidth=e},FileHeight:function(e){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.fileHeight)return this.watermarkConfig.fileHeight;if(typeof e=="undefined")return this.fileHeight;else this.fileHeight=e},Opacity:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.opacity)return this.watermarkConfig.opacity;if(typeof e=="undefined")return this.opacity;else this.opacity=e;if(t!==false)this.oUploadHandler.SaveUserOption("opacity",this.opacity)},Copyright:function(e,t){if(this.watermarkConfig&&this.watermarkConfig.rules=="ALL"&&this.watermarkConfig.copyright)return this.watermarkConfig.copyright;if(typeof e=="undefined")return this.copyright;else this.copyright=e;if(t!==false)this.oUploadHandler.SaveUserOption("copyright",this.copyright)}}})(window);
//# sourceMappingURL=bximageuploader.map.js