/
events.html
102 lines (100 loc) · 2.87 KB
/
events.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
<!doctype html>
<html>
<head>
<script type="text/javascript" src="/webfont.js"></script>
<script type="text/javascript">
function progress(message) {
var output = document.getElementById('events');
if (output) {
var e = document.createElement('li');
e.innerHTML = message;
output.appendChild(e);
}
if (console && console.log) {
console.log(message);
}
}
WebFont.load({
google: {
families: ['Droid Sans', 'Tangerine']
},
loading: function() {
progress('loading');
},
active: function() {
progress('active');
},
inactive: function(fontFamily) {
progress('inactive: ' + fontFamily);
},
familyloading: function(fontFamily) {
progress('familyloading: ' + fontFamily);
},
familyactive: function(fontFamily) {
progress('familyactive: ' + fontFamily);
},
familyfailed: function(fontFamily) {
progress('familyfailed: ' + fontFamily);
}
});
</script>
<style type="text/css">
h1 {
visibility: hidden;
}
.wf-droidsans-active h1.droid {
font-family: 'Droid Sans';
font-weight: normal;
visibility: visible;
}
.wf-tangerine-active h1.tangerine {
font-family: 'Tangerine';
font-weight: normal;
visibility: visible;
}
/* All Class hooks */
#classes { color: #ddd; }
html.wf-loading #classes .Loading,
html.wf-active #classes .Active,
html.wf-inactive #classes .Inactive,
html.wf-droidsans-loading #classes .DroidSansLoading,
html.wf-droidsans-active #classes .DroidSansActive,
html.wf-droidsans-failed #classes .DroidSansFailed,
html.wf-tangerine-loading #classes .TangerineLoading,
html.wf-tangerine-active #classes .TangerineActive,
html.wf-tangerine-failed #classes .TangerineFailed {
color: #000;
}
</style>
</head>
<body>
<h1 class="droid">
Hello World. I am Droid Sans.
</h1>
<h1 class="tangerine">
Hello World. I am Tangerine.
</h1>
<hr>
<p>
<a href="#" onclick="document.getElementsByTagName('body')[0].style.color = '#fff';return false;">Hide Page</a> |
<a href="/events.html">Reload Cached</a>
</p>
<p>
The goal of this page is to show all of the font loading event callbacks.
</p>
<h2>CSS Hook Status</h2>
<ul id="classes">
<li class="Loading">Loading</li>
<li class="Active">Active</li>
<li class="Inactive">Inactive</li>
<li class="DroidSansLoading">Droid Sans Loading</li>
<li class="DroidSansActive">Droid Sans Active</li>
<li class="DroidSansFailed">Droid Sans Failed</li>
<li class="TangerineLoading">Tangerine Loading</li>
<li class="TangerineActive">Tangerine Active</li>
<li class="TangerineFailed">Tangerine Failed</li>
</ul>
<h2>JavaScript Event Progress</h2>
<ol id="events"></ol>
</body>
</html>