-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.html
More file actions
124 lines (92 loc) · 2.14 KB
/
Copy pathtest.html
File metadata and controls
124 lines (92 loc) · 2.14 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Zepto Detect, List Properties</title>
<style media="screen">
body {
margin: 1em 0;
font-size: 1em;
}
h1 {
margin: auto 1em;
font-size: 1.25em;
}
h2 {
padding: .278em 1.111em;
background-color: #eee;
font-size: 1.125em;
}
ul {
font: normal normal 600 0.75em/1.6em Monaco, "Andale Mono", monospace;
list-style: none;
padding-left: 1.667em;
}
li span {
font-weight: 400;
}
li::before {
display: inline-block;
font-size: 1.5em;
width: 1.667em;
}
.true::before {
color: #0a0;
content: "\2713";
}
.false::before {
color: #d00;
content: "\2717";
}
.true span {
color: #0a0;
}
.false span {
color: #d00;
}
</style>
</head>
<body>
<h1>Zepto Detect, List Properties</h1>
<h2>Detect:</h2>
<ul id="detect">
</ul>
<h2>Device:</h2>
<ul id="device">
</ul>
<!-- Zepto v0.8 -->
<script src="./lib/zepto.min.js"></script>
<!-- Zepto.Detect -->
<script src="./zepto.detect.js"></script>
<!-- Test -->
<script>
$(document).ready( function () {
// Itterate through Detection object
function listProperties (object) {
var collection = $[object],
testList = $('#' + object),
property,
result;
for (property in collection) {
if (collection.hasOwnProperty(property)) {
if (typeof collection[property] === "function") {
result = collection[property]();
} else {
result = collection[property];
}
console.log(property + ': ' + result);
testList.append(
'<li class="detect-' + property + ' ' + result + '">' +
property + ': <span>' + result + '</span>' +
'</li>'
);
}
}
}
// Run tests
listProperties("detect");
listProperties("device");
});
</script>
</body>
</html>