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 = document.getElementById('help-box-outer'); | 6 var helpBoxOuter = document.getElementById('help-box-outer'); |
7 helpBoxOuter.classList.toggle('hidden'); | 7 helpBoxOuter.classList.toggle('hidden'); |
8 var moreLessButton = document.getElementById('more-less-button'); | 8 var moreLessButton = document.getElementById('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 var extension_id = "idddmepepmjcgiedknnmlbadcokidhoa"; | 17 var extension_id = "idddmepepmjcgiedknnmlbadcokidhoa"; |
18 var diagnose_frame = document.getElementById('diagnose-frame'); | 18 var diagnose_frame = document.getElementById('diagnose-frame'); |
19 diagnose_frame.innerHTML = | 19 diagnose_frame.innerHTML = |
20 '<iframe src="chrome-extension://' + extension_id + | 20 '<iframe src="chrome-extension://' + extension_id + |
21 '/index.html"></iframe>'; | 21 '/index.html"></iframe>'; |
22 } | 22 } |
23 | 23 |
24 // Subframes use a different layout but the same html file. This is to make it | 24 // Subframes use a different layout but the same html file. This is to make it |
25 // easier to support platforms that load the error page via different | 25 // easier to support platforms that load the error page via different |
26 // mechanisms (Currently just iOS). | 26 // mechanisms (Currently just iOS). |
27 if (window.top.location != window.location) | 27 if (window.top.location != window.location) |
28 document.documentElement.setAttribute('subframe', ''); | 28 document.documentElement.setAttribute('subframe', ''); |
29 | 29 |
| 30 // Re-renders the error page using |strings| as the dictionary of values. |
| 31 // Used by NetErrorTabHelper to update DNS error pages with probe results. |
30 function updateForDnsProbe(strings) { | 32 function updateForDnsProbe(strings) { |
| 33 i18nTemplate.process(document, strings); |
31 var context = new JsEvalContext(strings); | 34 var context = new JsEvalContext(strings); |
32 jstProcess(context, document.getElementById('help-box-outer')); | 35 jstProcess(context, document.getElementById('t')); |
33 jstProcess(context, document.getElementById('details')); | 36 } |
| 37 |
| 38 // Given the classList property of an element, adds an icon class to the list |
| 39 // and removes the previously- |
| 40 function updateIconClass(classList, newClass) { |
| 41 var oldClass; |
| 42 |
| 43 if (classList.hasOwnProperty('last_icon_class')) { |
| 44 oldClass = classList['last_icon_class'] |
| 45 if (oldClass == newClass) |
| 46 return; |
| 47 } |
| 48 |
| 49 classList.add(newClass); |
| 50 if (oldClass !== undefined) |
| 51 classList.remove(oldClass); |
| 52 |
| 53 classList['last_icon_class'] = newClass; |
34 } | 54 } |
35 | 55 |
36 <if expr="is_macosx or is_ios or is_linux or is_android"> | 56 <if expr="is_macosx or is_ios or is_linux or is_android"> |
37 // Re-orders buttons. Used on Mac, Linux, and Android, where reload should go | 57 // Re-orders buttons. Used on Mac, Linux, and Android, where reload should go |
38 // on the right. | 58 // on the right. |
39 function swapButtonOrder() { | 59 function swapButtonOrder() { |
40 reloadButton = document.getElementById('reload-button'); | 60 reloadButton = document.getElementById('reload-button'); |
41 moreLessButton = document.getElementById('more-less-button'); | 61 moreLessButton = document.getElementById('more-less-button'); |
42 reloadButton.parentNode.insertBefore(moreLessButton, reloadButton); | 62 reloadButton.parentNode.insertBefore(moreLessButton, reloadButton); |
43 } | 63 } |
44 document.addEventListener("DOMContentLoaded", swapButtonOrder); | 64 document.addEventListener("DOMContentLoaded", swapButtonOrder); |
45 </if> | 65 </if> |
OLD | NEW |