forked from WebPlatformTest/HTML5test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qr.html
176 lines (142 loc) · 6.43 KB
/
qr.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
<!DOCTYPE html>
<html>
<head>
<title>HTML5test - How well does your browser support HTML5?</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=EDGE">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
html {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", "Helvetica", "Arial", "Lucida Grande", sans-serif;
font-weight: 200;
font-size: 1em;
}
body {
background: #d9d9d9;
text-align: center;
margin: 20px;
}
p {
margin: 0 0 0.5em;
}
a {
color: #0092bf;
text-decoration: none;
}
code {
font-size: 1.2em;
}
</style>
<script src='/scripts/base.js' type='text/javascript'></script>
<script src='/scripts/8/engine.js' type='text/javascript'></script>
<script src='/scripts/8/data.js' type='text/javascript'></script>
<script>
(function(){var p=[],w=window,d=document,e=f=0;p.push('ua='+encodeURIComponent(navigator.userAgent));e|=w.ActiveXObject?1:0;e|=w.opera?2:0;e|=w.chrome?4:0;
e|='getBoxObjectFor' in d || 'mozInnerScreenX' in w?8:0;e|=('WebKitCSSMatrix' in w||'WebKitPoint' in w||'webkitStorageInfo' in w||'webkitURL' in w)?16:0;
e|=(e&16&&({}.toString).toString().indexOf("\n")===-1)?32:0;p.push('e='+e);f|='sandbox' in d.createElement('iframe')?1:0;f|='WebSocket' in w?2:0;
f|=w.Worker?4:0;f|=w.applicationCache?8:0;f|=w.history && history.pushState?16:0;f|=d.documentElement.webkitRequestFullScreen?32:0;f|='FileReader' in w?64:0;
p.push('f='+f);p.push('r='+Math.random().toString(36).substring(7));p.push('w='+screen.width);p.push('h='+screen.height);var s=d.createElement('script');
s.src='//api.whichbrowser.net/rel/detect.js?' + p.join('&');d.getElementsByTagName('head')[0].appendChild(s);})();
</script>
</head>
<body>
<div id="qr"></div>
<script>
<!--
function waitForWhichBrowser(cb) {
var callback = cb;
function wait() {
if (typeof WhichBrowser == 'undefined')
window.setTimeout(wait, 100)
else
callback();
}
wait();
}
waitForWhichBrowser(function() {
Browsers = new WhichBrowser({
useFeatures: true,
detectCamouflage: true
});
start();
});
function start() {
var params = {};
if (location.search) {
var parts = location.search.substring(1).split('&');
for (var i = 0; i < parts.length; i++) {
var nv = parts[i].split('=');
if (!nv[0]) continue;
params[nv[0]] = nv[1] || true;
}
}
var identifier = typeof params.identifier != 'undefined' ? params.identifier : null;
var source = typeof params.source != 'undefined' ? params.source : null;
var task = typeof params.task != 'undefined' ? params.task : null;
new Test(function(r) {
var c = new Calculate(r, tests);
document.getElementById('qr').innerHTML +=
"<p>You can see the results here:</p>" +
"<p><a href='http://html5te.st/" + r.uniqueid + "'>html5te.st/" + r.uniqueid + "</a></p>" +
"<p>Or scan this QR-code:</p>" +
"<p>" +
"<img src='https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=" + encodeURIComponent("http://html5te.st/" + r.uniqueid) + "&choe=UTF-8' width='200' height='200'>" +
"</p>" +
"<p>The unique id for this test is:<br><code>" + r.uniqueid + "</code></p>";
var payload = '{' +
'"release": "' + r.release + '",' +
'"source": "' + source + '",' +
'"identifier": "' + identifier + '",' +
'"task": "' + task + '",' +
'"uniqueid": "' + r.uniqueid + '",' +
'"score": ' + c.score + ',' +
'"maximum": ' + c.maximum + ',' +
'"camouflage": "' + (Browsers.camouflage ? '1' : '0') + '",' +
'"features": "' + (Browsers.features.join(',')) + '",' +
'"browserName": "' + (Browsers.browser.name ? Browsers.browser.name : '') + '",' +
'"browserChannel": "' + (Browsers.browser.channel ? Browsers.browser.channel : '') + '",' +
'"browserVersion": "' + (Browsers.browser.version ? Browsers.browser.version.toString() : '') + '",' +
'"browserVersionType": "' + (Browsers.browser.version ? Browsers.browser.version.type : '') + '",' +
'"browserVersionMajor": "' + (Browsers.browser.version ? Browsers.browser.version.major : '') + '",' +
'"browserVersionMinor": "' + (Browsers.browser.version ? Browsers.browser.version.minor : '') + '",' +
'"browserVersionOriginal": "' + (Browsers.browser.version ? Browsers.browser.version.original : '') + '",' +
'"browserMode": "' + (Browsers.browser.mode ? Browsers.browser.mode : '') + '",' +
'"engineName": "' + (Browsers.engine.name ? Browsers.engine.name : '') + '",' +
'"engineVersion": "' + (Browsers.engine.version ? Browsers.engine.version.toString() : '') + '",' +
'"osName": "' + (Browsers.os.name ? Browsers.os.name : '') + '",' +
'"osFamily": "' + (Browsers.os.family ? Browsers.os.family : '') + '",' +
'"osVersion": "' + (Browsers.os.version ? Browsers.os.version.toString() : '') + '",' +
'"deviceManufacturer": "' + (Browsers.device.manufacturer ? Browsers.device.manufacturer : '') + '",' +
'"deviceModel": "' + (Browsers.device.model ? Browsers.device.model : '') + '",' +
'"deviceSeries": "' + (Browsers.device.series ? Browsers.device.series : '') + '",' +
'"deviceType": "' + (Browsers.device.type ? Browsers.device.type : '') + '",' +
'"deviceIdentified": "' + (Browsers.device.identified ? '1' : '0' ) + '",' +
'"deviceWidth": "' + (screen.width) + '",' +
'"deviceHeight": "' + (screen.height) + '",' +
'"useragent": "' + navigator.userAgent + '",' +
'"humanReadable": "' + Browsers.toString() + '",' +
'"points": "' + c.points + '",' +
'"results": "' + r.results + '"' +
'}';
submit('submit', payload);
function submit(method, payload) {
var httpRequest;
if (window.XMLHttpRequest) {
httpRequest = new XMLHttpRequest();
} else if (window.ActiveXObject) {
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
}
httpRequest.open('POST','/api/' + method, true);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.send('payload=' + encodeURIComponent(payload));
}
},
function(e) {
if (typeof console != 'undefined') console.log(e);
alert('Test has failed: ' + e.message);
});
}
//-->
</script>
</body>
</html>