Sha256: da9ed71e372cbc0cc9747640bd54266acf8e6fa2d26db55363b25e78dca55fb1

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

<script type="text/javascript">

  let response = new URL(window.location.href).searchParams.has("response");
  document.getElementById(response ? 'form-request' : 'form-response').classList.add("d-none");
  document.getElementById(response ? 'progressive-progress-navbar' : 'form-response').classList.add("d-none");

  statusText = document.getElementById('progress-bar-status');
  formInputs = document.querySelectorAll("[required]");
  progressBar = document.getElementById('progressive-progress-bar');

  progressBar.style.width = "1%";
  progressBar.innerHTML = "1%";
  statusText.innerHTML = "1%";

  for (var i = 0; i < formInputs.length; i++) {
    formInputs[i].addEventListener("input", updateProgressBar);
  }

  function updateProgressBar() {
    progressBar.value = 0;
    for (var i = 0; i < formInputs.length; i++) {
      if ( formInputs[i].value != '' ){
        progressBar.value += 100/formInputs.length;
      }
    }
    progressBar.style.width = progressBar.value + "%";
    progressBar.innerHTML = Math.round(progressBar.value) + "%";
    statusText.innerHTML = Math.round(progressBar.value) + "%";
  }

</script>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jekyll-theme-marketing-1.0.1 _includes/components/forms/google-forms.js
jekyll-theme-marketing-1.0.0 _includes/components/forms/google-forms.js