-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
103 lines (96 loc) · 5.14 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta charset="utf-8">
<title>ctrl.js Overview</title>
<meta name="description" content="A quick overview of ctrl.js: Your phone as a controller for your browser">
<meta name="author" content="zalo">
<!-- Mobile Specific Metas
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="src/normalize.css">
<link rel="stylesheet" href="src/skeleton.css">
<!-- Favicon
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="icon" type="image/png" href="images/favicon.png">
<script type="text/javascript">
let curSearchParams = new URLSearchParams(window.location.search);
if (curSearchParams.has("i")) {
window.location.assign("https://zalo.github.io/ctrl.js/ctrl.html?i="+curSearchParams.get("i"));
}
</script>
<script type="text/javascript" src="https://zalo.github.io/ctrl.js/bookmarklet.js"></script>
</head>
<body>
<!-- Primary Page Layout
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="container">
<div class="row">
<div class="column" style="margin-top: 2.5%">
<h1><a id="ctrljs"></a>ctrl.js</h1>
<p>ctrl.js is a bookmarklet that allows you and your friends to connect your phones to the browser to play HTML5 games.<br>
<h5><a id="Instructions"></a>Instructions</h5>
<p>Simply activate <a href="javascript:{var s=document.createElement('script');s.src='https://zalo.github.io/ctrl.js/bookmarklet.js',document.body.appendChild(s);};void(0);">the bookmarklet</a> and scan the QR Code with your phone’s default camera app to connect.</p>
<h5><a id="How_it_works"></a>How it works</h5>
<p>The QR Code contains a link to the peer.js session running in the bookmarklet, allowing it to find your browser and form P2P connection</p>
<p>Events on the phone will then inject themselves as spoofed Keyboard <code>KeyEvents</code> into the body of the web page you are on.</p>
<h5><a id="Keymappings"></a>Keymappings</h5>
<table class="u">
<thead>
<tr>
<th>Controller Button</th>
<th>Keypress</th>
</tr>
</thead>
<tbody>
<tr>
<td>Up</td>
<td><code>w</code></td>
</tr>
<tr>
<td>Left</td>
<td><code>a</code></td>
</tr>
<tr>
<td>Down</td>
<td><code>s</code></td>
</tr>
<tr>
<td>Right</td>
<td><code>d</code></td>
</tr>
<tr>
<td>A</td>
<td><code>Space</code></td>
</tr>
<tr>
<td>B</td>
<td><code>Shift</code></td>
</tr>
<tr>
<td>Start</td>
<td><code>Enter</code></td>
</tr>
</tbody>
</table>
<p>These keymappings can be changed by clicking on the player's name above the QR Code, and are stored locally on a per-page basis.</p>
<h5><a id="Open_Source" href="https://github.com/zalo/ctrl.js"></a>Open Source</h5>
<p><a href="https://github.com/zalo/ctrl.js">The source code to ctrl.js is available under the MIT License at Github.</a></p>
<h5><a id="Credits" href=""></a>Credits</h5>
<p>ctrl.js is based on <a href="https://peerjs.com/">peer.js</a>, <a href="https://github.com/davidshimjs/qrcodejs/">qrcode.js</a>, <a href="https://threejs.org/">three.js</a>, and <a href="http://getskeleton.com/">Skeleton.css</a>.</p>
<h5><a id="Debug_Event_Stream"></a>Raw Events</h5>
<pre class="code-example"><code class="code-example-body prettyprint" id="ctrlJsEvents">ctrl.js Events will appear here upon connection.</code></pre>
</div>
</div>
</div>
<!-- End Document
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
</body>
</html>