Skip to content

Instantly share code, notes, and snippets.

@timothyclemans
Last active August 29, 2015 13:56
Show Gist options
  • Save timothyclemans/9182210 to your computer and use it in GitHub Desktop.
Save timothyclemans/9182210 to your computer and use it in GitHub Desktop.
[wearscript] A tool for learning to talk concisely in a conversation
<!--{"r":"fqtn66CAYt9g5XATyDm59iFD2lRRkjmpfA0v09hZe04=","s":"ZGa3RCqfvD45QyG+vo8tJScvjePe9WxEKVH+ObJxzIs=","v":0,"h":"https://api.picar.us/wearscript"}-->
<!--https://plus.google.com/100378621884093522327-->
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700' rel='stylesheet' type='text/css'>
<style>
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
background:#000;
color:#FFF;
font:50px Roboto;
font-weight:100;
margin:40px;
}
p {
bottom:40px; left:40px;
width:560px;
text-align:center;
position:absolute;
}
</style>
</head>
<body>
<p>Regulate conversational talking by tapping</p>
<script>
var c=0;
var t;
var timer_is_on=0;
function timedCount()
{ $('p').text(''); if (c < 40) {
secondsLeft = 40 - c;
if (secondsLeft == 30) {
WS.say('30 seconds left');
}
if (secondsLeft == 10) {
WS.say('10 seconds left');
}
if (secondsLeft == 5) {
WS.say('5 seconds left');
}
$('p').text(secondsLeft + ' seconds left');
} else if (c > 40) {
$('p').text('Stop talking');
}
if (c < 20) {
$('body').css('background', 'green');
$('body').css('color', '#FFF');
} else if (c < 40) {
if (c == 20) { WS.say('wrap up'); }
$('body').css('background', 'yellow');
$('body').css('color', '#000');
} else {
if (c % 2 == 0) { WS.say('stop talking'); } // every 2 seconds say "stop talking"
$('body').css('background', 'red');
$('body').css('color', '#FFF');
}
c=c+1;
t=setTimeout("timedCount()",1000);
}
function doTimer()
{
if (!timer_is_on)
{
timer_is_on=1;
timedCount();
}
}
function stopCount()
{
$('body').css('background', 'black');
$('p').text('Regulate conversational talking by tapping');
clearTimeout(t);
c = 0;
timer_is_on=0;
}
function onGesture(name) {
if (name == 'TAP' || name == 'WINK') {
if (timer_is_on == 0) {
doTimer();
} else {
stopCount();
}
}
}
document.onkeypress = function (e) {
var char = String.fromCharCode(e.which);
if (char == 'c') {
if (timer_is_on == 0) {
doTimer();
} else {
stopCount();
}
}
}
function server() {
WS.dataLog(false, true, .15);
}
$(function() {
WS.activityCreate();
WS.liveCardCreate(false, .2);
setInterval(function () { WS.wake(); }, 1000);
WS.gestureCallback('onGesture', 'onGesture');
WS.gestureCallback('onEyeGesture', 'onGesture');
WS.serverConnect('{{WSUrl}}', 'server');
});
</script>
</body>
</html>
{
"name": "Regulate Conversational Talking"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment