1"use strict";var avia_js_shortcodes=avia_js_shortcodes||{};var aviaJS=aviaJS||{};(function() 2{if(!avia_js_shortcodes.aviaFoldUnfoldSection) 3{class avFoldUnfoldSection 4{container=null;id='';settings={};button=[];foldContainer=[];folded=false;preview=false;innerDimension={};textblock=[];multiColumsTextblock=false;gridRow=[];colorSection=[];column=[];constructor(container) 5{this.container=container;this.container.avFoldUnfoldSection=this;this.id=container.getAttribute('id');this.init();} 6init() 7{this.settings=JSON.parse(this.container.dataset.fold_unfold);this.preview=document.getElementById('av-admin-preview')!=null;this.moveIntoFoldContainer();if(!this.button.length||!this.foldContainer.length||this.checkMissingInnerContainers()) 8{return;} 9if(this.isNested()) 10{this.container.classList.remove('avia-fold-init');this.foldContainer[0].classList.remove('unfolded','folded');this.foldContainer[0].style['max-height']='unset';this.button[0].remove();return;} 11this.foldContainer[0].style['max-height']=this.settings.height+'px';this.foldContainer[0].classList.add('folded');this.foldContainer[0].classList.remove('unfolded');this.folded=true;this.container.classList.add('avia-fold-init-done');this.getMaxHeight();this.foldChanged();this.bindEvents();this.container.classList.remove('avia-fold-init');} 12moveIntoFoldContainer() 13{if(this.container.hasChildNodes()) 14{let children=this.container.childNodes;for(const child of children) 15{if(child.classList) 16{if(child.classList.contains('av-fold-unfold-container')) 17{this.foldContainer[0]=child;} 18if(child.classList.contains('av-fold-button-wrapper')) 19{const btn=child.getElementsByClassName('av-fold-button-container');if(btn.length) 20{this.button[0]=btn[0];}}}}} 21let move=null;if(this.settings.context=='avia_sc_text') 22{let el=this.foldContainer[0].nextSibling;while(el) 23{if(el.classList&&el.classList.contains('avia_textblock')) 24{move=el;break;} 25el=el.nextSibling;}} 26else if(this.settings.context=='avia_sc_columns') 27{let el=this.foldContainer[0].nextSibling;this.column=this.foldContainer[0].getElementsByClassName('av-fold-unfold-inner');if(this.column.length) 28{while(el) 29{if(el.classList&&el.classList.contains('av-fold-button-wrapper')) 30{el=el.nextSibling;} 31else 32{const next=el.nextSibling;this.column[0].append(el);el=next;}}}} 33else 34{const el=this.container.nextSibling;if(el) 35{move=el;}} 36if(move) 37{this.foldContainer[0].append(move);}} 38checkMissingInnerContainers() 39{let retVal=false;switch(this.settings.context) 40{case'avia_sc_text':this.textblock=this.container.getElementsByClassName('avia_textblock');if(this.textblock.length==0) 41{retVal=true;} 42else 43{this.multiColumsTextblock=this.textblock[0].classList.contains('av_multi_colums');} 44break;case'avia_sc_grid_row':this.gridRow=this.container.getElementsByClassName('av-layout-grid-container');if(this.gridRow.length==0) 45{retVal=true;} 46break;case'avia_sc_section':this.colorSection=this.container.getElementsByClassName('avia-section');if(this.colorSection.length==0) 47{retVal=true;} 48break;case'avia_sc_columns':if(!this.column[0].childNodes.length) 49{retVal=true;} 50break;default:retVal=true;} 51return retVal;} 52isNested() 53{const parent=this.container.parentElement;if(null==parent) 54{return false;} 55let closest=parent.closest('.avia-fold-unfold-section');if(closest==parent) 56{closest=null;} 57return closest!=null;} 58bindEvents() 59{this.container.addEventListener('transitionend',this.onTransitionEnd.bind(this));this.container.addEventListener('webkitTransitionEnd',this.onTransitionEnd.bind(this));this.button[0].addEventListener('click',this.onClickFoldUnfold.bind(this));window.addEventListener('avia_fold_unfold_changed',this.onFoldUnfoldChanged.bind(this));window.addEventListener('resize',aviaJS.aviaJSHelpers.debounce(this.onResize.bind(this),200));} 60getMaxHeight() 61{switch(this.settings.context) 62{case'avia_sc_text':this.innerDimension=this.textblock[0].getBoundingClientRect();break;case'avia_sc_grid_row':this.innerDimension=this.gridRow[0].getBoundingClientRect();break;case'avia_sc_section':this.innerDimension=this.colorSection[0].getBoundingClientRect();break;case'avia_sc_columns':this.innerDimension=this.column[0].getBoundingClientRect();break;}} 63foldChanged() 64{let btnText='',btnLink='';if(this.folded) 65{this.foldContainer[0].style['max-height']=this.settings.height+'px';
65btnText=this.settings.more;btnLink='#';} 66else 67{this.getMaxHeight();this.foldContainer[0].style['max-height']=Math.ceil(this.innerDimension.height)+200+'px';btnText=this.settings.less;btnLink+='#'+this.id;} 68this.button[0].setAttribute('href',btnLink);this.button[0].textContent=btnText;this.triggerHeightChange();} 69onClickFoldUnfold(event) 70{event.preventDefault();event.stopPropagation();if(this.foldContainer[0].classList.contains('folded')) 71{this.foldContainer[0].classList.remove('folded');this.foldContainer[0].classList.add('unfolded');this.folded=false;} 72else 73{this.foldContainer[0].classList.remove('unfolded');this.foldContainer[0].classList.add('folded');this.folded=true;} 74this.foldChanged();let obj=this;setTimeout(function() 75{const opt={'bubbles':true,'cancelable':true,detail:{caller:obj}};const event=new CustomEvent('avia_fold_unfold_changed',opt);obj.container.dispatchEvent(event);},500);} 76onTransitionEnd(event) 77{this.container.classList.remove('avia-fold-init-done');this.triggerHeightChange();} 78onResize(event) 79{this.foldChanged();} 80onFoldUnfoldChanged(event) 81{this.foldChanged();} 82triggerHeightChange() 83{const opt={'bubbles':true,'cancelable':true};const event=new CustomEvent('avia_height_change',opt);window.dispatchEvent(event);}} 84avia_js_shortcodes.aviaFoldUnfoldSection=function(container) 85{return new avFoldUnfoldSection(container);};aviaJS.aviaPlugins.register(avia_js_shortcodes.aviaFoldUnfoldSection,'.avia-fold-unfold-section');}})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.