Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (48 sloc) 2.85 KB
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8"/>
<link rel="stylesheet" type="text/css" href="bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand">Twilio Madlibs</a>
</div>
</div>
<div class="container">
<div class="hero-unit">
<span class="machine-input">There was once a young prince whose name was Devon Peticolas. He loved to </span><strong><span class="verb unfilled">Verb</span></strong><span class="machine-input"> and</span><strong><span class="verb unfilled">Verb</span></strong><span class="machine-input"> all day. One day a(n)</span><strong><span class="adjective unfilled"> Adjective </span></strong><strong><span class="noun unfilled"> Noun </span></strong><span class="machine-input"> came to visit the castle. This </span><strong><span class="noun unfilled">Noun</span></strong><span class="machine-input">brought seventy-two different types of hackathon projects with them to share. Devon decided that he wanted to spend time with the visitors and offer them some awesome prizes. The visitor told the prince he had a gift for him. This gift was made out of</span><strong><span class="adjective unfilled"> Adjective </span></strong><strong><span class="noun unfilled"> Noun </span></strong><span class="machine-input">, and he was told that it would make him</span><strong><span class="adjective unfilled"> Adjective </span></strong><span class="machine-input">Devon took the gift, and when he woke the next morning he found that his</span><strong><span class="noun unfilled"> Noun </span></strong><span class="machine-input">was filled with</span><strong><span class="adjective unfilled"> Adjective </span></strong><span class="machine-input">computers.</span><span><strong>The end</strong></span>
</div>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket = io.connect();
socket.on("message", function(data){
console.dir(data);
var partsOfSpeech = data.partsOfSpeech;
if(partsOfSpeech != undefined){
for(var i = 0; i<partsOfSpeech.length; i++){
var unfilledObj = $("."+partsOfSpeech[i] + ".unfilled:first");
console.log(unfilledObj);
if(unfilledObj.length > 0){
unfilledObj.hide(250);
unfilledObj.text(" " + data.word + " ");
unfilledObj.show(250);
unfilledObj.css("display", "");
unfilledObj.removeClass("unfilled");
break;
}
}}
if($(".unfilled").length === 0){
console.log("into the no length statement");
$(".machine-input").animate({opacity: 1}, 350);
socket.emit('completed', {message: jQuery.trim($(".hero-unit").text())});
console.log("emitted a completed message");
}
});
</script>
</html>