OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 function toggleMoreBox() { | |
6 var helpBoxOuter = $('help-box-outer'); | |
7 helpBoxOuter.classList.toggle('hidden'); | |
8 var moreLessButton = $('more-less-button'); | |
9 if (helpBoxOuter.classList.contains('hidden')) { | |
10 moreLessButton.innerText = templateData.more; | |
11 } else { | |
12 moreLessButton.innerText = templateData.less; | |
13 } | |
14 } | |
15 | |
16 // This allows errors to be skippped by typing "proceed" into the page. | |
Patrick Dubroy
2013/09/12 13:12:26
This looks like the exact same code as in roadbloc
felt
2013/09/16 00:05:21
Done.
| |
17 var keyPressState = 0; | |
18 function keyPressHandler(e) { | |
19 var sequence = 'proceed'; | |
20 if (sequence.charCodeAt(keyPressState) == e.keyCode) { | |
21 keyPressState++; | |
22 if (keyPressState == sequence.length) { | |
23 window.domAutomationController.send(1); // Proceed. | |
24 keyPressState = 0; | |
25 } | |
26 } else { | |
27 keyPressState = 0; | |
28 } | |
29 } | |
30 | |
31 function reloadPage() { | |
32 window.domAutomationController.send(4); | |
33 } | |
34 | |
35 function setupEvents() { | |
36 window.domAutomationController.setAutomationId(1); | |
37 $('reload-button').addEventListener('click', reloadPage); | |
38 $('more-less-button').addEventListener('click', toggleMoreBox); | |
39 document.addEventListener('keypress', keyPressHandler); | |
40 } | |
41 | |
42 document.addEventListener('DOMContentLoaded', setupEvents); | |
OLD | NEW |