Skip to content

Instantly share code, notes, and snippets.

@kevint2u
Last active August 29, 2015 14:10
Show Gist options
  • Save kevint2u/f6c27f6d6ac8cf56545f to your computer and use it in GitHub Desktop.
Save kevint2u/f6c27f6d6ac8cf56545f to your computer and use it in GitHub Desktop.
[wearscript] insight-app-test
<!-- WearScript on Glass/Android -->
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>
function main() {
if (WS.scriptVersion(1)) return;
var localIP = "192.168.0.17";
var port = "5000";
var customEndpoint = "ws://" + localIP + ":" + port ; // + "/google-glass.jpg";
//WS.say('begin');
WS.serverConnect(customEndpoint, function () {
//WS.say('connected');
//var imgURL = "image.jpg";
var imgURL = "http://the-gadgeteer.com/wp-content/uploads/2014/01/google-glass.jpg";
$.ajax({
type: "GET",
url: imgURL,
crossDomain:true,
success: function(img) {
//WS.say(success);
$("#target").hide();
$("#img-targ").attr("src", "data:image/png;base64," + img);
// $("#img-targ").attr("src", "http://the-gadgeteer.com/wp-content/uploads/2014/01/google-glass.jpg");
WS.say('hi');
},
error: function(error, txtStatus) {
WS.say(txtStatus);
}
});
});
}
window.onload = main;
</script>
<style>
#target{
color:white;
font-size: 50px;
text-align: center;
line-height: 360px;
}
#img-targ{
}
</style>
<div id="target">Welcome to In-sight</div>
<img id="img-targ" src="/image.jpg"/>
</body>
</html>
{
"name": "Card Tree Example"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment