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.
5 cr
.define('device_emulator', function() {
8 var audioSettings
= $('audio-settings');
9 var batterySettings
= $('battery-settings');
10 var bluetoothSettings
= $('bluetooth-settings');
12 function initialize() {
13 audioSettings
.initialize();
14 batterySettings
.initialize();
15 bluetoothSettings
.initialize();
17 var toggles
= document
.getElementsByClassName('menu-item-toggle');
18 for (var i
= 0; i
< toggles
.length
; ++i
) {
19 toggles
[i
].addEventListener('click', handleDrawerItemClick
);
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.
29 function handleDrawerItemClick(e
) {
30 var contentId
= e
.target
.dataset
.contentId
;
31 var card
= $(contentId
);
32 card
.hidden
= !card
.hidden
;
35 // Return an object with all of the exports.
37 initialize
: initialize
,
38 audioSettings
: audioSettings
,
39 batterySettings
: batterySettings
,
40 bluetoothSettings
: bluetoothSettings
,
44 document
.addEventListener('DOMContentLoaded', device_emulator
.initialize
);