SHARE
TWEET

Untitled

social1986 Jan 24th, 2019 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve() {
  2.     let buttons = document.getElementsByTagName('button');
  3.     let nextBtn = buttons[0];
  4.     nextBtn.addEventListener('click', nextEvent);
  5.     let cancelButton = buttons[1];
  6.     cancelButton.addEventListener('click', cancelEvent);
  7.     let currentStep = -1;
  8.     let steps = document.getElementById('content').children;
  9.  
  10.     function nextEvent () {
  11.      
  12.         document.getElementById('content').style.backgroundImage = 'none';
  13.        
  14.         if (currentStep === 0) {
  15.             let disagreeBtn = document.getElementById('firstStep').getElementsByTagName('input')[1];
  16.  
  17.             if (disagreeBtn.checked) {
  18.                 return;
  19.             }
  20.  
  21.             nextBtn.style.display = 'none';
  22.  
  23.             setTimeout(() => {
  24.                 nextBtn.style.display = 'inline';
  25.             }, 3000)
  26.         }
  27.  
  28.         if (currentStep === 1) {
  29.             nextBtn.style.display = 'none';
  30.             cancelButton.textContent = 'Finish';
  31.         }
  32.  
  33.         if (currentStep !== -1) {
  34.             steps[currentStep].style.display = 'none';
  35.         }
  36.  
  37.         if (currentStep === 2) {
  38.         document.getElementById('exercise').getElementsByTagName('section')[0].style.display = 'none';            
  39.         }
  40.  
  41.         currentStep++;
  42.  
  43.         steps[(currentStep)].style.display = 'block';
  44.     }
  45.  
  46.     function cancelEvent () {
  47.         document.getElementById('exercise').getElementsByTagName('section')[0].style.display = 'none';
  48.     }
  49. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top