OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var ClientRenderer = (function() { | 5 var ClientRenderer = (function() { |
6 var ClientRenderer = function() { | 6 var ClientRenderer = function() { |
7 this.playerListElement = document.getElementById('player-list'); | 7 this.playerListElement = document.getElementById('player-list'); |
8 this.audioPropertiesTable = | 8 var audioTableElement = document.getElementById('audio-property-table'); |
9 document.getElementById('audio-property-table').querySelector('tbody'); | 9 if (audioTableElement) |
10 this.playerPropertiesTable = | 10 this.audioPropertiesTable = audioTableElement.querySelector('tbody'); |
11 document.getElementById('player-property-table').querySelector('tbody'); | 11 var playerTableElement = document.getElementById('player-property-table'); |
12 this.logTable = document.getElementById('log').querySelector('tbody'); | 12 if (playerTableElement) |
| 13 this.playerPropertiesTable = playerTableElement.querySelector('tbody'); |
| 14 var logElement = document.getElementById('log'); |
| 15 if (logElement) |
| 16 this.logTable = logElement.querySelector('tbody'); |
13 this.graphElement = document.getElementById('graphs'); | 17 this.graphElement = document.getElementById('graphs'); |
14 this.audioPropertyName = document.getElementById('audio-property-name'); | 18 this.audioPropertyName = document.getElementById('audio-property-name'); |
15 | 19 |
16 this.players = null; | 20 this.players = null; |
17 this.selectedPlayer = null; | 21 this.selectedPlayer = null; |
18 this.selectedAudioComponentType = null; | 22 this.selectedAudioComponentType = null; |
19 this.selectedAudioComponentId = null; | 23 this.selectedAudioComponentId = null; |
20 this.selectedAudioCompontentData = null; | 24 this.selectedAudioCompontentData = null; |
21 | 25 |
22 this.selectedPlayerLogIndex = 0; | 26 this.selectedPlayerLogIndex = 0; |
23 | 27 |
24 this.filterFunction = function() { return true; }; | 28 this.filterFunction = function() { return true; }; |
25 this.filterText = document.getElementById('filter-text'); | 29 this.filterText = document.getElementById('filter-text'); |
26 this.filterText.onkeyup = this.onTextChange_.bind(this); | 30 if (this.filterText) |
| 31 this.filterText.onkeyup = this.onTextChange_.bind(this); |
27 this.clipboardDialog = document.getElementById('clipboard-dialog'); | 32 this.clipboardDialog = document.getElementById('clipboard-dialog'); |
28 | 33 |
29 this.clipboardTextarea = document.getElementById('clipboard-textarea'); | 34 this.clipboardTextarea = document.getElementById('clipboard-textarea'); |
30 this.clipboardTextarea.onblur = this.hideClipboard_.bind(this); | 35 if (this.clipboardTextarea) |
| 36 this.clipboardTextarea.onblur = this.hideClipboard_.bind(this); |
31 var clipboardButtons = document.getElementsByClassName('copy-button'); | 37 var clipboardButtons = document.getElementsByClassName('copy-button'); |
32 for (var i = 0; i < clipboardButtons.length; i++) { | 38 if (clipboardButtons) { |
33 clipboardButtons[i].onclick = this.copyToClipboard_.bind(this); | 39 for (var i = 0; i < clipboardButtons.length; i++) { |
| 40 clipboardButtons[i].onclick = this.copyToClipboard_.bind(this); |
| 41 } |
34 } | 42 } |
35 | 43 |
36 this.saveLogButton = document.getElementById('save-log-button'); | 44 this.saveLogButton = document.getElementById('save-log-button'); |
37 this.saveLogButton.onclick = this.saveLog_.bind(this); | 45 if (this.saveLogButton) |
| 46 this.saveLogButton.onclick = this.saveLog_.bind(this); |
38 | 47 |
39 this.hiddenKeys = ['component_id', 'component_type', 'owner_id']; | 48 this.hiddenKeys = ['component_id', 'component_type', 'owner_id']; |
40 | 49 |
41 // Tell CSS to hide certain content prior to making selections. | 50 // Tell CSS to hide certain content prior to making selections. |
42 document.body.classList.add(ClientRenderer.Css_.NO_PLAYERS_SELECTED); | 51 document.body.classList.add(ClientRenderer.Css_.NO_PLAYERS_SELECTED); |
43 document.body.classList.add(ClientRenderer.Css_.NO_COMPONENTS_SELECTED); | 52 document.body.classList.add(ClientRenderer.Css_.NO_COMPONENTS_SELECTED); |
44 }; | 53 }; |
45 | 54 |
46 /** | 55 /** |
47 * CSS classes added / removed in JS to trigger styling changes. | 56 * CSS classes added / removed in JS to trigger styling changes. |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 | 524 |
516 if (this.selectedPlayer) { | 525 if (this.selectedPlayer) { |
517 removeChildren(this.logTable); | 526 removeChildren(this.logTable); |
518 this.selectedPlayerLogIndex = 0; | 527 this.selectedPlayerLogIndex = 0; |
519 } | 528 } |
520 }, | 529 }, |
521 }; | 530 }; |
522 | 531 |
523 return ClientRenderer; | 532 return ClientRenderer; |
524 })(); | 533 })(); |
OLD | NEW |