Created
February 11, 2014 00:10
-
-
Save timothyclemans/8926870 to your computer and use it in GitHub Desktop.
[wearscript]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html style="width:100%; height:100%; overflow:hidden"> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<head> | |
<style> | |
p { | |
font-size:40px; | |
color:#FFF; | |
} | |
</style> | |
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>--> | |
</head> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0; background:#000;"> | |
<p></p> | |
<img src="" /> | |
<script> | |
var correct = 0; | |
var questions = [['http://www.evolve-research.com/~evolv10/sites/default/files/imce/lie.png', 'grief'], ['http://2.bp.blogspot.com/-xQTUiiT3pm0/T60DOqEAoII/AAAAAAAAUao/NBsa4qXuxpY/s640/Disgust_Negus.jpg', 'shame']]; | |
var i = 0; | |
function processAnswer(data) { | |
if (data == questions[i][1]) { | |
correct += 1; | |
} | |
i += 1; | |
showQuestion(); | |
} | |
function showQuestion() { | |
WS.log(i+' '+questions.length); | |
WS.say(i+' '+questions.length); | |
if (i == questions.length) { | |
$('img').remove(); | |
var percentage = Math.floor((correct/questions.length) * 100); | |
$('p').text(percentage+'% '+'('+correct+'/'+questions.length+')'); | |
} else { | |
$('img').attr('src', questions[i][0]); | |
setTimeout(function(){WS.speechRecognize('What microexpression is that?', 'processAnswer')}, 3000); | |
} | |
} | |
function server() { | |
WS.dataLog(false, true, .15); | |
} | |
function main() { | |
WS.serverConnect('{{WSUrl}}', 'server'); | |
WS.wake(); | |
WS.activityCreate(); | |
if (WS.scriptVersion(1)) return; | |
showQuestion(); | |
} | |
window.onload = main; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment