Skip to content

Instantly share code, notes, and snippets.

@joesavage
Created August 9, 2014 12:52
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save joesavage/84670a2f8ab46a833ed5 to your computer and use it in GitHub Desktop.
HTTPPlaysPokemon Controls
<html>
<head>
<style>
html { text-align: center; }
body { background: #222; display: inline-block; }
kbd, .kbd {
cursor: pointer;
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
width: .8em;
text-align: center;
background-color: #f7f7f7;
border: 1px solid #ccc;
border-radius: 3px;
box-shadow: 0 1px 0 rgba(0,0,0,0.2), 0 0 0 2px #fff inset;
display: inline-block;
padding: 0.3em 0.6em;
margin: .15em;
text-shadow: 0 1px 0 #fff;
text-transform: uppercase;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
kbd.longer { width: auto; }
div {
display: inline-block;
vertical-align: middle;
margin: 1em;
}
</style>
</head>
<body>
<div>
<object type="application/x-shockwave-flash" height="378" width="620" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=httpplayspokemon" bgcolor="#000000"><param name="allowFullScreen" value="true" /><param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" /><param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" /><param name="flashvars" value="hostname=www.twitch.tv&channel=httpplayspokemon&auto_play=true&start_volume=25" /></object>
</div>
<br/>
<div>
<kbd data-button="a">A</kbd>
<kbd data-button="b">B</kbd>
</div>
<div>
<kbd data-button="up" style="margin-left: .4em;">&uarr;</kbd>
<br/>
<kbd data-button="left">&larr;</kbd>
<kbd data-button="down">&darr;</kbd>
<kbd data-button="right">&rarr;</kbd>
</div>
<div>
<kbd data-button="start" class="longer">Start</kbd>
<kbd data-button="select" class="longer">Select</kbd>
</div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
var sendButtonCommand = function(button) {
$.ajax({
type: "POST",
url: "http://httppp.ngrok.com/api/v1/moves/" + button,
data: ""
});
};
$('kbd').click(function(e){
sendButtonCommand($(this).data("button"));
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment