-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
49 lines (47 loc) · 1.51 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
<!DOCTYPE html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>index</title>
<script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
<script src="identicon.js"></script>
<script type="text/javascript" charset="utf-8">
// method written by Dustin Diaz
function getElementsByClassName(node,classname) {
if (node.getElementsByClassName) {
return node.getElementsByClassName(classname);
} else {
return (function getElementsByClass(searchClass,node) {
if ( node == null )
node = document;
var classElements = [],
els = node.getElementsByTagName("*"),
elsLen = els.length,
pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)"), i, j;
for (i = 0, j = 0; i < elsLen; i++) {
if ( pattern.test(els[i].className) ) {
classElements[j] = els[i];
j++;
}
}
return classElements;
})(classname, node);
}
}
window.onload = function () {
var elements = getElementsByClassName(document, "identicon"),
n = elements.length;
for (var i = 0; i < n; i++) {
var e = elements[i];
var identicon = Identicon.fromDOMElement(e);
identicon.draw();
}
};
</script>
</head>
<body>
<h1>Identicons</h1>
<p class="identicon" data-value="helloworld!" style="width:16px"></p>
<p class="identicon" data-value="helloworld!" style="width:32px"></p>
<p class="identicon" data-value="helloworld!" style="width:64px"></p>
<p class="identicon" data-value="helloworld!" style="width:128px"></p>
</body>