blob: 45387ac8d142be7da1a32d720d548c4404bafba5 [file] [log] [blame]
jamiewalch50921f072014-11-05 17:20:411/* Copyright (c) 2014 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
6function onLoad() {
lukasza31a6f702015-02-03 22:57:477 var pnaclLog = document.getElementById('pnacl-log');
jamiewalch6af3ad72f2015-02-04 23:21:368 var pnaclPlugin = document.getElementById('pnacl-plugin');
9 var pnaclListener = document.getElementById('pnacl-listener');
10 var textLog = document.getElementById('text-log');
11 var textLogContainer = document.getElementById('text-log-container');
lukasza31a6f702015-02-03 22:57:4712
jamiewalch7a9ac6312015-02-09 23:27:1013 var eventListeners = new EventListeners(pnaclLog, textLog,
jamiewalch6af3ad72f2015-02-04 23:21:3614 pnaclPlugin, pnaclListener);
15 eventListeners.activate();
16
jamiewalch50921f072014-11-05 17:20:4117 document.getElementById('clear-log').addEventListener(
lukasza31a6f702015-02-03 22:57:4718 'click',
19 function() {
lukasza31a6f702015-02-03 22:57:4720 pnaclLog.innerText = '';
jamiewalch6af3ad72f2015-02-04 23:21:3621 textLog.innerText = '';
22 },
23 false);
24 document.getElementById('show-log').addEventListener(
25 'click',
26 function() {
27 eventListeners.deactivate();
28 textLogContainer.hidden = false;
29
30 var selection = window.getSelection();
31 var range = document.createRange();
32 range.selectNodeContents(textLog);
33 selection.removeAllRanges();
34 selection.addRange(range);
35 },
36 false);
37 document.getElementById('hide-log').addEventListener(
38 'click',
39 function() {
40 eventListeners.activate();
41 textLogContainer.hidden = true;
lukasza31a6f702015-02-03 22:57:4742 },
43 false);
jamiewalch50921f072014-11-05 17:20:4144}
45
46window.addEventListener('load', onLoad, false);