OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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('togglescreenshot', function() { |
| 6 'use strict'; |
| 7 |
| 8 function toggleScreenshots(screenshotImages) { |
| 9 screenshotImages.forEach(function(screenshot) { |
| 10 screenshot.classList.toggle('screenshot-image--visible'); |
| 11 }); |
| 12 } |
| 13 |
| 14 function initialize() { |
| 15 var screenshotImages = document.querySelectorAll('.screenshot-image'); |
| 16 sections.forEach(function(section) { |
| 17 var sectionHeading = section.querySelector('.section-heading'); |
| 18 sectionHeading.addEventListener('click', function() { |
| 19 toggleScreenshots(screenshotImages); |
| 20 }); |
| 21 }); |
| 22 } |
| 23 |
| 24 return { |
| 25 initialize: initialize |
| 26 }; |
| 27 }); |
| 28 |
| 29 document.addEventListener('DOMContentLoaded', togglescreenshot.initialize); |
OLD | NEW |