forked from compat-table/compat-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
master.js
65 lines (57 loc) · 2.28 KB
/
master.js
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
var _gaq = [['_setAccount', 'UA-1128111-24'], ['_trackPageview']];
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
function test(expression) {
var result = expression ? 'Yes' : 'No';
document.write('<td class="' + result.toLowerCase() + '">' + result + '</td><td></td>');
}
document.write('<style>td:nth-child(3) { outline: #aaf solid 3px; }</style>');
window.onload = function() {
document.body.className += ' hide-old-browsers';
document.getElementById('show-old-browsers-wrapper').style.display = '';
document.getElementById('show-old-browsers').onclick = function() {
if (this.checked) {
document.body.className = document.body.className.replace('hide-old-browsers', '');
}
else {
document.body.className += 'hide-old-browsers';
}
};
var mouseoverTimeout;
var infoTooltip = document.createElement('pre');
infoTooltip.className = 'info-tooltip';
infoTooltip.style.display = 'none';
document.body.appendChild(infoTooltip);
infoTooltip.onmouseout = function() {
infoTooltip.style.display = 'none';
};
infoTooltip.onmouseover = function() {
mouseoverTimeout = null;
};
var rows = document.getElementsByTagName('table')[0].rows;
for (var i = 1; i < rows.length; i++) {
if (/separator/.test(rows[i].cells[0].className)) continue;
var infoEl = document.createElement('span');
infoEl.className = 'info';
infoEl.innerHTML = 'c';
rows[i].cells[0].appendChild(infoEl);
infoEl.onmouseover = function(e) {
mouseoverTimeout = null;
var scriptEl = this.parentNode.parentNode.getElementsByTagName('script')[0];
infoTooltip.innerHTML = scriptEl.innerHTML.replace(/^\n/, '').replace(/</g, '<');
infoTooltip.style.left = e.pageX + 10 + 'px';
infoTooltip.style.top = e.pageY + 'px';
infoTooltip.style.display = 'block';
};
infoEl.onmouseout = function(e) {
mouseoverTimeout = setTimeout(function() {
if (mouseoverTimeout) {
infoTooltip.style.display = 'none';
}
}, 500);
};
}
};