| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 cr.define('device_emulator', function() { | 5 cr.define('device_emulator', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 var audioSettings = $('audio-settings'); |
| 8 var batterySettings = $('battery-settings'); | 9 var batterySettings = $('battery-settings'); |
| 9 var bluetoothSettings = $('bluetooth-settings'); | 10 var bluetoothSettings = $('bluetooth-settings'); |
| 10 | 11 |
| 11 function initialize() { | 12 function initialize() { |
| 13 chrome.send('requestAudioNodes'); |
| 14 chrome.send('requestBluetoothInfo'); |
| 12 chrome.send('requestPowerInfo'); | 15 chrome.send('requestPowerInfo'); |
| 13 chrome.send('requestBluetoothInfo'); | 16 |
| 14 | 17 |
| 15 var toggles = document.getElementsByClassName('menu-item-toggle'); | 18 var toggles = document.getElementsByClassName('menu-item-toggle'); |
| 16 for (var i = 0; i < toggles.length; ++i) { | 19 for (var i = 0; i < toggles.length; ++i) { |
| 17 toggles[i].addEventListener('click', handleDrawerItemClick); | 20 toggles[i].addEventListener('click', handleDrawerItemClick); |
| 18 } | 21 } |
| 19 } | 22 } |
| 20 | 23 |
| 21 /** | 24 /** |
| 22 * Shows/hides a sidebar elements designated content. | 25 * Shows/hides a sidebar elements designated content. |
| 23 * The content is identified by the |data-content-id| attribute of the | 26 * The content is identified by the |data-content-id| attribute of the |
| 24 * sidebar element. This value is the ID of the HTML element to be toggled. | 27 * sidebar element. This value is the ID of the HTML element to be toggled. |
| 25 * @param {Event} e Contains information about the event which was fired. | 28 * @param {Event} e Contains information about the event which was fired. |
| 26 */ | 29 */ |
| 27 function handleDrawerItemClick(e) { | 30 function handleDrawerItemClick(e) { |
| 28 var content = $(e.target.dataset.contentId); | 31 var content = $(e.target.dataset.contentId); |
| 29 content.hidden = !content.hidden; | 32 content.hidden = !content.hidden; |
| 30 } | 33 } |
| 31 | 34 |
| 32 // Return an object with all of the exports. | 35 // Return an object with all of the exports. |
| 33 return { | 36 return { |
| 34 initialize: initialize, | 37 initialize: initialize, |
| 38 audioSettings: audioSettings, |
| 35 batterySettings: batterySettings, | 39 batterySettings: batterySettings, |
| 36 bluetoothSettings: bluetoothSettings, | 40 bluetoothSettings: bluetoothSettings, |
| 37 }; | 41 }; |
| 38 }); | 42 }); |
| 39 | 43 |
| 40 document.addEventListener('DOMContentLoaded', device_emulator.initialize); | 44 document.addEventListener('DOMContentLoaded', device_emulator.initialize); |
| OLD | NEW |