Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 var expandedDetails = false; | |
| 6 var touch = 'touchend'; | |
| 7 var click = 'click'; | |
| 8 | |
| 9 function toggleDetails() { | |
| 10 $('details').classList.toggle('hidden'); | |
| 11 $('details-button').innerText = $('details').classList.contains('hidden') ? | |
| 12 templateData.openDetails : templateData.closeDetails; | |
| 13 if (!expandedDetails) { | |
| 14 // Record a histogram entry only the first time that details is opened. | |
| 15 sendCommand(CMD_MORE); | |
| 16 expandedDetails = true; | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 function setupEvents() { | |
| 21 $('safety-button').addEventListener(touch, function() { | |
| 22 sendCommand(CMD_DONT_PROCEED); | |
| 23 }); | |
| 24 $('safety-button').addEventListener(click, function() { | |
| 25 sendCommand(CMD_DONT_PROCEED); | |
|
Bernhard Bauer
2014/05/27 14:13:34
Alternatively, you could assign the two event name
| |
| 26 }); | |
| 27 | |
| 28 $('proceed-link').addEventListener(touch, function() { | |
| 29 sendCommand(CMD_PROCEED); | |
| 30 }); | |
| 31 $('proceed-link').addEventListener(click, function() { | |
| 32 sendCommand(CMD_PROCEED); | |
| 33 }); | |
| 34 | |
| 35 $('details-button').addEventListener(touch, toggleDetails); | |
| 36 $('details-button').addEventListener(click, toggleDetails); | |
| 37 } | |
| 38 | |
| 39 document.addEventListener('DOMContentLoaded', setupEvents); | |
| OLD | NEW |