-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathindex.html
More file actions
332 lines (317 loc) · 13.1 KB
/
index.html
File metadata and controls
332 lines (317 loc) · 13.1 KB
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Compare HAR files</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Twitter -->
<meta name="twitter:site" content="@sitespeedio" />
<meta name="twitter:creator" content="@sitespeedio" />
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Compare or view HAR files" />
<meta name="twitter:description"
content="Compare and view the difference between your HAR files. Upload or add the URL to your files (.har and .har.gz) and compare them." />
<meta name="twitter:image" content="https://compare.sitespeed.io/img/twitter/compare.png" />
<meta name="twitter:image:alt" content="Compare logo" />
<!-- Facebook -->
<meta property="og:url" content="https://compare.sitespeed.io" />
<meta property="og:title" content="Compare HAR files" />
<meta property="og:description"
content="Compare and view the difference between your HAR files. Upload or add the URL to your files (.har and .har.gz) and compare them." />
<meta property="og:image" content="https://compare.sitespeed.io/img/facebook/compare.png" />
<meta property="og:image:secure_url" content="https://compare.sitespeed.io/img/facebook/compare.png" />
<meta property="og:image:type" content="image/png" />
<meta property="og:image:width" content="979" />
<meta property="og:image:height" content="1000" />
<!-- Meta -->
<meta name="description"
content="Compare and view the difference between your HAR files. Upload or add the URL to your files (.har and .har.gz) and compare them." />
<meta name="author" content="Peter Hedenskog, Tobias Lidskog, Jonathan Lee, and sitespeed.io contributors" />
<meta name="theme-color" content="#0095d2" />
<link href="manifest.json" rel="manifest" />
<!-- Vite entry: imports the SCSS bundle and the waterfall-tools
wrapper (which exposes window.compareWaterfall for the classic
compare scripts below). -->
<script type="module" src="/src/main.js"></script>
<!-- Classic compare scripts. Live in public/ so Vite serves them
verbatim. defer keeps them in document order, so the globals
they share (parseTemplate, generate, etc.) resolve in sequence. -->
<script src="/js/dependencies/pagexray.min.js" defer></script>
<script src="/js/compare/upload.js" defer></script>
<script src="/js/compare/har.js" defer></script>
<script src="/js/compare/gzip.js" defer></script>
<script src="/js/compare/ux.js" defer></script>
<script src="/js/compare/load.js" defer></script>
<script src="/js/compare/filmstrip.js" defer></script>
<script src="/js/compare/filmstripNav.js" defer></script>
<script src="/js/compare/lightbox.js" defer></script>
<script src="/js/compare/generate.js" defer></script>
<script src="/js/compare/generateVisualProgress.js" defer></script>
<script src="/js/compare/templates.js" defer></script>
<script src="/js/compare/share.js" defer></script>
<script src="/js/compare/compare.js" defer></script>
<!--
-->
<script>
// One-time cleanup for browsers that previously installed the
// compare service worker. The SW + workbox stack was removed, so
// any clients still controlled by an old SW would keep serving
// stale assets indefinitely. Unregister + drop its caches so the
// very next reload after this change is fresh. Cheap no-op for
// anyone who never had an SW.
if ("serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then(function (regs) {
regs.forEach(function (r) { r.unregister(); });
}).catch(function () {});
}
if ("caches" in window) {
caches.keys().then(function (keys) {
keys.forEach(function (k) { caches.delete(k); });
}).catch(function () {});
}
document.addEventListener("DOMContentLoaded", function () {
const footerYear = document.getElementById("footerYear");
if (footerYear) footerYear.textContent = new Date().getFullYear();
createMainDropZone("zone");
function getAndSet(paramName, elementId) {
const paramValue = getParam(paramName);
if (paramValue) {
const el = document.getElementById(elementId);
el.value = paramValue;
}
}
getAndSet("har1", "harurl");
getAndSet("har2", "harurl2");
// Carry stripVersion through share links — `?stripVersion=1`
// mirrors the start-page checkbox so a shared URL renders the
// same comparison the sender saw.
const stripVersionFromUrl = getParam("stripVersion") === "1";
if (getParam("har1") != undefined && getParam("har2") != undefined) {
showLoading();
loadHARsFromConfig({
har1: { url: getParam("har1") },
har2: { url: getParam("har2") },
stripVersion: stripVersionFromUrl
});
} else if (
(getParam("har1") != undefined || getParam("har2") != undefined) &&
getParam("compare")
) {
showLoading();
loadHARsFromConfig({
har1: { url: getParam("har1") || getParam("har2") },
har2: {},
stripVersion: stripVersionFromUrl
});
} else if (getParam("gist") !== undefined) {
showLoading();
loadFilesFromGist(getParam("gist"));
} else if (getParam("config") !== undefined) {
showLoading();
loadFilesFromConfig(getParam("config"));
}
document.addEventListener("paste", function (e) {
const paste = e.clipboardData.getData("Text");
// Is it a HAR, a bundle, or a gist?
try {
const parsed = JSON.parse(paste);
showLoading();
if (isBundle(parsed)) {
loadFromBundle(parsed);
} else if (parsed.log) {
generate({
har1: {
har: parsed,
run: 0,
label: "HAR1"
},
har2: {
har: parsed,
run: parsed.log.pages.length > 1 ? 1 : 0,
label: "HAR2"
}
});
} else {
readConfig(parsed);
}
} catch (e) {
if (paste.startsWith("https://gist.github.com/")) {
const gistId = paste.substring(
paste.lastIndexOf("/") + 1,
paste.length
);
showLoading();
loadFilesFromGist(gistId);
} else if (paste.endsWith(".json")) {
showLoading();
loadFilesFromConfig(paste);
}
// Guess it's a gist id
else if (!paste.startsWith("http")) {
showLoading();
loadFilesFromGist(paste);
}
// Ok let the the user paste the URL into the field
}
});
});
</script>
<link rel="apple-touch-icon-precomposed" sizes="144x144" href="img/ico/compare-144.png" />
<link rel="apple-touch-icon-precomposed" sizes="114x114" href="img/ico/compare-114.png" />
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="img/ico/compare-72.png" />
<link rel="shortcut icon" href="img/ico/compare.ico" />
</head>
<body>
<a class="skip-link" href="#mainContent">Skip to content</a>
<div id="choosehars">
<header class="header" role="banner">
<div class="wip" aria-hidden="true">BETA</div>
<div class="grid grid-pad">
<div class="col-1-1">
<div class="logo">
<a href="https://compare.sitespeed.io/">
<img src="img/compare.png" width="77" class="img-logo" />
</a>
</div>
<h1 class="title">Compare</h1>
<p class="subtitle">
Understand regressions by comparing your HAR files.
</p>
</div>
</div>
</header>
<div class="grid grid-pad">
<div class="col-1-1">
<fieldset id="zone" class="dropzone">
<p>
Drop HAR files here (max two) or click to upload. You can add .har
and .har.gz files.
</p>
</fieldset>
<p class="smallish">
Or add the URL to your HAR files and press <b>compare</b>:
</p>
<input class="input-field" id="harurl" type="URL" placeholder="URL HAR 1" required />
<input class="input-field" id="harurl2" type="URL" placeholder="URL HAR 2" required />
<p class="smallish">
You can also use a
<a href="https://github.com/sitespeedio/compare#configuration">configuration file</a>
or a
<a href="https://github.com/sitespeedio/compare#github-gist">Github gist</a>.
</p>
<p class="smallish">
<input type="checkbox" id="stripVersion" name="stripVersion" value="false">
<label for="stripVersion">Strip version parameters</label>
</p>
<p class="smallish">
<a href="https://github.com/sitespeedio/compare#compare-har-files">Read the full documentation</a>
</p>
<button type="button" class="submit"
onclick="loadHARsFromConfig({har1: {url: document.getElementById('harurl').value}, har2: {url: document.getElementById('harurl2').value}});">
Compare
</button>
<div id="message" class="message"></div>
</div>
</div>
</div>
<div id="result" class="result">
<header class="header-result" role="banner">
<div class="grid grid-pad grid-result">
<div class="col-1-1">
<div class="logo">
<a href="https://compare.sitespeed.io/">
<img src="img/compare.png" width="34" class="img-logo" />
</a>
</div>
<nav id="resultHeaderContent" aria-label="Page sections"></nav>
<div id="shareControls" class="share-controls" aria-live="polite"></div>
</div>
</div>
</header>
<main id="mainContent" class="grid grid-pad grid-result" tabindex="-1">
<div class="col-1-1">
<h1 class="sr-only">HAR comparison</h1>
<div id="comment-intro" class="comment"></div>
<div id="pageXrayContent" class="card"></div>
<div id="filmstripContent" class="card"></div>
<section class="card">
<h3 id="waterfallHeader" class="card-title">Waterfall
<button id="waterfallLayoutToggle" type="button"
onclick="toggleWaterfallLayout(this);"
class="chip-toggle"
aria-pressed="false">Side by side</button>
</h3>
<div id="comment-waterfall" class="comment"></div>
<div class="rangeWrapper" id="harBlendWrapper">
<span class="har-label" id="har1Label"></span>
<input id="harBlendSlider" type="range" min="0" max="1" step="0.05" value="0"
oninput="blendWaterfalls(this.value)"
aria-label="Blend between the two waterfalls">
<span class="har-label" id="har2Label"></span>
</div>
<div class="harwrapper">
<div id="har1" class="har-canvas har-canvas--base"></div>
<div id="har2" class="har-canvas har-canvas--overlay"></div>
</div>
</section>
<div id="visualProgressContent" class="card"></div>
<div id="requestDiffContent" class="card"></div>
<div id="thirdPartyContent" class="card"></div>
<div id="domainsContent" class="card"></div>
<button type="button" onclick="errorMessage('');showUpload();" class="submit">
Upload again
</button>
</div>
</main>
</div>
<div id="loading" class="loading result">
<header class="header">
<div class="wip" aria-hidden="true">BETA</div>
<div class="grid grid-pad">
<div class="col-1-1">
<div class="logo">
<a href="https://compare.sitespeed.io/">
<img src="img/compare.png" width="77" class="img-logo" />
</a>
</div>
<h1 class="title">Compare</h1>
<p class="subtitle">
Understand regressions by comparing your HAR files.
</p>
</div>
</div>
</header>
<div class="grid grid-pad">
<div class="col-1-1">
<div class="loader">Loading...</div>
</div>
</div>
</div>
<footer>
<div class="grid grid-pad">
<div class="col-1-1">
©
<a href="https://www.sitespeed.io/aboutus/">sitespeed.io team</a> and contributors <span id="footerYear">2026</span>
- Built using
<a href="https://github.com/pmeenan/waterfall-tools">waterfall-tools</a> and
<a href="https://github.com/sitespeedio/pagexray">PageXray</a> and
<a href="https://github.com/sitespeedio/compare/blob/master/CREDIT.md">other great Open Source tools</a>. <br />
Code licensed
<a href="https://github.com/sitespeedio/compare/blob/master/LICENSE">MIT</a>.
<a href="https://github.com/sitespeedio/compare/blob/master/CHANGELOG.md">Changelog</a>. Help us
<a href="https://github.com/sitespeedio/compare">make it better!</a>
</div>
</div>
</footer>
<script>
function getParam(name) {
if (
(name = new RegExp(
"[?&]" + encodeURIComponent(name) + "=([^&]*)"
).exec(location.search))
)
return decodeURIComponent(name[1]);
}
</script>
</body>
</html>