Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(534)

Side by Side Diff: chrome/browser/resources/chromeos/emulator/device_emulator.js

Issue 1999593002: Update chrome://device-emulator with newer Polymer guidelines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: narrow mode drawer + webui safety Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698