OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 |
| 6 /** |
| 7 * @fileoverview Sets up the event handlers for the collapsing containers |
| 8 */ |
| 9 |
| 10 (function () { |
| 11 "use strict"; |
| 12 var allCollapseDivs = document.querySelectorAll('.collapse'); |
| 13 (Array.prototype.slice.call(allCollapseDivs)).forEach(function (elem) { |
| 14 // find the header for the div, because we only want to trigger on that |
| 15 var header = elem.querySelector("h2"); |
| 16 header.onclick = function () { |
| 17 var wasOpen = elem.className.indexOf("open") !== -1; |
| 18 |
| 19 if (wasOpen) { |
| 20 elem.className = "collapse closed"; |
| 21 } else { |
| 22 elem.className = "collapse open"; |
| 23 } |
| 24 }; |
| 25 }); |
| 26 |
| 27 }()); |
OLD | NEW |