Download script.js from bercovasile/credential-lifecycle-tracker: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/spaces/bercovasile/credential-lifecycle-tracker/resolve/main/script.js
- Command line
-
hf download hf://spaces/bercovasile/credential-lifecycle-tracker/script.js
-
curl -L -o script.js https://huggingface.co/spaces/bercovasile/credential-lifecycle-tracker/resolve/main/script.js
1.48 kB
| document.addEventListener('DOMContentLoaded', function() { | |
| const termsContainer = document.querySelector('.terms-container'); | |
| const checkbox = document.getElementById('agree-checkbox'); | |
| const continueBtn = document.getElementById('continue-btn'); | |
| const endOfTerms = document.getElementById('end-of-terms'); | |
| // Check if user has scrolled to the bottom | |
| termsContainer.addEventListener('scroll', function() { | |
| const scrollPosition = termsContainer.scrollTop + termsContainer.clientHeight; | |
| const scrollHeight = termsContainer.scrollHeight; | |
| // If scrolled to bottom (with 50px tolerance), enable checkbox | |
| if (scrollPosition >= scrollHeight - 50) { | |
| checkbox.disabled = false; | |
| } else { | |
| checkbox.disabled = true; | |
| checkbox.checked = false; | |
| continueBtn.disabled = true; | |
| } | |
| }); | |
| // Enable continue button when checkbox is checked | |
| checkbox.addEventListener('change', function() { | |
| continueBtn.disabled = !this.checked; | |
| }); | |
| // Continue button functionality | |
| continueBtn.addEventListener('click', function() { | |
| if (!this.disabled) { | |
| alert('Thank you for accepting our Terms & Conditions!'); | |
| // Here you would typically redirect to the next page | |
| // window.location.href = '/next-page'; | |
| } | |
| }); | |
| // Initial state | |
| checkbox.disabled = true; | |
| continueBtn.disabled = true; | |
| }); |