vc

mail@pastecode.io avatarunknown
plain_text
12 days ago
6.2 kB
1
Indexable
Never
(function() {
  var debug = 0;
  var variation_name = "";
  if (window.location.href.indexOf('qa-debug=true') > -1) {
      debug = 1;
  }
  try {
      function waitForElement(selector, trigger, delayInterval, delayTimeout) {
          var interval = setInterval(function() {
              if (
                  document &&
                  document.querySelector(selector) &&
                  document.querySelectorAll(selector).length > 0
              ) {
                  clearInterval(interval);
                  trigger();
              }
          }, delayInterval);
          setTimeout(function() {
              clearInterval(interval);
          }, delayTimeout);
      }
      var NewForm = '<div class="eg-new-hero-continer"><div class="eg-form-continer"></div></div>';
      var NewTitle = '<h2 class="eg-video-title">Get Access to Tools, Resources & Support for Rapid Startup Growth</h2>';

      var ListItem = '' +
          '  <div class="eg-hero-list-item">' +
          '      <ul>' +
          '          <li>Get reduced pricing to Altium Designer and free access to Altium 365 </li>' +
          '          <li>Learn how to master Altium\’s PCB design tool with optimized training options and 24/7 access to dedicated support.</li>' +
          '          <li> Join 200+ Startups that Have Taken Advantage of Altium Launchpad!</li>' +
          '      </ul>' +
          '  </div>' +
          '  <div class="eg-logo-section">' +
          '     <div class="eg-first-row"> <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/apollo.svg" alt="apollo" loading="lazy"></div>' +
          '      <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/knight.svg" alt="knight" loading="lazy"></div>' +
          '      <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/MistyWest.svg" alt="MistyWest" loading="lazy"></div>' +
          '      <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/project.svg" alt="project" loading="lazy"> </div></div>' +
          '     <div class="eg-second-row"> <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/shaper.svg" alt="shaper" loading="lazy"></div>' +
          '      <div class="s-hero__logo-item"><img src="//cdn-static.altium.com/sites/default/files/media_icon/2023-08/tzoa.svg" alt="tzoa" loading="lazy"></div></div>' +
          '  </div>';

      function initForm() {
          if (!document.querySelector(' .eg-hero-list-item')) {
              document.querySelector(' .s-hero__btn-wrap').insertAdjacentHTML('afterend', ListItem);
          }

          var VideoSection = document.querySelector(".s-hero__text-row")
          document.querySelector('.s-hero__desc').insertAdjacentElement('beforebegin', VideoSection);

          if (!document.querySelector(".s-hero__text-row .s-hero__text .eg-video-title"))
              document.querySelector(".s-hero__text-row .s-hero__text").insertAdjacentHTML('afterbegin', NewTitle);

      }

      function EgForm() {
          if (!document.querySelector('.eg-new-hero-continer .s-hero__in')) {
              var HeroContent = document.querySelector('.s-hero__in');
              document.querySelector('.eg-new-hero-continer').insertAdjacentElement('afterbegin', HeroContent);
          }

          if (!document.querySelector(" .eg-form-continer .s-startup__form-wrap")) {
              var OldForm = document.querySelector(".s-startup__form-wrap");
              document.querySelector('.eg-form-continer').insertAdjacentElement('afterbegin', OldForm);
          }
      }

      function WhyLunchpad() {
          // if(!document.querySelector(".eg-new-hero-continer .s-hero__btn-wrap")){
          var WhyLunchpadCTA = document.querySelector(".s-hero__btn-wrap");
          document.querySelector(' .s-hero__in >.s-hero__text').insertAdjacentElement('afterend', WhyLunchpadCTA);
          // }
      }

      function initdesktop() {
          if (debug) {
              console.log('Inside init Function');

          }
          if (!document.querySelector('.eg-new-hero-continer')) {
              document.querySelector('.s-hero__desc').insertAdjacentHTML('beforebegin', NewForm);
          }

          waitForElement(".eg-new-hero-continer ", EgForm, 50, 15000);
          waitForElement(".eg-new-hero-continer .s-hero__text", WhyLunchpad, 50, 15000);
          waitForElement(".s-hero__desc", initForm, 50, 15000);

          if (window.location.pathname == "/launchpad/thank-you") {
              window.scrollTo(0, 0);
          }

      }

      function FormRelocation() {
          // var EGForm = document.querySelector(".help-your-startup").offsetHeight;
          var EGForm =window.pageYOffset  + document.querySelector(".l-section.s-startup .s-success-stories ").getBoundingClientRect().top;
          window.addEventListener("scroll", function() {
              if (window.scrollY < EGForm) {
                  if (!document.querySelector(" .eg-form-continer .s-startup__form-wrap")) {
                      var OldForm = document.querySelector(".s-startup__form-wrap");
                      document.querySelector('.eg-form-continer').insertAdjacentElement('afterbegin', OldForm);
                  }
              } else if (window.scrollY > EGForm) {
                  if (!document.querySelector(" .s-startup__form-row .s-startup__form-wrap")) {
                      var OldForm = document.querySelector(".s-startup__form-wrap");
                      document.querySelector('.s-startup__form-row ').insertAdjacentElement('afterbegin', OldForm);
                  }
              }

          })

      }


      waitForElement(".s-hero__desc", initdesktop, 50, 15000);
      waitForElement(".s-startup__form-row .s-startup__form-wrap", FormRelocation, 50, 25000);

  } catch (e) {
      if (debug) console.log(e, "error in Test" + variation_name);
  }
})();