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('inline', function() { |
| 6 'use strict'; |
| 7 |
| 8 function onContinue() { |
| 9 chrome.send('handleContinue'); |
| 10 } |
| 11 |
| 12 function onOpenSettings() { |
| 13 chrome.send('handleSetDefaultBrowser'); |
| 14 } |
| 15 |
| 16 function onToggle(app) { |
| 17 if (app.isCombined) { |
| 18 var sections = document.querySelectorAll('.section.expandable'); |
| 19 sections.forEach(function(section) { |
| 20 section.classList.toggle('expanded'); |
| 21 }); |
| 22 } |
| 23 } |
| 24 |
| 25 function computeClasses(isCombined) { |
| 26 if (isCombined) |
| 27 return 'section expandable expanded'; |
| 28 return 'section'; |
| 29 } |
| 30 |
| 31 function initialize() { |
| 32 var app = $('inline-app'); |
| 33 |
| 34 app.isCombined = window.location.href.includes('variant=combined'); |
| 35 |
| 36 // Set handlers. |
| 37 app.computeClasses = computeClasses; |
| 38 app.onContinue = onContinue; |
| 39 app.onOpenSettings = onOpenSettings; |
| 40 app.onToggle = onToggle.bind(this, app); |
| 41 } |
| 42 |
| 43 return { |
| 44 initialize: initialize |
| 45 }; |
| 46 }); |
| 47 |
| 48 document.addEventListener('DOMContentLoaded', inline.initialize); |
OLD | NEW |