This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
index.php
210 lines (175 loc) · 5.75 KB
/
index.php
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<?php
/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
require_once("ui.inc");
require_once("utils.inc");
$gTitle = "HTTP Archive";
?>
<!doctype html>
<html>
<head>
<title><?php echo genTitle() ?></title>
<meta charset="UTF-8">
<?php echo headfirst() ?>
<link type="text/css" rel="stylesheet" href="style.css" />
<style>
.column {
float: left;
width: 50%; }
h2 {
clear: both; }
.arrow {
vertical-align: top;
padding-top: 100px; }
#rightarrow {
text-align: left; }
#interestingcontainer {
margin-top: 30px;
width: auto;
border: 0; }
</style>
</head>
<body>
<?php echo uiHeader($gTitle); ?>
<p class="summary">The <a href="about.php">HTTP Archive</a> tracks how the Web is built.</p>
<ul class="even-columns keypoints">
<li><strong><a href="trends.php">Trends in web technology</a></strong><br>load times, download sizes, performance scores
<li><strong><a href="interesting.php">Interesting stats</a></strong><br>popular scripts, image formats, errors, redirects
<li><strong><a href="websites.php">Website performance</a></strong><br>specific URL screenshots, waterfall charts, HTTP headers
</ul>
The <a href="https://github.com/HTTPArchive/httparchive">HTTP Archive code</a> is open source and the data is <a href="downloads.php">downloadable</a>.
<center>
<table id=interestingcontainer cellspacing=0 cellpadding=0 border=0>
<tr>
<td id=leftarrow class=arrow></td>
<td>
<div id=interesting style="text-align: center;">
<!-- chart will be inserted here -->
</div>
</td>
<td id=rightarrow class=arrow></td>
</table>
<div>
<a href="about.php#bigquery">Write your own custom queries!</a>
</div>
</center>
<script type="text/javascript">
// HTML strings for each image
var gaSnippets = new Array();
<?php
$gLabel = latestLabel();
require_once("stats.inc");
require_once("charts.inc");
$hStats = getStats($gLabel, "All", curDevice());
?>
gaSnippets.push("<?php echo bytesContentTypeChart($hStats) ?>");
gaSnippets.push("<?php echo responseSizes($hStats) ?>");
gaSnippets.push("<?php echo percentGoogleLibrariesAPI($hStats) ?>");
gaSnippets.push("<?php echo percentFlash($hStats) ?>");
gaSnippets.push("<?php echo percentFonts($hStats) ?>");
gaSnippets.push("<?php echo popularImageFormats($hStats) ?>");
gaSnippets.push("<?php echo maxage($hStats) ?>");
gaSnippets.push("<?php echo percentByProtocol($hStats) ?>");
gaSnippets.push("<?php echo requestErrors($hStats) ?>");
gaSnippets.push("<?php echo correlationChart($hStats, "onLoad") ?>");
gaSnippets.push("<?php echo correlationChart($hStats, "renderStart") ?>");
// The DOM element that is created from each snippet.
var gaSnippetElems = new Array();
var curSnippet;
function showSnippet(parentId, bPrev) {
var parent = document.getElementById(parentId);
if ( ! parent ) {
return;
}
var iSnippet = Math.floor(gaSnippets.length * Math.random());
if ( curSnippet ) {
iSnippet = parseInt(curSnippet.id)
//fade(curSnippet, true);
curSnippet.style.display = 'none';
}
iSnippet = ( bPrev ? iSnippet-1 : iSnippet+1 );
if ( iSnippet >= gaSnippets.length ) {
iSnippet = 0;
}
else if ( iSnippet < 0 ) {
iSnippet = gaSnippets.length - 1;
}
var newSnippet = gaSnippetElems[iSnippet];
if ( "undefined" === typeof(newSnippet) ) {
newSnippet = document.createElement('div');
newSnippet.id = iSnippet;
gaSnippetElems[iSnippet] = newSnippet;
newSnippet.innerHTML = "<a class=image-link href='interesting.php'>" + gaSnippets[iSnippet] + "</a>";
var aPosition = findPos(parent);
newSnippet.style.left = aPosition[0] + "px";
newSnippet.style.top = aPosition[1] + "px";
parent.appendChild(newSnippet);
}
else {
newSnippet.style.display = "block";
}
curSnippet = newSnippet;
fade(newSnippet);
}
function insertNav(parentId) {
var arrow = document.getElementById('leftarrow');
if ( arrow ) {
arrow.innerHTML = "<a class='image-link' href='javascript:showSnippet(\"" + parentId + "\", 1)'><img src='images/tri-lft-t-14x28.gif' width=14 height=28 border=0></a>";
}
arrow = document.getElementById('rightarrow');
if ( arrow ) {
arrow.innerHTML = "<a class='image-link' href='javascript:showSnippet(\"" + parentId + "\")'><img src='images/tri-rt-t-14x28.gif' width=14 height=28 border=0></a>";
}
}
// opacity is a number 0-100 inclusive
function fade(idOrElem, bOut) {
var elem = idOrElem;
if ( "string" === typeof(idOrElem) || "number" === typeof(idOrElem) ) {
elem = document.getElementById(idOrElem);
}
if ( ! elem ) {
return;
}
opacity = ( elem.style.opacity ? parseInt(elem.style.opacity * 100) : ( bOut ? 100 : 0 ) );
opacity = ( bOut ? opacity - 10 : opacity + 10 );
opacity = ( 100 < opacity ? 100 : ( 0 > opacity ? 0 : opacity ) );
elem.style.opacity = opacity/100;
elem.style.filter = "alpha(opacity = " + opacity + ")";
if ( (bOut && 0 < opacity ) || ( !bOut && 100 > opacity) ) {
setTimeout(function() { fade(elem, bOut); }, 50);
}
else if ( bOut ) {
elem.style.display = "none";
}
}
// from http://www.quirksmode.org/js/findpos.html
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
}
return [curleft,curtop];
}
function dprint(msg) {
if ( "undefined" != typeof(console) ) {
console.log(msg);
}
}
showSnippet('interesting');
insertNav('interesting');
</script>
<?php echo uiFooter() ?>
</body>
</html>