Skip to content
This repository was archived by the owner on Apr 11, 2024. It is now read-only.

Commit 8fd21b6

Browse files
committed
Remove code for the device lab
1 parent 5a39af0 commit 8fd21b6

File tree

1 file changed

+0
-161
lines changed

1 file changed

+0
-161
lines changed

scripts/reporting.js

Lines changed: 0 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,3 @@
1-
2-
var DeviceTable = function() { this.initialize.apply(this, arguments) };
3-
DeviceTable.prototype = {
4-
5-
initialize: function(options) {
6-
this.parent = options.parent;
7-
8-
document.body.addEventListener("click", this.onClose.bind(this), true);
9-
10-
var rows = this.parent.querySelectorAll('tbody tr');
11-
for (var r = 0; r < rows.length; r++) {
12-
rows[r].addEventListener("click", this.onShow.bind(this, rows[r]), true);
13-
}
14-
15-
this.popup = null;
16-
},
17-
18-
onClose: function(e) {
19-
var child = false;
20-
21-
var el = e.target;
22-
while (el.parentNode) {
23-
if (el == this.parent) {
24-
child = true;
25-
break;
26-
}
27-
28-
el = el.parentNode;
29-
}
30-
31-
if (!child) this.close();
32-
},
33-
34-
onShow: function(row) {
35-
this.close();
36-
37-
var httpRequest;
38-
if (window.XMLHttpRequest) {
39-
httpRequest = new XMLHttpRequest();
40-
} else if (window.ActiveXObject) {
41-
httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
42-
}
43-
44-
httpRequest.open('POST','/api/loadLabDevice', true);
45-
httpRequest.onreadystatechange = process.bind(this);
46-
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
47-
httpRequest.send('id=' + encodeURIComponent(row.getAttribute('data-id')));
48-
49-
function process() {
50-
if (httpRequest.readyState == 4 && httpRequest.responseText != '') {
51-
var data = JSON.parse(httpRequest.responseText);
52-
53-
var bb = [
54-
[ 'ie5', 'ie6', 'IE 5'],
55-
[ 'ie6', 'ie6', 'IE 6'],
56-
[ 'ie7', 'ie7', 'IE 7'],
57-
[ 'ie8', 'ie7', 'IE 8'],
58-
[ 'ie9', 'ie9', 'IE 9'],
59-
[ 'ie10', 'ie10', 'IE 10'],
60-
[ 'ie11', 'ie10', 'IE 11'],
61-
[ 'ie10_metro', 'ie-metro', 'IE 10'],
62-
[ 'ie11_metro', 'ie-metro', 'IE 11'],
63-
[ 'wp7', 'ie-metro', 'IE 9'],
64-
[ 'wp8', 'ie-metro', 'IE 10'],
65-
[ 'safari_ios_6', 'safari-ios-6', 'Safari'],
66-
[ 'safari_ios_7', 'safari-ios-7', 'Safari'],
67-
[ 'xpress', 'nokia', 'Xpress'],
68-
[ 'nokia', 'nokia', 'Nokia'],
69-
[ 'maemo', 'nokia', 'Nokia'],
70-
[ 'meego', 'nokia', 'Nokia'],
71-
[ 'webos', 'webos', 'webOS'],
72-
[ 'android', 'android', 'Android'],
73-
[ 'bb', 'bb', 'Browser'],
74-
[ 'bb10', 'bb10', 'Browser'],
75-
[ 'tabletos', 'tabletos', 'Browser'],
76-
77-
[ 'chrome', 'chrome', 'Chrome'],
78-
[ 'coast', 'coast', 'Coast'],
79-
[ 'diigo', 'diigo', 'Diigo'],
80-
[ 'dolphin', 'dolphin', 'Dolphin'],
81-
[ 'firefox', 'firefox', 'Firefox'],
82-
[ 'ilunascape', 'ilunascape', 'iLunascape'],
83-
[ 'maxthon', 'maxthon', 'Maxthon'],
84-
[ 'mercury', 'mercury', 'Mercury'],
85-
[ 'puffin', 'puffin', 'Puffin'],
86-
[ 'silk', 'silk', 'Silk'],
87-
[ 'sleipnir', 'sleipnir', 'Sleipnir'],
88-
[ 'one', 'one', 'One'],
89-
[ 'opera', 'opera', 'Opera'],
90-
[ 'qq', 'qq', 'QQ'],
91-
[ 'uc-iphone', 'uc-iphone', 'UC Web'],
92-
[ 'uc-old', 'uc-old', 'UC Web'],
93-
]
94-
95-
var browsers = "<ul class='browsers'>";
96-
97-
if (data.defaultBrowser || data.defaultFingerprint) {
98-
browsers += "<li class='default'>";
99-
var stock = true;
100-
101-
if (data.defaultBrowser) {
102-
for (var b = 0; b < bb.length; b++) {
103-
if (data.defaultBrowser == bb[b][0]) {
104-
stock = false;
105-
browsers += "<img src='/images/browsers/" + bb[b][1] +".png'><span>" + bb[b][2] + "</span>";
106-
}
107-
}
108-
}
109-
110-
if (stock) {
111-
browsers += "<span class='stock'>Default browser</span>";
112-
}
113-
114-
if (data.defaultFingerprint) {
115-
browsers += "<div class='score'><a href='" + document.location.protocol + "//html5te.st/" + data.defaultFingerprint + "'>" + data.defaultResults.score + "</a></div>";
116-
}
117-
118-
browsers += "</li>";
119-
}
120-
121-
122-
for (var b = 0; b < bb.length; b++) {
123-
if (data.otherBrowsers[bb[b][0]]) browsers += "<li><img src='/images/browsers/" + bb[b][1] +".png'><span>" + bb[b][2] + "</span></li>";
124-
}
125-
126-
if (data.hasInspect) browsers += "<li><img src='/images/browsers/inspect.png'><span>Inspect</span></li>";
127-
browsers += "</ul>";
128-
129-
this.popup = document.createElement('div');
130-
this.popup.className = 'popupPanel pointsLeft deviceInfo';
131-
this.popup.innerHTML =
132-
"<h2>" + data.deviceManufacturer + " " + data.deviceModel + ( data.url ? "<a class='external' href='" + data.url + "'></a>" : "") + "</h2>" +
133-
"<div class='image'" + (data.image ? " style='background-image: url(/images/devices/" + data.image + ");'" : "") + "></div>" +
134-
"<div class='information'>" +
135-
"<table>" +
136-
"<tr><th>Type</th><td>" + data.type + (data.deviceSize ? ", " + data.deviceSize + "&nbsp;inch": "") + "</td></tr>" +
137-
"<tr><th>Display</th><td>" + (data.deviceWidth && data.deviceHeight ? data.deviceWidth + "&nbsp;x&nbsp;" + data.deviceHeight + "&nbsp;pixels" : "") + (data.devicePPI ? ", " + data.devicePPI + "&nbsp;ppi" : "") + "</td></tr>" +
138-
"<tr><th>OS</th><td>" + (data.osName ? data.osName + (data.osVersion ? " " + data.osVersion : "") : "-") + "</td></tr>" +
139-
"<tr><th>Wi-Fi</th><td>" + (data.hasWifi ? "<span class='check'>✔</span> Yes" : "<span class='ballot'>✘</span> No") + "</td></tr>" +
140-
"<tr><th>Cellular</th><td>" + (data.simSize ? "<span class='check'>✔</span> " + data.simSize + " sim" + (data.simLocked ? ', locked' : ', unlocked') : "<span class='ballot'>✘</span> No") + "</td></tr>" +
141-
"</table>" +
142-
browsers +
143-
144-
(data.comment ? "<div class='comment'>" + data.comment + "</div>" : "" ) +
145-
"</div>";
146-
147-
row.cells[0].appendChild(this.popup);
148-
}
149-
}
150-
},
151-
152-
close: function() {
153-
if (this.popup) {
154-
this.popup.parentNode.removeChild(this.popup);
155-
this.popup = null;
156-
}
157-
}
158-
}
159-
160-
161-
1621
var SearchField = function() { this.initialize.apply(this, arguments) };
1632
SearchField.prototype = {
1643

0 commit comments

Comments
 (0)