/**
 * Created by luisr on 08/04/17.
 */
export default function() {
  // Counter variable
  var i=0;
  // Seconds to wait for submit
  var t=3;

  var timInt;

  var timOut;

  // Counter element that displays t
  var counter = document.getElementsByClassName("evo_c-safety__count")[0]

  // Alert element
  var alert = document.getElementsByClassName("evo_c-safety__alert")[0];

  alert.style.visibility = "hidden";

  function hold() {
    timInt = window.setInterval(showTime,1000);
    timOut = window.setTimeout(submitSafety,4000);
    alert.style.visibility = "hidden";
  }

  function release(){
    if (timOut) window.clearTimeout(timOut);
    window.clearInterval(timInt);
    i=0;
    t=3;
  }

  function showTime(){
    if(t==0){
      window.clearInterval(timInt);
      counter.innerHTML= "Go";
      t=3;
    }else{
      counter.innerHTML=t;
      t--;
    }
  }

  function submitSafety() {
    alert.style.visibility = "initial";
  }

  var safety = document.getElementsByClassName("evo_c-safety")[0];
  safety.addEventListener("mousedown", hold);
  document.body.addEventListener("mouseup", release);
}

@@ -374,16 +374,53 @@
 %22)%5B0%5D;%0A%0A
+  // Security check%0A  if (alert) %7B%0A  
   alert.
@@ -447,16 +447,20 @@
 hidden%22;
+%0A  %7D
 %0A%0A  func
@@ -1056,16 +1056,26 @@
 %22)%5B0%5D;%0A 
+ safety &&
  safety.

Add safety execution