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('welcome', function() { |
| 6 'use strict'; |
| 7 |
| 8 function injectLocalizedStrings() { |
| 9 $('section-steps--click-edge').innerHTML = |
| 10 loadTimeData.getString('clickEdgeText'); |
| 11 $('section-steps--select-chrome').innerHTML = |
| 12 loadTimeData.getString('clickSelectChrome'); |
| 13 $('section-steps--right-click').innerHTML = |
| 14 loadTimeData.getString('rightClickText'); |
| 15 $('section-steps--pin-taskbar').innerHTML = |
| 16 loadTimeData.getString('pinInstructionText'); |
| 17 } |
| 18 |
| 19 function toggleSections(sections, screenshotImages) { |
| 20 sections.forEach(function(section) { |
| 21 section.classList.toggle('section--expanded'); |
| 22 }); |
| 23 screenshotImages.forEach(function(section) { |
| 24 section.classList.toggle('screenshot-image--visible'); |
| 25 }); |
| 26 } |
| 27 |
| 28 function onSetDefaultBrowser(e) { |
| 29 chrome.send('handleSetDefaultBrowser'); |
| 30 } |
| 31 |
| 32 function onContinue(e) { |
| 33 chrome.send('handleContinue'); |
| 34 } |
| 35 |
| 36 function initialize() { |
| 37 injectLocalizedStrings(); |
| 38 |
| 39 var sections = document.querySelectorAll('.section'); |
| 40 var screenshotImages = document.querySelectorAll('.screenshot-image'); |
| 41 sections.forEach(function(section) { |
| 42 var sectionHeading = section.querySelector('.section-heading'); |
| 43 sectionHeading.addEventListener('click', function() { |
| 44 toggleSections(sections, screenshotImages); |
| 45 }); |
| 46 }); |
| 47 |
| 48 $('set-default-button').addEventListener('click', onSetDefaultBrowser); |
| 49 $('continue-button').addEventListener('click', onContinue); |
| 50 } |
| 51 |
| 52 return { |
| 53 initialize: initialize |
| 54 }; |
| 55 }); |
| 56 |
| 57 document.addEventListener('DOMContentLoaded', welcome.initialize); |
OLD | NEW |