// Generated by CoffeeScript 1.9.3
(function() {
  $(function() {
    var pressedEnter, random_question, startUp, update_question, words;
    this.current = "";
    this.context = this;
    $("#question, #answer").hide();
    words = $.getJSON("spellings.json");
    $.when(words).done((function(d) {
      return startUp(d);
    }));
    $.when(words).fail(function(data, status, error) {
      console.log(status + error);
    });
    startUp = function(data) {
      $("#question, #answer").show();
      update_question(data);
      return this.data = data;
    };
    random_question = function(data) {
      var choice;
      choice = Math.floor(Math.random() * data['words'].length);
      this.current = choice;
      return data['words'][choice];
    };
    update_question = function(data) {
      var word;
      word = random_question(data);
      return $("p#hint").empty().append(word['hint']);
    };
    return pressedEnter = function(e) {
      var attempt;
      if (e.which === 13) {
        attempt = $("#input_answer").val();
        if (attempt.toLowerCase() === this.choice.toLowerCase()) {
          return alert("SUCCESS!");
        } else {
          return alert("FAIL!");
        }
      }
    };
  });

}).call(this);

@@ -70,22 +70,8 @@
  var
- pressedEnter,
  ran
@@ -92,16 +92,35 @@
 startUp,
+ update_keyHandler,
  update_
@@ -163,33 +163,8 @@
 %22%22;%0A
-    this.context = this;%0A
     
@@ -685,22 +685,45 @@
 rrent = 
-choice
+data%5B'words'%5D%5Bchoice%5D%5B'name'%5D
 ;%0A      
@@ -842,32 +842,59 @@
 question(data);%0A
+      update_keyHandler();%0A
       return $(%22
@@ -954,22 +954,114 @@
 urn 
-pressedEnter =
+update_keyHandler = function() %7B%0A      return $(%22#input_answer%22).keydown((function(_this) %7B%0A        return
  fun
@@ -1067,24 +1067,28 @@
 nction(e) %7B%0A
+    
       var at
@@ -1096,24 +1096,28 @@
 empt;%0A      
+    
 if (e.which 
@@ -1134,16 +1134,20 @@
         
+ 
+   
 attempt 
@@ -1178,24 +1178,28 @@
 ();%0A        
+    
 if (attempt.
@@ -1220,19 +1220,21 @@
 === 
+_
 this.c
-hoice
+urrent
 .toL
@@ -1243,24 +1243,28 @@
 erCase()) %7B%0A
+    
           re
@@ -1295,16 +1295,20 @@
         
+ 
+   
 %7D else %7B
@@ -1308,16 +1308,20 @@
  else %7B%0A
+    
         
@@ -1357,17 +1357,53 @@
     
-%7D%0A  
     %7D
+%0A          %7D%0A        %7D;%0A      %7D)(this));
 %0A   

update output