Your IP : 3.142.249.130


Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/advertising/
Upload File :
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/advertising/template.min.js

function BXBannerTemplate(e){this.oConfig=e;this.MESS=e.lang;this.templates={};this.templatesExtended={};this.oldTemplates={};this.tPosition={};this.tCount={};this.aNames=[];this.canAdd={};this.canEdit=e.canEdit||false;this.nType=BX("banner_type");this.nComponentHead=BX("eTemplateComponentHead");this.nComponent=BX("eTemplateComponent");this.nAddTemplate=BX("eAddTemplateBanner");this.nTemplateProperties=BX("eTemplateProperties");this.nBannerContainer=BX("ADV_BANNER_PROPERTIES_CONTAINER");this.nExtMode=BX("EXTENDED_MODE")}BXBannerTemplate.prototype={show:function(e,t){var a=!!this.nExtMode.checked?this.templatesExtended[e]:this.templates[e];if(typeof t==="undefined"){window.changeTemplateNodes("clean");this.nComponent.style.display="";if(this.canAdd[e]&&this.canEdit)this.nAddTemplate.style.display="";else this.nAddTemplate.style.display="none";if(!this.canEdit)BX("eExtMode").style.display="none";this.nTemplateProperties.style.display="";for(var r in a){var i=a[r],n=i.nProps,s=i.nPropsHead,o=BX.create("div",{props:{className:"adv-template-banner-container"},children:[BX.create("table",{props:{className:"internal"},style:{width:"100%",marginBottom:"10px"},children:[BX.create("thead",{props:{className:"adv-banner-thead"}}),BX.create("tbody",{props:{className:"adv-banner-tbody"}})]})]});var l=o.firstChild.firstChild;l.appendChild(s);l=l.nextSibling;for(var p in n){if(n.hasOwnProperty(p)){l.appendChild(n[p]);this.appendJS(n[p].innerHTML)}}this.nBannerContainer.appendChild(o);this.addDraggableItem(o);this.sortItems();this.addListenerControlItem(o)}}else if(t===false){window.changeTemplateNodes("clean");this.nComponent.style.display="";if(this.canAdd[e])this.nAddTemplate.style.display="";else this.nAddTemplate.style.display="none";this.nTemplateProperties.style.display="";for(var r in a){var i=a[r],n=i.nProps,s=i.nPropsHead,d=i.oParams,o=BX.create("div",{props:{className:"adv-template-banner-container"},children:[BX.create("table",{props:{className:"internal"},style:{width:"100%",marginBottom:"10px"},children:[BX.create("thead",{props:{className:"adv-banner-thead"}}),BX.create("tbody",{props:{className:"adv-banner-tbody"}})]})]});var l=o.firstChild.firstChild;l.appendChild(s);l=l.nextSibling;for(var p in n){if(n.hasOwnProperty(p)){l.appendChild(n[p]);if(d[p]&&d[p].TYPE=="HTML")this.appendJS(n[p].innerHTML)}}this.nBannerContainer.appendChild(o);this.addDraggableItem(o);this.sortItems();this.addListenerControlItem(o)}}else if(parseInt(t)>=0){if(!!a[t]){var i=a[t],n=i.nProps,s=i.nPropsHead,d=i.oParams,o=BX.create("div",{props:{className:"adv-template-banner-container"},style:{display:"none"},children:[BX.create("table",{props:{className:"internal"},style:{width:"100%",marginBottom:"10px"},children:[BX.create("thead",{props:{className:"adv-banner-thead"}}),BX.create("tbody",{props:{className:"adv-banner-tbody"}})]})]});var l=o.firstChild.firstChild,c=this.tPosition[e];l.appendChild(s);l=l.nextSibling;for(var p in n){if(n.hasOwnProperty(p)){l.appendChild(n[p]);if(d[p].TYPE=="HTML")this.appendJS(n[p].innerHTML)}}if(!c[t]){var h=new BX.easing({duration:500,start:{height:0,opacity:0},finish:{height:100,opacity:100},transition:BX.easing.transitions.quart,step:function(e){o.style.opacity=e.opacity/100;o.style.display="block"},complete:function(){}});window.changeTemplateNodes("clean",t);this.nBannerContainer.appendChild(o);h.animate()}else{window.changeTemplateNodes("clean",c[t]-1);var u=this.nBannerContainer.children[c[t]-1];this.nBannerContainer.insertBefore(o,u);o.style.display="block"}this.addDraggableItem(o);this.sortItems();this.addListenerControlItem(o)}}},create:function(name,oVal,tNew){var data={action:"getTemplate",name:name,properties:!!oVal?oVal:"",mode:this.nExtMode.checked?"Y":"N",bCopy:this.oConfig.bCopy?"Y":"N",sessid:BX.bitrix_sessid()};var _this=this;if(oVal&&oVal.parameters.MODE=="Y"){_this.nExtMode.checked=true}BX.showWait();BX.ajax.post(this.oConfig.curPage,data,function(res){BX.closeWait();if(!!res){res=eval("("+res+")");var templates=!!_this.nExtMode.checked?_this.templatesExtended[name]={}:_this.templates[name]={},curValue;var settings=res[0].SETTINGS;_this.canAdd[name]=settings&&settings.MULTIPLE&&settings.MULTIPLE=="N"?false:true;_this.tCount[name]=0;_this.oldTemplates[name]={};var properties,propValueHead,propHiddenName;for(var a in res){properties={};propValueHead=_this.createTemplatePropHead(a);propValueHead.firstChild.setAttribute("style","text-align:left !important");propHiddenName=_this.createHiddenNameInput(res[a].BANNER_NAME,a);propValueHead.appendChild(propHiddenName);curValue=!!oVal?oVal.parameters.PROPS[a]:{};for(var i in res[a].PARAMETERS){if(res[a].PARAMETERS.hasOwnProperty(i)){var propValueNode=BX.create("td",{props:{className:"adm-detail-content-cell-r"},style:{width:"60%"}});var valProp=!!curValue[i]?curValue[i]:false;var propValue=_this.buildProperty(res[a].PARAMETERS[i],valProp,i,tNew,_this.tCount[name]);if(Object.prototype.toString.call(propValue)==="[object Array]"){for(var ar=0,cnt=propValue.length;ar<cnt;ar++)propValueNode.appendChild(propValue[ar])}else if(typeof propValue==="string")propValueNode.innerHTML=propValue;else propValueNode.appendChild(propValue);if(!!res[a].PARAMETERS[i].TOOLTIP){new BX.CHint({hint:res[a].PARAMETERS[i].TOOLTIP,parent:propValueNode.appendChild(BX.create("I",{props:{className:"bxcompprop-info-btn"}}))})}properties[i]=BX.create("tr",{children:[BX.create("td",{props:{className:"adm-detail-content-cell-l"},text:res[a].PARAMETERS[i].NAME+":",style:{width:"40%"}}),propValueNode],props:{id:"eTemplateProps_"+a+"_"+i}});properties[i].setAttribute("valign","top")}}var settings=res[a].SETTINGS||false;templates[a]={nProps:properties,oParams:res[a].PARAMETERS,nPropsHead:propValueHead,oSettings:settings};_this.tCount[name]++}_this.show(name)}else _this.close()})},createFromDB:function(e){if(!!e){var t,a,r,i=this.getName(),n=e.params,s=e.val;if(e&&e.val&&e.val[0]&&e.val[0].EXTENDED_MODE=="Y")this.nExtMode.checked=true;var o=!!this.nExtMode.checked?this.templatesExtended[i]={}:this.templates[i]={},l;var p=e.params[0].SETTINGS;this.canAdd[i]=p&&p.MULTIPLE&&p.MULTIPLE=="N"?false:true;this.tCount[i]=0;this.oldTemplates[i]={};for(var d in n){t={};a=this.createTemplatePropHead(d);a.firstChild.setAttribute("style","text-align:left !important");r=this.createHiddenNameInput(n[d].BANNER_NAME,d);a.appendChild(r);l=!!s?s[d]:{};for(var c in n[d].PARAMETERS){if(n[d].PARAMETERS.hasOwnProperty(c)){var h=BX.create("td",{props:{className:"adm-detail-content-cell-r"},style:{width:"60%"}});var u=!!l[c]?l[c]:false;var m=this.buildProperty(n[d].PARAMETERS[c],u,c,false,this.tCount[i]);if(Object.prototype.toString.call(m)==="[object Array]"){for(var f=0,E=m.length;f<E;f++)h.appendChild(m[f])}else if(typeof m==="string")h.innerHTML=m;else h.appendChild(m);if(!!n[d].PARAMETERS[c].TOOLTIP){new BX.CHint({hint:n[d].PARAMETERS[c].TOOLTIP,parent:h.appendChild(BX.create("I",{props:{className:"bxcompprop-info-btn"}}))})}t[c]=BX.create("tr",{children:[BX.create("td",{props:{className:"adm-detail-content-cell-l"},text:n[d].PARAMETERS[c].NAME+":",style:{width:"40%"}}),h],props:{id:"eTemplateProps_"+d+"_"+c}});t[c].setAttribute("valign","top")}}var p=n[d].SETTINGS||false;o[d]={nProps:t,oParams:n[d].PARAMETERS,nPropsHead:a,oSettings:p};this.tCount[i]++}this.show(i)}else this.close()},refresh:function(ind){var curValues=this.getCurValues(ind,this.nExtMode.checked),name=this.getName(),_this=this,data={action:"refreshTemplate",name:name,curValues:!!curValues?curValues:"",mode:this.nExtMode.checked?"Y":"N",index:ind,sessid:BX.bitrix_sessid()};BX.showWait();BX.ajax.post(this.oConfig.curPage,data,function(res){BX.closeWait();if(!!res){res=eval("("+res+")");var oldTemplate=!!_this.nExtMode.checked?_this.templatesExtended[name]:_this.templates[name],allTemplateProps=_this.oldTemplates[name],curOldTemplate=oldTemplate[ind],curAllTemplateProps=allTemplateProps[ind]||{},properties={},parameters=res[0].PARAMETERS;for(var i in parameters){if(parameters.hasOwnProperty(i)){if(!curOldTemplate.nProps[i]&&!curAllTemplateProps[i]){var propValueNode=BX.create("td",{props:{className:"adm-detail-content-cell-r"},style:{width:"60%"}});var propValue=_this.buildProperty(parameters[i],false,i,true,ind);if(Object.prototype.toString.call(propValue)==="[object Array]"){for(var ar=0,cnt=propValue.length;ar<cnt;ar++)propValueNode.appendChild(propValue[ar])}else if(typeof propValue==="string"){propValueNode.innerHTML=propValue;if(parameters[i].TYPE!="HTML")_this.appendJS(propValue)}else propValueNode.appendChild(propValue);if(!!parameters[i].TOOLTIP){new BX.CHint({hint:parameters[i].TOOLTIP,parent:propValueNode.appendChild(BX.create("I",{props:{className:"bxcompprop-info-btn"}}))})}properties[i]=BX.create("tr",{children:[BX.create("td",{props:{className:"adm-detail-content-cell-l"},text:parameters[i].NAME+":",style:{width:"40%"}}),propValueNode],props:{id:"eTemplateProps_"+ind+"_"+i}});properties[i].setAttribute("valign","top")}else if(curOldTemplate.nProps[i])properties[i]=curOldTemplate.nProps[i];else properties[i]=curAllTemplateProps[i]}}allTemplateProps[ind]=_this.mergeObjects(curOldTemplate.nProps,curAllTemplateProps);curOldTemplate.nProps=properties;curOldTemplate.oParams=parameters;_this.show(name,ind)}else _this.close()})},addNewTBanner:function(){var name=this.getName(),data={action:"getCleanTemplate",name:name,properties:"",mode:this.nExtMode.checked?"Y":"N",index:this.tCount[name],sessid:BX.bitrix_sessid()};var _this=this;BX.showWait();BX.ajax.post(this.oConfig.curPage,data,function(res){BX.closeWait();if(!!res){res=eval("("+res+")");var properties={},propValueHead,propHiddenName,template=!!_this.nExtMode.checked?_this.templatesExtended[name]:_this.templates[name];propValueHead=_this.createTemplatePropHead(_this.tCount[name]);propValueHead.firstChild.setAttribute("style","text-align:left !important");propHiddenName=_this.createHiddenNameInput("",_this.tCount[name]);propValueHead.appendChild(propHiddenName);for(var i in res[0].PARAMETERS){if(res[0].PARAMETERS.hasOwnProperty(i)){var propValueNode=BX.create("td",{props:{className:"adm-detail-content-cell-r"},style:{width:"60%"}});var propValue=_this.buildProperty(res[0].PARAMETERS[i],false,i,true,_this.tCount[name]);if(Object.prototype.toString.call(propValue)==="[object Array]"){for(var ar=0,cnt=propValue.length;ar<cnt;ar++)propValueNode.appendChild(propValue[ar])}else if(typeof propValue==="string"){propValueNode.innerHTML=propValue;if(res[0].PARAMETERS[i].TYPE!="HTML")_this.appendJS(propValue)}else propValueNode.appendChild(propValue);if(!!res[0].PARAMETERS[i].TOOLTIP){new BX.CHint({hint:res[0].PARAMETERS[i].TOOLTIP,parent:propValueNode.appendChild(BX.create("I",{props:{className:"bxcompprop-info-btn"}}))})}properties[i]=BX.create("tr",{children:[BX.create("td",{props:{className:"adm-detail-content-cell-l"},text:res[0].PARAMETERS[i].NAME+":",style:{width:"40%"}}),propValueNode],props:{id:"eTemplateProps_"+_this.tCount[name]+"_"+i}});properties[i].setAttribute("valign","top")}}template[_this.tCount[name]]={nProps:properties,oParams:res[0].PARAMETERS,nPropsHead:propValueHead};_this.show(name,_this.tCount[name]);_this.tCount[name]++}})},createTemplatePropHead:function(e){var t=this.canEdit&&this.canAdd[this.getName()]?BX.create("span",{props:{className:"adv-banner-delete-button",title:this.MESS.DELETE},style:{"float":"right",marginRight:"10px",cursor:"pointer"},text:"x"}):{};return BX.create("tr",{props:{id:"eTemplatePropsHead"+e,className:"heading"},children:[BX.create("td",{props:{colSpan:2},children:[BX.create("span"),BX.create("span",{props:{className:"adm-list-table-popup"},style:{"float":"left",height:"15px",cursor:"auto"}}),t,BX.create("span",{props:{className:"adv-banner-show-button adv-banner-hide-button"},style:{"float":"right",marginRight:"30px",cursor:"pointer"},text:this.MESS.HIDE})]})]})},refreshAll:function(){var name=this.getName(),templateForCurVal=!!this.nExtMode.checked?this.templatesExtended[name]:this.templates[name],curTemplate=!this.nExtMode.checked?this.templatesExtended[name]:this.templates[name],curValues=[],mode=!!this.nExtMode.checked,fromObject=true,difference=this.countObject(curTemplate)-this.countObject(templateForCurVal);this.saveNames();if(!templateForCurVal){templateForCurVal=curTemplate;mode=!this.nExtMode.checked;fromObject=false;difference=0}for(var i in templateForCurVal){curValues.push(this.getCurValues(i,mode,fromObject))}if(difference>0){for(var i=0;i<difference;i++){curValues.push({EXTENDED_MODE:!!this.nExtMode.checked?"Y":"N"})}}var _this=this,data={action:"refreshAll",name:name,curValues:!!curValues?curValues:"",mode:this.nExtMode.checked?"Y":"N",sessid:BX.bitrix_sessid()};BX.showWait();BX.ajax.post(this.oConfig.curPage,data,function(res){BX.closeWait();if(!!res){res=eval("("+res+")");var templates={},curTemplate,newTemplate;if(!!_this.nExtMode.checked){newTemplate=_this.templatesExtended[name]?_this.templatesExtended[name]:{};curTemplate=_this.templates[name]}else{newTemplate=_this.templates[name]?_this.templates[name]:{};curTemplate=_this.templatesExtended[name]}_this.tCount[name]=0;_this.oldTemplates[name]={};var propValueHead,propHiddenName;for(var a in res){var properties={},bannerName;propValueHead=_this.createTemplatePropHead(a);propValueHead.firstChild.setAttribute("style","text-align:left !important");bannerName=!!res[a].BANNER_NAME?res[a].BANNER_NAME:!!_this.aNames[a]?_this.aNames[a]:"";propHiddenName=_this.createHiddenNameInput(bannerName,a);propValueHead.appendChild(propHiddenName);for(var i in res[a].PARAMETERS){if(res[a].PARAMETERS.hasOwnProperty(i)){if(curTemplate[a].oParams[i]&&res[a].PARAMETERS[i].TYPE==curTemplate[a].oParams[i].TYPE&&curTemplate[a].nProps[i]){properties[i]=curTemplate[a].nProps[i]}else if(newTemplate[a]&&newTemplate[a].nProps[i]){properties[i]=newTemplate[a].nProps[i]}else{var propValueNode=BX.create("td",{props:{className:"adm-detail-content-cell-r"},style:{width:"60%"}});var propValue=_this.buildProperty(res[a].PARAMETERS[i],false,i,true,_this.tCount[name]);if(Object.prototype.toString.call(propValue)==="[object Array]"){for(var ar=0,cnt=propValue.length;ar<cnt;ar++)propValueNode.appendChild(propValue[ar])}else if(typeof propValue==="string")propValueNode.innerHTML=propValue;else propValueNode.appendChild(propValue);properties[i]=BX.create("tr",{children:[BX.create("td",{props:{className:"adm-detail-content-cell-l"},text:res[a].PARAMETERS[i].NAME+":",style:{width:"40%"}}),propValueNode],props:{id:"eTemplateProps_"+a+"_"+i}});properties[i].setAttribute("valign","top")}}}templates[a]={nProps:properties,oParams:res[a].PARAMETERS,nPropsHead:propValueHead,oSettings:res[a].SETTINGS};_this.tCount[name]++}if(!!_this.nExtMode.checked){_this.templatesExtended[name]=templates}else{_this.templates[name]=templates}_this.show(name,false)}else _this.close()})},countObject:function(e){var t=0;for(var a in e){if(e.hasOwnProperty(a)){++t}}return t},createHiddenNameInput:function(e,t){return BX.create("input",{props:{type:"hidden",className:"adv-hidden-name-input",value:e||this.MESS.NAME,name:"TEMPLATE_PROP["+t+"][BANNER_NAME]"}})},mergeObjects:function(e,t){e=e||{};for(var a in t){if(t.hasOwnProperty(a))e[a]=t[a]}return e},select:function(e){var t=this.getName(e),a=!e?true:false,r=!!this.nExtMode.checked?this.templatesExtended[t]:this.templates[t];if(!t)this.close();else if(r)this.show(t,false);else this.create(t,e,a)},getName:function(e){var t=BX.findChild(this.nType,{tagName:"option"},true,true),a="",e=e||false;if(e&&e.parameters.NAME)a=e.parameters.NAME;else{for(var r in t){if(t[r].selected)a=t[r].getAttribute("data-name")}}return a},getCurValues:function(e,t,a){var r=this.getName(),i=!!t?this.templatesExtended[r]:this.templates[r],n=i[e].oParams,s={},o;for(var l in n){if(n.hasOwnProperty(l)){o=a?i[e].nProps[l]:BX("TEMPLATE_PROP_"+e+"_"+l);if(n[l].TYPE=="LIST"){var p=BX.findChildren(o,{tag:"option"},true,true);if(p&&p.length>0){if(n[l].MULTIPLE=="Y"){s[l]=[];for(var d in p){if(p[d].selected)s[l].push(p[d].value)}}else{for(var d in p){if(p[d].selected)s[l]=p[d].value}}}}if(n[l].TYPE=="CHECKBOX"){var c=a?o.childNodes[1].childNodes[1]:BX("TEMPLATE_PROP_"+e+"_"+l);if(c){if(c.type=="checkbox"&&c.checked)s[l]="Y";else s[l]="N"}}}}s["EXTENDED_MODE"]=BX("EXTENDED_MODE").checked?"Y":"N";return s},close:function(){this.nComponent.style.display="none";this.nComponentHead.style.display="none";this.nAddTemplate.style.display="none";window.changeTemplateNodes("clean")},buildProperty:function(e,t,a,r,i){var n=e.TYPE.toUpperCase();switch(n){case"LIST":return this.createListInput(e,t,a,r,i);case"CHECKBOX":return this.createCheckboxInput(e,t,a,i);case"STRING":return this.createStringInput(e,t,a,r,i);case"COLORPICKER":return this.createColorpicker(e,t,a,r,i);case"IMAGE":return this.createHTMLString(e);case"FILE":return this.createHTMLString(e);case"HTML":return this.createHTMLString(e);case"PRESET":return this.createPresetSelection(e,t,a,r,i);default:return this.createStringInput(e,t,a,r,i)}},createListInput:function(e,t,a,r,i){var n=e.MULTIPLE&&e.MULTIPLE=="Y"?true:false;var s=parseInt(i)>=0?i:0,o="TEMPLATE_PROP_"+s+"_"+a,a="TEMPLATE_PROP["+s+"]["+a+"]"+(n?"[]":""),l=parseInt(e.SIZE,10),p,d,c=this,h="";if(!l)l=n?3:1;if(e.REFRESH&&e.REFRESH=="Y")d={change:function(){c.refresh(s)}};var u=BX.create("select",{props:{id:o,name:a,multiple:n,size:l},events:d});if(r){if(n){t=[];for(var m in e.DEFAULT){e.DEFAULT[m]=!!e.DEFAULT[m]?e.DEFAULT[m]:"";t.push(e.DEFAULT[m])}}else t=!!e.DEFAULT?e.DEFAULT:""}for(var f in e.VALUES){p=false;if(n){for(var E in t){if(f==t[E]){p=true;if(h.length>0)h+=", ";h+=e.VALUES[f];break}}}else{p=f==t?true:false;if(p)h=e.VALUES[f]}if(e.VALUES.hasOwnProperty(f)){var T=BX.create("option",{props:{value:f,selected:p},text:e.VALUES[f]});u.appendChild(T)}}if(!this.canEdit)return jsUtils.htmlspecialchars(h);return u},createCheckboxInput:function(e,t,a,r){var i,n=this,s=parseInt(r)>=0?r:0;if(!this.canEdit){var o;if(!t&&e.DEFAULT=="Y"||t=="Y")o=this.MESS.YES;else o=this.MESS.NO;return o}if(e.REFRESH&&e.REFRESH=="Y")i={change:function(){n.refresh(s)}};var l=BX.create("input",{props:{type:"hidden",name:"TEMPLATE_PROP["+s+"]["+a+"]",value:"N"}});var p=BX.create("input",{props:{id:"TEMPLATE_PROP_"+s+"_"+a,type:"checkbox",name:"TEMPLATE_PROP["+s+"]["+a+"]",value:"Y"},events:i});if(!t&&e.DEFAULT=="Y"||t=="Y")p.checked=true;return[l,p]},createPresetSelection:function(e,t,a,r,i){if(!e.IMAGES)return[];var n,s={click:function(){l.selectPreset(this)}},o=[],l=this,p=parseInt(i)>=0?i:0;var d=this.oConfig.adminMode?"3px 3px 0px 3px":"3px";if(e.REFRESH&&e.REFRESH=="Y")n={change:function(){l.refresh(p)}};t=!!t?parseInt(t):!!e.DEFAULT?parseInt(e.DEFAULT):0;for(var c in e.IMAGES){var h=BX.create("input",{props:{type:"radio",className:"input_hidden",name:"TEMPLATE_PROP["+p+"]["+a+"]",id:"preset"+p+"_"+c,value:c},events:n});var u=BX.create(this.canEdit?"label":"div",{children:[BX.create("img",{props:{src:e.IMAGES[c]},style:{padding:d}})],props:{className:"preset"},events:this.canEdit?s:""});u.setAttribute("for","preset"+p+"_"+c);if(t==c){h.checked=true;BX.addClass(u,"selected_radio")}var m=BX.create("div",{style:{display:"inline-block",margin:"0 5px"}});m.appendChild(h);m.appendChild(u);o.push(m)}return o},selectPreset:function(e){var t=e.parentNode.parentNode;var a=BX.findChildren(t,{tagName:"label",className:"preset"},true);for(var r in a){BX.removeClass(a[r],"selected_radio")}BX.addClass(e,"selected_radio")},createStringInput:function(e,t,a,r,i){var n=r?!!e.DEFAULT?e.DEFAULT:"":!!t?t:"",s=parseInt(e.COLS)||20,o=parseInt(e.ROWS),l=parseInt(i)>=0?i:0;if(!this.canEdit){return jsUtils.htmlspecialchars(n)}if(o&&o>1)var p=BX.create("textarea",{props:{name:"TEMPLATE_PROP["+l+"]["+a+"]",cols:s,rows:o,value:n}});else var p=BX.create("input",{props:{type:"text",name:"TEMPLATE_PROP["+l+"]["+a+"]",size:"50",value:n}});return p},createColorpicker:function(e,t,a,r,i){var n=r?!!e.DEFAULT?e.DEFAULT:"000000":!!t?t:"",s=parseInt(i)>=0?i:0;if(!this.canEdit){return BX.create("div",{style:{display:"table"},children:[BX.create("span",{style:{display:"table-cell",verticalAlign:"middle"},text:"#"+n}),BX.create("span",{style:{display:"inline-block",backgroundColor:"#"+n,width:"16px",height:"16px",border:"1px solid #808080",marginLeft:"5px"}})]})}var o=BX.create("INPUT",{props:{size:10,name:"TEMPLATE_PROP["+s+"]["+a+"]",value:n,type:"text",id:"CP_bx_"+s+"_"+a},style:{minWidth:"100px","float":"left",marginRight:"3px"}});var l=BX.create("script",{text:"BX.loadScript('/bitrix/components/bitrix/main.colorpicker/templates/.default/script.js',  function(){window.oBXBannerTemplate.createCPObject('"+s+"_"+a+"', '"+n+"')});"});return[o,l]},createHTMLString:function(e){return e.HTML},appendJS:function(e){var t=new RegExp("<"+"script"+">[^\x00]*?<"+"/"+"script"+">","ig"),a;var r=e.match(t);if(r){for(var i=0;i<r.length;i++){if(r[i]!=""){a=r[i].substring(8,r[i].length-9);window.setTimeout(a,0)}}}var n=new RegExp("<"+'script type="text/javascript"'+">[^\x00]*?<"+"/"+"script"+">","ig"),a;var s=e.match(n);if(s){for(var i=0;i<s.length;i++){if(s[i]!=""){a=s[i].substring(31,s[i].length-9);window.setTimeout(a,0)}}}},createCPObject:function(e,t){BXColorPicker.prototype.Create=function(){var e=this;this.zIndex+=BX.WindowManager?BX.WindowManager.GetZIndex():0;window["bx_colpic_keypress_"+this.fid]=function(t){e.OnKeyPress(t)};window["bx_colpic_click_"+this.fid]=function(t){e.OnDocumentClick(t)};this.pColCont=document.body.appendChild(BX.create("DIV",{props:{className:"bx-colpic-cont"},style:{zIndex:this.zIndex}}));var a=["#FF0000","#FFFF00","#00FF00","#00FFFF","#0000FF","#FF00FF","#FFFFFF","#EBEBEB","#E1E1E1","#D7D7D7","#CCCCCC","#C2C2C2","#B7B7B7","#ACACAC","#A0A0A0","#959595","#EE1D24","#FFF100","#00A650","#00AEEF","#2F3192","#ED008C","#898989","#7D7D7D","#707070","#626262","#555555","#464646","#363636","#262626","#111111","#000000","#F7977A","#FBAD82","#FDC68C","#FFF799","#C6DF9C","#A4D49D","#81CA9D","#7BCDC9","#6CCFF7","#7CA6D8","#8293CA","#8881BE","#A286BD","#BC8CBF","#F49BC1","#F5999D","#F16C4D","#F68E54","#FBAF5A","#FFF467","#ACD372","#7DC473","#39B778","#16BCB4","#00BFF3","#438CCB","#5573B7","#5E5CA7","#855FA8","#A763A9","#EF6EA8","#F16D7E","#EE1D24","#F16522","#F7941D","#FFF100","#8FC63D","#37B44A","#00A650","#00A99E","#00AEEF","#0072BC","#0054A5","#2F3192","#652C91","#91278F","#ED008C","#EE105A","#9D0A0F","#A1410D","#A36209","#ABA000","#588528","#197B30","#007236","#00736A","#0076A4","#004A80","#003370","#1D1363","#450E61","#62055F","#9E005C","#9D0039","#790000","#7B3000","#7C4900","#827A00","#3E6617","#045F20","#005824","#005951","#005B7E","#003562","#002056","#0C004B","#30004A","#4B0048","#7A0045","#7A0026"];var r,i,n,s=BX.create("TABLE",{props:{className:"bx-colpic-tbl"}}),o,l=a.length;r=s.insertRow(-1);i=r.insertCell(-1);i.colSpan=8;var p=i.appendChild(BX.create("SPAN",{props:{className:"bx-colpic-def-but"}}));p.innerHTML=window.jsColorPickerMess.DefaultColor;p.onmouseover=function(){this.className="bx-colpic-def-but bx-colpic-def-but-over";n.style.backgroundColor="transparent"};p.onmouseout=function(){this.className="bx-colpic-def-but"};p.onclick=function(t){e.Select(false)};n=r.insertCell(-1);n.colSpan=8;n.className="bx-color-inp-cell";n.style.backgroundColor="#"+t;for(o=0;o<l;o++){if(Math.round(o/16)==o/16)r=s.insertRow(-1);i=r.insertCell(-1);i.innerHTML="&nbsp;";i.className="bx-colpic-col-cell";i.style.backgroundColor=a[o];i.id="bx_color_id__"+o;i.onmouseover=function(e){this.className="bx-colpic-col-cell bx-colpic-col-cell-over";n.style.backgroundColor=a[this.id.substring("bx_color_id__".length)]};i.onmouseout=function(e){this.className="bx-colpic-col-cell"};i.onclick=function(t){var r=this.id.substring("bx_color_id__".length);e.Select(a[r])}}s.onmouseout=function(t){n.style.backgroundColor="#"+e.oPar.input.value};this.pColCont.appendChild(s);this.bCreated=true};window["COLORPICKER_"+e]=new window.BXColorPicker({id:"CP_bx_"+e,input:BX("CP_bx_"+e),name:this.MESS.SELECT_COLOR,OnSelect:BX.delegate(function(t){if(!t)t="000000";else t=t.substring(1);BX("CP_bx_"+e).value=t},this)});window["COLORPICKER_"+e].pWnd.style.backgroundPosition="-280px -21px";if(!BX.findChild(BX("CP_bx_"+e).parentNode,{tagName:"div",className:"bx-colpic-button-cont"},false)){BX("CP_bx_"+e).parentNode.appendChild(window["COLORPICKER_"+e].pCont)}},initDraggableItems:function(){var e=this;this.dragdrop=BX.DragDrop.create({dragItemClassName:"adv-template-banner-container",dragItemControlClassName:"adv-banner-thead",sortable:{rootElem:BX("ADV_BANNER_PROPERTIES_CONTAINER"),gagClass:"advdrag",gagHtml:""},dragEnd:function(t,a,r){e.sortItems();e.repairEditor(a)}})},addDraggableItem:function(e){if(!this.dragdrop)return;this.dragdrop.addSortableItem(e);this.dragdrop.bindDragItem([e])},removeDraggableItem:function(e){if(!this.dragdrop)return;this.dragdrop.removeSortableItem(e)},sortItems:function(){var e=this.nBannerContainer.children,t={},a,r,i,n,s=1,o,l=this.getName();for(var p in e){if(!e[p]||!e[p].querySelectorAll)continue;a=e[p].querySelector(".heading");r=e[p].querySelector(".adv-hidden-name-input");if(a&&r){i=a.id.substring(a.id.indexOf("eTemplatePropsHead")+18);n=r.value||this.MESS.NAME;t[i]=s;o=this.canAdd[l]?this.MESS.SLIDE+" #"+s+': <span class="adv-name-text">'+n+"</span>":'<span class="adv-name-text">'+n+"</span>";a.firstChild.firstChild.innerHTML=o;s++}this.tPosition[l]=t}},saveNames:function(){var e=this.nBannerContainer.children,t,a;this.aNames=[];for(var r in e){if(!e[r]||!e[r].querySelectorAll)continue;t=e[r].querySelector(".adv-hidden-name-input");if(t){this.aNames.push(t.value||this.MESS.NAME)}}},repairEditor:function(e){var t=BX.findChild(e,{className:"typearea"},true);if(!t)return;var a,r;var i;for(var n in t.attributes){if(!t.attributes[n])continue;i=t.attributes[n];if(i.nodeName=="id")a=i.nodeValue;else if(i.nodeName=="name")r=i.nodeValue}var s;if(window.BXHtmlEditor)s=window.BXHtmlEditor.Get(r);if(!s)return;setTimeout(function(){s.CheckAndReInit()},100)},addListenerControlItem:function(e){if(!e||!e.querySelector)return;var t=e.querySelector(".adv-banner-show-button");var a=e.querySelector(".adv-banner-tbody");if(t&&a){BX.bind(t,"click",BX.delegate(function(){this.toggleShow(a,t,null,null)},this))}var r=e.querySelector(".adv-banner-delete-button");if(r){BX.bind(r,"click",BX.delegate(function(){this.deleteItem(e)},this))}var i=e.querySelector(".adv-name-text").parentNode;if(i&&this.canEdit){BX.bind(i,"click",BX.delegate(function(){this.showRenameDialog(e,i)},this));i.style.cursor="pointer"}},toggleShow:function(e,t,a,r){if(!e&&a){e=a.querySelector(".adv-banner-tbody")}if(!t&&a){t=a.querySelector(".adv-banner-show-button")}if(e&&t){if(r===null){if(e.style.display=="none")r=true;else r=false}BX.removeClass(t,"adv-banner-hide-button");if(r){var i=new BX.easing({duration:300,start:{opacity:0},finish:{opacity:100},transition:BX.easing.transitions.quart,step:function(t){e.style.opacity=t.opacity/100;e.style.display=""}});i.animate();t.innerHTML=this.MESS.HIDE;BX.addClass(t,"adv-banner-hide-button")}else{e.style.display="none";t.innerHTML=this.MESS.SHOW}}},deleteItem:function(e){var t=new BX.easing({duration:500,start:{opacity:100},finish:{opacity:0},transition:BX.easing.transitions.quart,step:function(t){e.style.opacity=t.opacity/100},complete:BX.delegate(function(){this.removeDraggableItem(e);BX.remove(e);this.sortItems()},this)});t.animate()},showRenameDialog:function(e,t){var a=BX.PopupWindowManager.create("adv-banner-rename-dialog-container",t,{darkMode:false,closeIcon:true,content:BX("ADV_RENAME_DIALOG"),className:"adm-workarea",autoHide:true,zIndex:BX.WindowManager?BX.WindowManager.GetZIndex()+10:0});a.close();a.setBindElement(t);var r=BX("ADV_RENAME_DIALOG_BTN_CANCEL");var i=BX("ADV_RENAME_DIALOG_BTN_SAVE");a.close();BX.unbindAll(r);BX.bind(r,"click",function(){a.close()});BX.unbindAll(i);BX.bind(i,"click",BX.delegate(function(){this.setNameItem(e);this.setNameText(e);a.close()},this));this.setNameToDialog(e);a.show()},setNameToDialog:function(e){if(!e||!e.querySelector)return;var t=BX("ADV_RENAME_DIALOG_VALUE");var a=e.querySelector(".adv-hidden-name-input");if(!!a)t.value=BX.util.trim(a.value)},setNameItem:function(e){if(!e||!e.querySelector)return;var t=BX("ADV_RENAME_DIALOG_VALUE");var a=e.querySelector(".adv-hidden-name-input");a.value=BX.util.trim(t.value)},setNameText:function(e){if(!e||!e.querySelector)return;var t=e.querySelector(".adv-hidden-name-input");var a=e.querySelector(".adv-name-text");a.innerHTML=BX.util.trim(t.value)}};
//# sourceMappingURL=template.map.js