Skip to content

Instantly share code, notes, and snippets.

@timothyclemans
Created February 11, 2014 18:28
Show Gist options
  • Save timothyclemans/8940966 to your computer and use it in GitHub Desktop.
Save timothyclemans/8940966 to your computer and use it in GitHub Desktop.
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<head>
<link href='https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700' rel='stylesheet' type='text/css'>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<!--<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>-->
<style>
/* recover from old-browser styling */
.oldbl {display: block !important;}
.oldin {display: inline !important;}
img.pic {display: block !important;}
.ahem, .skipper, #aboutsite, #aboutsite * {display: none !important;}
/* NS6.x-specific fix(es) */
*|*:-moz-list-bullet, *|*:-moz-list-number {font-size: 1em;}
/* IE image scaling fix */
img {-ms-interpolation-mode: bicubic;}
/* misc */
#present {z-index: 100000 !important;}
/*
http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, code,
del, dfn, img, ins, kbd, q, s, samp,
small, strike, 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;
font-family:Roboto;
font-weight:100;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
h1 {font-size:30px; padding:10px; font-weight:300;background:#000;border-bottom:1px solid #FFF;}
li {font-size:30px; border-bottom:1px solid #FFF;padding:10px;}
.current {background:red;font-size:50px;}
</style>
</head>
<body style="background:#000; color:#FFF; width:100%; height:100%; overflow:hidden; margin:0">
<h1>My to-do list while at work</h1>
<ul>
<li id="todo_1" class="current">1. <span>Say hi to coworkers</span></li>
<li id="todo_2">2. <span>Turn on the lights</span></li>
<li id="todo_3">3. <span>Plug in your electronics</span></li>
<li id="todo_4">4. <span>Throw away the trash</span></li>
<li id="todo_5">5. <span>Scan in the receipts</span></li>
<li id="todo_6">6. <span>Read "Total Recall"</span></li>
<li id="todo_7">7. <span>Bake a cake</span></li>
<li id="todo_8">8. <span>Bake a cake</span></li>
<li id="todo_9">9. <span>Bake a cake</span></li>
<li id="todo_10">10. <span>Bake a cake</span></li>
<li id="todo_11">11. <span>Bake a cake</span></li>
</ul>
<script>
var current_todo = 1;
var h1height = 0;
function onGesture(name) {
if (name == 'TAP') {
$('#todo_'+current_todo).removeClass('current');
if (current_todo == $('li').length) {
WS.say('You are finished with your to-do list for work');
} else {
current_todo += 1;
$('#todo_'+current_todo).addClass('current');
var offset = $('#todo_'+current_todo).offset();
//WS.say('offset: '+offset.top);
var top = 360 - (offset.top + $('#todo_'+current_todo).height() + 20);
//WS.say(top);
if (top < 0) {
$('ul').css({top:top+'px', position:'absolute', left:0, width:'100%'});
}
WS.say('Now '+$('#todo_'+current_todo+' span').text()+' and then tap the touchpad with one finger');
}
}
}
function server() {
WS.say('Welcome to work. The first item on your to do list is to '+$('#todo_1 span').text()+' and then tap the touchpad with one finger');
WS.log('Welcome to WearScript');
WS.dataLog(false, true, .15);
h1height = $('h1').height();
$('h1').css({height: h1height+'px', position:'absolute', top:0, left:0, width:'620px', 'z-index':2});
var top = h1height + 20;
$('ul').css({top:top+'px', position:'absolute', left:0, width:'100%', 'z-index': 1});
var gestures = ['onGesture'];
for (var i = 0; i < gestures.length; i++)
WS.gestureCallback(gestures[i], gestures[i]);
WS.liveCardCreate(false, .2);
}
function main() {
console.log('test');
WS.serverConnect('{{WSUrl}}', 'server');
}
window.onload = main;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment