OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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 showedMore = false; |
| 6 |
| 7 function toggleMoreInfo(collapse) { |
| 8 $('more-info-long').hidden = collapse; |
| 9 $('more-info-short').hidden = !collapse; |
| 10 if (!collapse && !showedMore) { |
| 11 sendCommand(CMD_MORE); |
| 12 showedMore = true; |
| 13 } |
| 14 } |
| 15 |
| 16 // UI modifications and event listeners that take place after load. |
| 17 function setupEvents() { |
| 18 $('proceed-button').hidden = false; |
| 19 $('proceed-button').addEventListener('click', function() { |
| 20 sendCommand(CMD_PROCEED); |
| 21 }); |
| 22 |
| 23 if ($('more-info-title').textContent == '') { |
| 24 $('more-info-short').hidden = true; |
| 25 $('more-info-long').hidden = true; |
| 26 $('twisty-closed').style.display = 'none'; |
| 27 } else { |
| 28 $('more-info-short').addEventListener('click', function() { |
| 29 toggleMoreInfo(false); |
| 30 }); |
| 31 $('more-info-long').addEventListener('click', function() { |
| 32 toggleMoreInfo(true); |
| 33 }); |
| 34 } |
| 35 |
| 36 $('exit-button').addEventListener('click', function() { |
| 37 sendCommand(CMD_DONT_PROCEED); |
| 38 }); |
| 39 } |
| 40 |
| 41 document.addEventListener('DOMContentLoaded', setupEvents); |
OLD | NEW |