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