forked from awkward/peertalk
-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
414 lines (399 loc) · 15.1 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>PeerTalk</title>
<meta name="viewport" content="width=880">
<meta property="fb:admins" content="728642302">
<meta name="description" content="iOS and OS X Cocoa library for communicating over USB and TCP.">
<meta property="og:image" content="http://rsms.me/uilayer/examples/icon.png">
<meta property="og:site_name" content="rsms.me">
<script>
window.gFetchTS = new Date;
gFetchTS = gFetchTS.getFullYear()+'-'+gFetchTS.getMonth()+'-'+gFetchTS.getDate()+'-'+gFetchTS.getHours();
var Showdown = {converter:function() {
function n(a, b) {
var b = o(b), c = "<h" + a;
if(typeof p.anchorPrefix === "string") {
var d = p.anchorPrefix + b.toLowerCase().replace(D, "-").replace(/\-+/g, "-");
c += ' id="' + d + '">';
c += p.anchorLinks ? '<a href="#' + d + '">' + b + "</a>" : b
}else {
c += ">" + b
}
c += "</h" + a + ">";
return l(c)
}
var i, j, m, q = 0, p = this;
this.anchorPrefix = "";
this.anchorLinks = true;
this.makeHtml = function(a) {
i = [];
j = [];
m = [];
a = a.replace(/~/g, "~T");
a = a.replace(/\$/g, "~D");
a = a.replace(/\r\n/g, "\n");
a = a.replace(/\r/g, "\n");
a = w("\n\n" + a + "\n\n");
a = a.replace(/^[ \t]+$/mg, "");
a = x(a);
a = E(a);
a = r(a);
a = y(a);
a = a.replace(/~D/g, "$$");
a = a.replace(/~T/g, "~");
a = a.replace(/--/g, "—");
return a = a.replace(/[a-z0-9_\-+=.]+@[a-z0-9\-]+(\.[a-z0-9-]+)+/ig, function(a) {
return"<a href='mailto:" + a + "'>" + a + "</a>"
})
};
var E = function(a) {
return a = a.replace(/^[ ]{0,3}\[(.+)\]:[ \t]*\n?[ \t]*<?(\S+?)>?[ \t]*\n?[ \t]*(?:(\n*)["(](.+?)[")][ \t]*)?(?:\n+|\Z)/gm, function(a, c, d, e, g) {
c = c.toLowerCase();
i[c] = z(d);
if(e) {
return e + g
}else {
g && (j[c] = g.replace(/"/g, """))
}
return""
})
}, x = function(a) {
a = a.replace(/\n/g, "\n\n");
a = a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\b[^\r]*?\n<\/\2>[ \t]*(?=\n+))/gm, h);
a = a.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\b[^\r]*?.*<\/\2>[ \t]*(?=\n+)\n)/gm, h);
a = a.replace(/(\n[ ]{0,3}(<(hr)\b([^<>])*?\/?>)[ \t]*(?=\n{2,}))/g, h);
a = a.replace(/(\n\n[ ]{0,3}<!(--[^\r]*?--\s*)+>[ \t]*(?=\n{2,}))/g, h);
a = a.replace(/(?:\n\n)([ ]{0,3}(?:<([?%])[^\r]*?\2>)[ \t]*(?=\n{2,}))/g, h);
return a.replace(/\n\n/g, "\n")
}, h = function(a, b) {
var c;
c = b.replace(/\n\n/g, "\n");
c = c.replace(/^\n/, "");
c = c.replace(/\n+$/g, "");
return"\n\n~K" + (m.push(c) - 1) + "K\n\n"
}, r = function(a) {
for(var a = F(a), b = l("<hr />"), a = a.replace(/^[ ]{0,2}([ ]?\*[ ]?){3,}[ \t]*$/gm, b), a = a.replace(/^[ ]{0,2}([ ]?\-[ ]?){3,}[ \t]*$/gm, b), a = a.replace(/^[ ]{0,2}([ ]?\_[ ]?){3,}[ \t]*$/gm, b), a = A(a), a = G(a), a = H(a), a = a = x(a), a = a.replace(/^\n+/g, ""), a = a.replace(/\n+$/g, ""), c = a.split(/\n{2,}/g), a = [], b = c.length, d = 0;d < b;d++) {
var e = c[d];
e.search(/~K(\d+)K/g) >= 0 ? a.push(e) : e.search(/\S/) >= 0 && (e = o(e), e = e.replace(/^([ \t]*)/g, "<p>"), e += "</p>", a.push(e))
}
b = a.length;
for(d = 0;d < b;d++) {
for(;a[d].search(/~K(\d+)K/) >= 0;) {
c = m[RegExp.$1], c = c.replace(/\$/g, "$$$$"), a[d] = a[d].replace(/~K\d+K/, c)
}
}
return a.join("\n\n")
}, o = function(a) {
var e;
var d;
var c;
var b;
a = I(a);
a = a = J(a);
a = a.replace(/\\(\\)/g, s);
a = (b = a = a.replace(/\\([`*_{}\[\]()>#+-.!])/g, s), a = b);
a = a.replace(/(!\[(.*?)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, B);
a = (c = a = a.replace(/(!\[(.*?)\]\s?\([ \t]*()<?(\S+?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, B), a = c);
a = a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\][ ]?(?:\n[ ]*)?\[(.*?)\])()()()()/g, t);
a = a.replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()<?(.*?)>?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g, t);
d = a = a.replace(/(\[([^\[\]]+)\])()()()()()/g, t), a = d;
a = K(a);
a = a = z(a);
a = a.replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g, "<strong>$2</strong>");
a = a.replace(/(\w)_(\w)/g, "$1~E95E$2");
e = a = a.replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g, "<em>$2</em>"), a = e;
return a.replace(/ +\n/g, " <br />\n")
}, J = function(a) {
return a = a.replace(/(<[a-z\/!$]("[^"]*"|'[^']*'|[^'">])*>|<!(--.*?--\s*)+>)/gi, function(a) {
a = a.replace(/(.)<\/?code>(?=.)/g, "$1`");
return k(a, "\\`*_")
})
}, t = function(a, b, c, d, e, g, h, f) {
f == void 0 && (f = "");
a = d.toLowerCase();
if(e == "") {
if(a == "" && (a = c.toLowerCase().replace(/ ?\n/g, " ")), i[a] != void 0) {
e = i[a], j[a] != void 0 && (f = j[a])
}else {
if(b.search(/\(\s*\)$/m) > -1) {
e = ""
}else {
return b
}
}
}
e = k(e, "*_");
b = '<a href="' + e + '"';
f != "" && (f = f.replace(/"/g, """), f = k(f, "*_"), b += ' title="' + f + '"');
b += ">" + c + "</a>";
return b
}, B = function(a, b, c, d, e, g, h, f) {
a = c;
d = d.toLowerCase();
f || (f = "");
if(e == "") {
if(d == "" && (d = a.toLowerCase().replace(/ ?\n/g, " ")), i[d] != void 0) {
e = i[d], j[d] != void 0 && (f = j[d])
}else {
return b
}
}
a = a.replace(/"/g, """);
e = k(e, "*_");
b = '<img src="' + e + '" alt="' + a + '"';
f = f.replace(/"/g, """);
f = k(f, "*_");
b += ' title="' + f + '"';
b += " />";
return b
}, D = /[^a-zA-Z0-9_\.-]+/g, F = function(a) {
a = a.replace(/^(.+)[ \t]*\n=+[ \t]*\n+/gm, function(a, c) {
return n(1, c)
});
a = a.replace(/^(.+)[ \t]*\n-+[ \t]*\n+/gm, function(a, c) {
return n(2, c)
});
return a = a.replace(/^(\#{1,6})[ \t]*(.+?)[ \t]*\#*\n+/gm, function(a, c, d) {
return n(c.length, d)
})
}, u, A = function(a) {
a += "~0";
var b = /^(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/gm;
q ? a = a.replace(b, function(a, b, e) {
a = b;
e = e.search(/[*+-]/g) > -1 ? "ul" : "ol";
a = a.replace(/\n{2,}/g, "\n\n\n");
a = u(a);
a = a.replace(/\s+$/, "");
return"<" + e + ">" + a + "</" + e + ">\n"
}) : (b = /(\n\n|^\n?)(([ ]{0,3}([*+-]|\d+[.])[ \t]+)[^\r]+?(~0|\n{2,}(?=\S)(?![ \t]*(?:[*+-]|\d+[.])[ \t]+)))/g, a = a.replace(b, function(a, b, e, g) {
a = e;
g = g.search(/[*+-]/g) > -1 ? "ul" : "ol";
a = a.replace(/\n{2,}/g, "\n\n\n");
a = u(a);
return b + "<" + g + ">\n" + a + "</" + g + ">\n"
}));
return a = a.replace(/~0/, "")
};
u = function(a) {
q++;
a = a.replace(/\n{2,}$/, "\n");
a += "~0";
a = a.replace(/(\n)?(^[ \t]*)([*+-]|\d+[.])[ \t]+([^\r]+?(\n{1,2}))(?=\n*(~0|\2([*+-]|\d+[.])[ \t]+))/gm, function(a, c, d, e, g) {
a = g;
c || a.search(/\n{2,}/) > -1 ? a = r(v(a)) : (a = A(v(a)), a = a.replace(/\n$/, ""), a = o(a));
return"<li>" + a + "</li>\n"
});
a = a.replace(/~0/g, "");
q--;
return a
};
var G = function(a) {
a += "~0";
a = a.replace(/(?:\n\n|^)((?:(?:[ ]{4}|\t).*\n+)+)(\n*[ ]{0,3}[^ \t\n]|(?=~0))/g, function(a, c, d) {
a = C(v(c));
a = w(a);
a = a.replace(/^\n+/g, "");
a = a.replace(/\n+$/g, "");
return l("<pre><code>" + a + "\n</code></pre>") + d
});
return a = a.replace(/~0/, "")
}, l = function(a) {
a = a.replace(/(^\n+|\n+$)/g, "");
return"\n\n~K" + (m.push(a) - 1) + "K\n\n"
}, I = function(a) {
return a = a.replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm, function(a, c, d, e) {
a = e.replace(/^([ \t]*)/g, "");
a = a.replace(/[ \t]*$/g, "");
a = C(a);
return c + "<code>" + a + "</code>"
})
}, C = function(a) {
a = a.replace(/&/g, "&");
a = a.replace(/</g, "<");
a = a.replace(/>/g, ">");
return k(a, "*_{}[]\\", false)
}, H = function(a) {
return a = a.replace(/((^[ \t]*>[ \t]?.+\n(.+\n)*\n*)+)/gm, function(a, c) {
var d;
d = c.replace(/^[ \t]*>[ \t]?/gm, "~0");
d = d.replace(/~0/g, "");
d = d.replace(/^[ \t]+$/gm, "");
d = r(d);
d = d.replace(/(^|\n)/g, "$1 ");
d = d.replace(/(\s*<pre>[^\r]+?<\/pre>)/gm, function(a, c) {
var b;
b = c.replace(/^ /mg, "~0");
return b.replace(/~0/g, "")
});
return l("<blockquote>\n" + d + "\n</blockquote>")
})
}, z = function(a) {
a = a.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\w+);)/g, "&");
return a.replace(/<(?![a-z\/?\$!])/gi, "<")
}, K = function(a) {
a = a.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi, '<a href="$1">$1</a>');
return a = a.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, function(a, c) {
return L(y(c))
})
}, L = function(a) {
var b = [function(a) {
return"&#" + a.charCodeAt(0) + ";"
}, function(a) {
a = a.charCodeAt(0);
return"&#x" + ("0123456789ABCDEF".charAt(a >> 4) + "0123456789ABCDEF".charAt(a & 15)) + ";"
}, function(a) {
return a
}], a = ("mailto:" + a).replace(/./g, function(a) {
if(a == "@") {
a = b[Math.floor(Math.random() * 2)](a)
}else {
if(a != ":") {
var d = Math.random(), a = d > 0.9 ? b[2](a) : d > 0.45 ? b[1](a) : b[0](a)
}
}
return a
});
return a = ('<a href="' + a + '">' + a + "</a>").replace(/">.+:/g, '">')
}, y = function(a) {
return a = a.replace(/~E(\d+)E/g, function(a, c) {
var d = parseInt(c);
return String.fromCharCode(d)
})
}, v = function(a) {
a = a.replace(/^(\t|[ ]{1,4})/gm, "~0");
return a.replace(/~0/g, "")
}, w = function(a) {
a = a.replace(/\t(?=\t)/g, " ");
a = a.replace(/\t/g, "~A~B");
a = a.replace(/~B(.+?)~A/g, function(a, c) {
for(var d = c, e = 4 - d.length % 4, g = 0;g < e;g++) {
d += " "
}
return d
});
a = a.replace(/~A/g, " ");
return a = a.replace(/~B/g, "")
}, k = function(a, b, c) {
b = "([" + b.replace(/([\[\]\\])/g, "\\$1") + "])";
c && (b = "\\\\" + b);
return a.replace(RegExp(b, "g"), s)
}, s = function(a, b) {
return"~E" + b.charCodeAt(0) + "E"
}
}};
</script>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Droid+Sans+Mono:normal" type="text/css">
<link rel="stylesheet" href="etc/style.css" type="text/css">
</head>
<body>
<h1>PeerTalk</h1>
<div id="content">
</div>
<a href="http://github.com/rsms/peertalk" id="github-banner"><img src="https://a248.e.akamai.net/assets.github.com/img/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub"></a>
<footer>PeerTalk is free software and <a href="https://github.com/rsms/uilayer">open source</a>
under a <a href="LICENSE.txt" title="MIT license">permissive license</a>, created by <a href="http://rsms.me/">Rasmus Andersson</a>.
</footer>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
var content = document.getElementById('content');
// Synchronous request so that back/fwd in browsers retain scroll position, etc
$.ajax({
async: false,
url: 'README.md?'+gFetchTS,
error: function (a,b,c) {
console.error('Failed to load content:', a,b,c);
},
success: function (body) {
body = body.replace(/> Note: UILayer only works in WebKit-based environments.+/, 'NOTE_WEBKIT_COMPAT');
var html = (new Showdown.converter()).makeHtml(body);
html = html.replace(/<h1[^>]+>.+<\/h1>/, '');
html = html.replace(/<p>[\r\n.]*NOTE_WEBKIT_COMPAT[\r\n.]*<\/p>/m, '<blockquote id="webkit-compat-note"></blockquote>');
content.innerHTML = html;
if (typeof content.querySelectorAll === 'function') {
Array.prototype.slice.call(content.querySelectorAll('h3 > a')).forEach(function (el) {
if (el.innerHTML === el.innerText)
el.innerHTML = el.innerText.replace(/^layer\./, '<span class="dimmed">layer.</span>');
});
}
}
});
</script>
<script src="http://movelang.org/move-0.4.4.js"></script>
<script type="text/move">
# Code pretty printer
v = document.getElementsByTagName 'pre'
for (i=0,L=v.length; i < L; ++i) {
n = v.item i
a = n.getAttribute('class') || ''
if (a.indexOf('plain-text') != -1)
continue
if (n.firstChild && n.firstChild.nodeName == 'CODE')
n.setAttribute 'class', a+' prettyprint lang-mv'
}
script = document.createElement 'script'
script.async = true
script.src = "examples/prettify.js"
document.getElementsByTagName('head')[0].appendChild script
import UILayer
webkitCompatNote = document.getElementById 'webkit-compat-note'
if (!UILayer) {
webkitCompatNote.innerHTML = "<p>You are viewing through an incompatible browser. UILayer works with WebKit-based environments, such as web views on Apple iOS, OS X and Android or in web browsers like Google Chrome and Safari. The demos and examples presented on this site will not work in this browser.</p>"
return
} else {
webkitCompatNote.parentNode.removeChild webkitCompatNote
}
# A fun little Logotype for visitors with WebKit browsers
UILayer.debug = true
rootLayer = UILayer { x:20, y:20, width:2, height:70, tag:'logo', backgroundColor:'transparent',
perspective:1000, doubleSided:true, preserve3d:true }
document.body.appendChild rootLayer.element
rootLayer.perspective = 400
didInitiateRandomly = false
initiateRandomly = ^(layer, isSublayer) {
layer.moveBy 0, 0, (Math.random()*60)-30
if (isSublayer)
layer.matrix = layer.matrix.rotate((Math.random()*20)-10, (Math.random()*20)-10, (Math.random()*20)-10)
layer.sublayers.forEach ^(sublayer) { initiateRandomly sublayer, true }
}
addLetter = ^(letter, width, previousLayer) {
layer = (previousLayer || rootLayer).addSublayer UILayer {
x: 0, y: 0,
width: width || 60,
element: <div>{letter}</div>,
animated: 'geometry',
preserve3d: true,
style: {'-webkit-user-select':'none'}
}
if (previousLayer) {
layer.animationTimingFunction = 'ease-out'
after {delay:1} ^{
layer.frame.x = previousLayer.frame.width - 10
after {delay:layer.animationDuration} ^{
layer.animationTimingFunction = 'ease'
layer.animationDuration = 200
}
}
} else {
layer.animationTimingFunction = 'ease'
layer.animationDuration = 200
}
layer.on 'touchstart', ^(ev) {
if (!didInitiateRandomly) {
initiateRandomly rootLayer
didInitiateRandomly = true
}
layer.matrix = layer.matrix.rotate((Math.random()*20)-10, (Math.random()*20)-10, (Math.random()*20)-10)
@moveBy((Math.random()*10)-5, (Math.random()*10)-5, (Math.random()*10)-5)
#@scale *= (0.9 + (Math.random()*0.2))
ev.stopPropagation()
}
^(letter, width) { addLetter letter, width, layer }
}
addLetter('U', 45)('I', 35)('L', 40)('A', 48)('Y', 40)('E')('R', 40)
document.getElementById('title-h1').style.visibility = 'hidden'
</script>
</body>
</html>