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 | |
| 7 function setupEvents() { | |
| 8 var clickEventType = ('ontouchstart' in window ? 'touchend' : 'click'); | |
|
Bernhard Bauer
2014/05/26 10:13:20
Does this mean that we *require* a touch if the de
felt
2014/05/27 12:25:06
Oh, right. I guess on devices like a Pixel there a
felt
2014/05/28 12:56:29
It turns out I just need the 'click', touchscreen
Bernhard Bauer
2014/05/28 13:17:47
OK, cool.
| |
| 9 | |
| 10 $('safety-button').addEventListener(clickEventType, function() { | |
| 11 sendCommand(CMD_DONT_PROCEED); | |
| 12 }); | |
| 13 | |
| 14 $('proceed-link').addEventListener(clickEventType, function() { | |
| 15 sendCommand(CMD_PROCEED); | |
| 16 }); | |
| 17 | |
| 18 $('details-button').addEventListener(clickEventType, function() { | |
| 19 $('details').classList.toggle('hidden'); | |
| 20 $('details-button').innerText = $('details').classList.contains('hidden') ? | |
| 21 $('details-button').innerText = templateData.openDetails : | |
|
Bernhard Bauer
2014/05/26 10:13:20
You already assign the result of the ?: operator.
felt
2014/05/27 12:25:06
Done.
| |
| 22 $('details-button').innerText = templateData.closeDetails; | |
| 23 if (!expandedDetails) { | |
| 24 // Record a histogram entry only the first time that details is opened. | |
| 25 sendCommand(CMD_MORE); | |
| 26 expandedDetails = true; | |
| 27 } | |
| 28 }); | |
| 29 } | |
| 30 | |
| 31 document.addEventListener('DOMContentLoaded', setupEvents); | |
| OLD | NEW |