Commits

Jason R. Coombs committed 3882d24

Initial work on a history of said phrases

  • Participants
  • Parent commits f59df75

Comments (0)

Files changed (1)

File controller.xhtml

 			});
 		}
 
-		function say_text() {
+		function say(text) {
 			$.ajax({
 				type: "POST",
 				url: "/speech",
-				data: $("#say_text")[0].value,
+				data: text,
 				contentType: 'application/json'
 			});
+		}
+
+		function say_text() {
+			var text = $("#say_text")[0].value;
+			say(text);
 			$("#say_text")[0].value = '';
 			$("#say_text")[0].focus();
+
+			// save a link to that text
+			var link = $('<a>', {
+				'href': '#',
+				'text': text,
+			})
+			$("#say_history").append(link);
+			link.live('click', function() {
+				say(text);
+				return false;
+			});
 		}
 
 	]]></script>
 		<form id="say_form" onsubmit="return false">
 			<input type="text" id="say_text" />
 		</form>
+		<div id="say_history">
+		</div>
 	</div>
 
 	<!-- Le javascript