OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 function toggleHelpBox() { | 5 function toggleHelpBox() { |
6 var helpBoxOuter = $('help-box-outer'); | 6 var helpBoxOuter = $('help-box-outer'); |
7 helpBoxOuter.classList.toggle('hidden'); | 7 helpBoxOuter.classList.toggle('hidden'); |
8 var moreLessButton = $('more-less-button'); | 8 var moreLessButton = $('more-less-button'); |
9 if (helpBoxOuter.classList.contains('hidden')) { | 9 if (helpBoxOuter.classList.contains('hidden')) { |
10 moreLessButton.innerText = moreLessButton.moreText; | 10 moreLessButton.innerText = moreLessButton.moreText; |
11 } else { | 11 } else { |
12 moreLessButton.innerText = moreLessButton.lessText; | 12 moreLessButton.innerText = moreLessButton.lessText; |
13 } | 13 } |
14 } | 14 } |
15 | 15 |
16 function diagnoseErrors() { | 16 function diagnoseErrors() { |
17 window.domAutomationController.setAutomationId(1); | 17 window.domAutomationController.setAutomationId(1); |
18 window.domAutomationController.send('open_connectivity_diagnostics'); | 18 window.domAutomationController.send('open_connectivity_diagnostics'); |
19 } | 19 } |
20 | 20 |
21 // Subframes use a different layout but the same html file. This is to make it | 21 // Subframes use a different layout but the same html file. This is to make it |
22 // easier to support platforms that load the error page via different | 22 // easier to support platforms that load the error page via different |
23 // mechanisms (Currently just iOS). | 23 // mechanisms (Currently just iOS). |
24 if (window.top.location != window.location) | 24 if (window.top.location != window.location) |
25 document.documentElement.setAttribute('subframe', ''); | 25 document.documentElement.setAttribute('subframe', ''); |
26 | 26 |
27 // Re-renders the error page using |strings| as the dictionary of values. | 27 // Re-renders the error page using |strings| as the dictionary of values. |
28 // Used by NetErrorTabHelper to update DNS error pages with probe results. | 28 // Used by NetErrorTabHelper to update DNS error pages with probe results. |
29 function updateForDnsProbe(strings) { | 29 function updateForDnsProbe(strings) { |
30 i18nTemplate.process(document, strings); | |
31 var context = new JsEvalContext(strings); | 30 var context = new JsEvalContext(strings); |
32 jstProcess(context, $('t')); | 31 jstProcess(context, $('t')); |
33 } | 32 } |
34 | 33 |
35 // Given the classList property of an element, adds an icon class to the list | 34 // Given the classList property of an element, adds an icon class to the list |
36 // and removes the previously- | 35 // and removes the previously- |
37 function updateIconClass(classList, newClass) { | 36 function updateIconClass(classList, newClass) { |
38 var oldClass; | 37 var oldClass; |
39 | 38 |
40 if (classList.hasOwnProperty('last_icon_class')) { | 39 if (classList.hasOwnProperty('last_icon_class')) { |
41 oldClass = classList['last_icon_class']; | 40 oldClass = classList['last_icon_class']; |
42 if (oldClass == newClass) | 41 if (oldClass == newClass) |
43 return; | 42 return; |
44 } | 43 } |
45 | 44 |
46 classList.add(newClass); | 45 classList.add(newClass); |
47 if (oldClass !== undefined) | 46 if (oldClass !== undefined) |
48 classList.remove(oldClass); | 47 classList.remove(oldClass); |
49 | 48 |
50 classList['last_icon_class'] = newClass; | 49 classList['last_icon_class'] = newClass; |
51 } | 50 } |
OLD | NEW |