/* Add here all your JS customizations */

BX.addCustomEvent("onSubmitForm", BX.delegate(function (data) {
  if ( !window.ym || !data.type || data.type !== 'form_submit'){
    return;
  }
  if (data.form_name && data.form_name === 'aspro_scorp_callback' ) {
    ym(70881394,'reachGoal','formheadsend')
  }

  if (data.form_name && data.form_name === 'aspro_scorp_order_services' ) {
    ym(70881394,'reachGoal','formfootersend')
  }
}));

document.addEventListener('DOMContentLoaded', readMore);
function readMore(){
  const block = document.querySelector('[data-text=root]');
  if ( block === null ) {
    return;
  }

  const content = block.querySelector('[data-text=content]');
  const button = block.querySelector('[data-text=button]');
  const maxHeightContent = 160;

  if( !content || !button){
    return;
  }

  if(maxHeightContent < content.offsetHeight) {
    block.classList.add('is_active');

    button.addEventListener('click', ()=>{
      block.classList.remove('is_active');
    });
  }

}