<commit_before>//Created by:
//<NAME>

//Last update:
//2016-11-05

var loginForm = document.getElementById('loginPage');
var regForm = document.getElementById('registerPage');
var lostForm = document.getElementById('lostPasswordPage');

// Get the button
var btn = document.getElementById("registerButton");
var cnclBtn = document.getElementById("cnclBtn");
var cnclBtn2 = document.getElementById("cnclBtn2");
var lostLink = document.getElementById("lostLink");

// When the user clicks the button
btn.onclick = function() {
    loginForm.reset();

    fadeIn(regForm);
    fadeOut(loginForm);
}

lostLink.onclick = function() {
    loginForm.reset();
    fadeOut(loginForm);
    fadeIn(lostForm);
}


// When the user clicks the button
cnclBtn.onclick = function() {
    fadeIn(loginForm);
    fadeOut(regForm);
    regForm.reset();
}

// When the user clicks the button
cnclBtn2.onclick = function() {
    fadeIn(loginForm);
    fadeOut(lostForm);
    lostForm.reset();
}
//------------------------------------modal-------------------------------------

// fade out

function fadeOut(el){
  el.style.opacity = 1;

  (function fade() {
    if ((el.style.opacity -= .1) < 0) {
      el.style.display = "none";
    } else {
      requestAnimationFrame(fade);
    }
  })();
}

// fade in

function fadeIn(el, display){
  el.style.opacity = 0;
  el.style.display = display || "block";

  (function fade() {
    var val = parseFloat(el.style.opacity);
    if (!((val += .1) > 1)) {
      el.style.opacity = val;
      requestAnimationFrame(fade);
    }
  })();
}

//------------------------------------modal-------------------------------------

var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("modalBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}


//window.RegisterForm = RegisterForm;

//--------------------------------error handling--------------------------------
var urlVars = window.location.search.toLowerCase().substr(1).split("&");
var err = false, type = "";<commit_msg>fixed comments, and som namings in loginScript<commit_after>//Created by:
//<NAME>

//Last update:
//2016-19-05

//-----------------------showing/hiding forms-------------------------

//get the forms
var loginForm = document.getElementById('loginPage');
var regForm = document.getElementById('registerPage');
var lostForm = document.getElementById('lostPasswordPage');

// Get the buttons
var regBtn = document.getElementById("registerButton");
var cnclBtn = document.getElementById("cnclBtn");
var cnclBtn2 = document.getElementById("cnclBtn2");
var lostLink = document.getElementById("lostLink");

// When the user clicks the reg button
regBtn.onclick = function() {
    loginForm.reset();

    fadeIn(regForm);
    fadeOut(loginForm);
}

// When the user clicks the lost password link
lostLink.onclick = function() {
    loginForm.reset();
    fadeOut(loginForm);
    fadeIn(lostForm);
}


// When the user clicks the cancel button
cnclBtn.onclick = function() {
    fadeIn(loginForm);
    fadeOut(regForm);
    regForm.reset();
}

// When the user clicks the cancel button
cnclBtn2.onclick = function() {
    fadeIn(loginForm);
    fadeOut(lostForm);
    lostForm.reset();
}
//------------------------------------animation-------------------------------------

// fade out

function fadeOut(el){
  el.style.opacity = 1;

  (function fade() {
    if ((el.style.opacity -= .1) < 0) {
      el.style.display = "none";
    } else {
      requestAnimationFrame(fade);
    }
  })();
}

// fade in

function fadeIn(el, display){
  el.style.opacity = 0;
  el.style.display = display || "block";

  (function fade() {
    var val = parseFloat(el.style.opacity);
    if (!((val += .1) > 1)) {
      el.style.opacity = val;
      requestAnimationFrame(fade);
    }
  })();
}

//------------------------------------modal-------------------------------------

//get the modal
var modal = document.getElementById('myModal');

// Get the button that opens the modal
var btn = document.getElementById("modalBtn");

// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];

// When the user clicks the button, open the modal 
btn.onclick = function() {
    modal.style.display = "block";
}

// When the user clicks on (x), close the modal
span.onclick = function() {
    modal.style.display = "none";
}

// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
    if (event.target == modal) {
        modal.style.display = "none";
    }
}

//--------------------------------error handling--------------------------------
var urlVars = window.location.search.toLowerCase().substr(1).split("&");
var err = false, type = "";
{'fraction_non_alphanumeric': 0.2244976076555024, 'fraction_numerical': 0.007272727272727273, 'mean_word_length': 2.4313854235062378, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3303989', 'n_tokens_mistral': 1541, 'n_tokens_neox': 1490, 'n_words': 397}