-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
309 lines (291 loc) · 12.2 KB
/
index.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
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#3367D6"/>
<link rel="manifest" href="/manifest.json">
<title>Background Fetch Test Website</title>
</head>
<body>
<!-- Jumbotron on top of page -->
<div class="jumbotron">
<h1 class="display-4">Background Fetch Test Website</h1>
<p class="lead">This is a test website to test different aspects and features of Background Fetch</p>
<hr class="my-4">
<p>For more info about Background Fetch check the <a href="https://wicg.github.io/background-fetch/">spec</a>.</p>
</div>
<div class="container-fluid">
<div class="row">
<!-- First column of options -->
<div class="col-12 col-md-6 col-lg-4">
<h1>Options</h1>
<fieldset class="form-group">
<legend>Customize the fetch options</legend>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="fetch-id">
Use custom fetch ID
</label>
<input type="text" class="form-control" id="fetch-id-text" value="my-fetch" disabled>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="downloadtotal">
Provide custom <code>downloadTotal</code> <i>(default is best estimate)</i>
</label>
<input type="text" class="form-control" id="downloadtotal-text" disabled>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="title" checked>
Provide title
</label>
<input type="text" class="form-control cas" id="title-text" value="My Title!">
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="image-resource" checked>
Include ImageResource
</label>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="active btn btn-outline-primary w-100 radio-button" data-toggle="button" aria-pressed="true" id="image-resource-src">
src
</button>
</div>
<input type="text" class="form-control" id="image-resource-src-text" value="resources/icon1.png" >
</div>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="active btn btn-outline-primary w-100 radio-button" data-toggle="button" aria-pressed="true" id="image-resource-sizes">
sizes
</button>
</div>
<input type="text" class="form-control" id="image-resource-sizes-text" value="128x128">
</div>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="btn btn-outline-secondary w-100 radio-button" data-toggle="button" aria-pressed="false" id="image-resource-type">
type
</button>
</div>
<input type="text" class="form-control" id="image-resource-type-text" value="image/png" disabled>
</div>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="active btn btn-outline-primary w-100 radio-button" data-toggle="button" aria-pressed="true" id="image-resource-purpose">
purpose
</button>
</div>
<input type="text" class="form-control" id="image-resource-purpose-text" value="any">
</div>
</div>
</fieldset>
</div>
<!-- Second column of requests -->
<div class="col-12 col-md-6 col-lg-4">
<h1>Requests</h1>
<fieldset class="form-group">
<legend>Customize the requests to fetch</legend>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-text" checked>
Fetch a text file
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-image" checked>
Fetch an image
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-many-small">
Fetch 100 small files
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-random">
Fetch a file with random values
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-cors" disabled>
Fetch a cross origin file (allowed)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-cross-origin">
Fetch a cross origin file (not allowed)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-delay">
Fetch a file with a delay of
<select id="delay-seconds">
<option>1</option>
<option>5</option>
<option>10</option>
<option>30</option>
<option>60</option>
<option>120</option>
</select>
seconds
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-404">
Fetch a missing file <code>[404]</code>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-301" disabled>
Fetch a file with a redirect <code>[301]</code>
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-duplicate">
Fetch same file twice (duplicate url)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-upload">
Fetch request with body (upload)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="request-upload-large">
Fetch request with a large body
<select id="upload-size">
<option>1</option>
<option>5</option>
<option>10</option>
<option>30</option>
<option>60</option>
<option>120</option>
</select>
MB
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="request-custom">
Fetch custom file
</label>
<input type="text" class="form-control" id="request-custom-text" value="" disabled>
</div>
</fieldset>
</div>
<!-- Third colums for custom behaviour -->
<div class="col-12 col-md-6 col-lg-4">
<h1>Misc</h1>
<fieldset class="form-group">
<legend>Misc options to include with the fetch</legend>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="fetch-twice">
Fetch twice (Trigger Permission)
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input has-text" id="update-ui" checked>
Update UI (empty fields are not used)
</label>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="active btn btn-outline-primary w-100 radio-button" data-toggle="button" aria-pressed="true" id="update-ui-title">
Title
</button>
</div>
<input type="text" class="form-control" id="update-ui-title-text" value="Updated Title!" >
</div>
<div class="input-group">
<div class="input-group-prepend w-25">
<button type="button" class="active btn btn-outline-primary w-100 radio-button" data-toggle="button" aria-pressed="true" id="update-ui-src">
Icon src
</button>
</div>
<input type="text" class="form-control" id="update-ui-src-text" value="resources/icon2.png" >
</div>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="update-ui-twice">
Update UI twice
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="start-fetch-sw" disabled>
Start fetch from the service worker
</label>
</div>
<div class="form-check">
<label class="form-check-label">
<input type="checkbox" class="form-check-input" id="start-fetch-iframe" disabled>
Start fetch from an iframe
</label>
</div>
</fieldset>
</div>
</div>
<hr>
<!-- Second row starts -->
<div class="row">
<div class="col-lg-5 offset-lg-3">
<button class="btn btn-primary btn-block btn-lg" id="start-fetch-btn" disabled>Start Background Fetch!</button>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="abandon" checked>
<label class="form-check-label" for="abandon">Abandon fetches</label>
</div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="clear-page">
<label class="form-check-label" for="clear-page">Clear page / logs</label>
</div>
</div>
</div>
<br>
<hr>
<!-- Third row starts -->
<div class="row">
<div class="col-12 col-md-6 col-lg-4 text-truncate">
<h1 class="text-center">Fetch Results</h1>
<div id="fetch-results-container">
</div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<h1 class="text-center border-right border-left">Fetch Progress</h1>
<br>
<div id="progress-container" class="w-75"></div>
</div>
<div class="col-12 col-md-6 col-lg-4">
<h1 class="text-center">Log</h1>
<div class="log-entries text-monospace" id="log"></div>
</div>
</div>
</div>
<!-- Bootstrap because I can't CSS. -->
<link rel="stylesheet" href="static/bootstrap.css">
<script src="static/jquery.js"></script>
<script src="static/popper.js"></script>
<script src="static/bootstrap.js"></script>
<!-- Custom CSS -->
<link rel="stylesheet" href="styles.css">
<!-- BGF scripts -->
<script src="index.js"></script>
<script src="bgf.js"></script>
<script src="fetch-builder.js"></script>
</body>
</html>