Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: bb39e6d247
Fetching contributors…

Cannot retrieve contributors at this time

413 lines (399 sloc) 15.428 kb
<!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, "&mdash;");
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, "&quot;"))
}
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, "&quot;"), 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, "&quot;");
e = k(e, "*_");
b = '<img src="' + e + '" alt="' + a + '"';
f = f.replace(/"/g, "&quot;");
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, "&amp;");
a = a.replace(/</g, "&lt;");
a = a.replace(/>/g, "&gt;");
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, "&amp;");
return a.replace(/<(?![a-z\/?\$!])/gi, "&lt;")
}, 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>
Jump to Line
Something went wrong with that request. Please try again.