blob: 1163ea0297285548774b912d3723e5dcf4435c2c (
plain)
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
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
document.title = 'page cycler';
document.cookie = '__pc_done=0; path=/';
document.cookie = '__pc_timings=; path=/';
var options = location.search.substring(1).split('&');
function getOption(name) {
var r = new RegExp('^' + name + '=');
for (var i = 0; i < options.length; i++) {
if (options[i].match(r)) {
return options[i].substring(name.length + 1);
}
}
return null;
}
function start() {
var iterations = document.getElementById('iterations').value;
window.resizeTo(800, 800);
var url = 'index.html?n=' + iterations + '&i=0&td=0';
window.location = url;
}
function renderForm() {
var form = document.createElement('form');
form.onsubmit = function(e) {
start();
e.preventDefault();
};
var label = document.createTextNode('Iterations: ');
form.appendChild(label);
var input = document.createElement('input');
input.id = 'iterations';
input.type = 'number';
var iterations = getOption('iterations');
input.value = iterations ? iterations : '5';
form.appendChild(input);
input = document.createElement('input');
input.type = 'submit';
input.value = 'Start';
form.appendChild(input);
document.body.appendChild(form);
}
renderForm();
// should we start automatically?
if (location.search.match('auto=1'))
start();
|