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 detailsButton = document.getElementById('details-button'); |
9 if (helpBoxOuter.classList.contains('hidden')) { | 9 if (helpBoxOuter.classList.contains('hidden')) { |
10 moreLessButton.innerText = moreLessButton.moreText; | 10 detailsButton.innerText = detailsButton.detailsText; |
11 } else { | 11 } else { |
12 moreLessButton.innerText = moreLessButton.lessText; | 12 detailsButton.innerText = detailsButton.hideDetailsText; |
13 } | 13 } |
14 } | 14 } |
15 | 15 |
16 function diagnoseErrors() { | 16 function diagnoseErrors() { |
17 var extension_id = "idddmepepmjcgiedknnmlbadcokidhoa"; | 17 var extensionId = 'idddmepepmjcgiedknnmlbadcokidhoa'; |
18 var diagnose_frame = document.getElementById('diagnose-frame'); | 18 var diagnoseFrame = document.getElementById('diagnose-frame'); |
19 diagnose_frame.innerHTML = | 19 diagnoseFrame.innerHTML = |
20 '<iframe src="chrome-extension://' + extension_id + | 20 '<iframe src="chrome-extension://' + extensionId + |
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. | 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. | 31 // Used by NetErrorTabHelper to update DNS error pages with probe results. |
32 function updateForDnsProbe(strings) { | 32 function updateForDnsProbe(strings) { |
33 i18nTemplate.process(document, strings); | 33 i18nTemplate.process(document, strings); |
34 var context = new JsEvalContext(strings); | 34 var context = new JsEvalContext(strings); |
35 jstProcess(context, document.getElementById('t')); | 35 jstProcess(context, document.getElementById('t')); |
36 } | 36 } |
37 | 37 |
38 // Given the classList property of an element, adds an icon class to the list | 38 // Given the classList property of an element, adds an icon class to the list |
39 // and removes the previously- | 39 // and removes the previously- |
40 function updateIconClass(classList, newClass) { | 40 function updateIconClass(classList, newClass) { |
41 var oldClass; | 41 var oldClass; |
42 | 42 |
43 if (classList.hasOwnProperty('last_icon_class')) { | 43 if (classList.hasOwnProperty('last_icon_class')) { |
44 oldClass = classList['last_icon_class'] | 44 oldClass = classList['last_icon_class']; |
45 if (oldClass == newClass) | 45 if (oldClass == newClass) |
46 return; | 46 return; |
47 } | 47 } |
48 | 48 |
49 classList.add(newClass); | 49 classList.add(newClass); |
50 if (oldClass !== undefined) | 50 if (oldClass !== undefined) |
51 classList.remove(oldClass); | 51 classList.remove(oldClass); |
52 | 52 |
53 classList['last_icon_class'] = newClass; | 53 classList['last_icon_class'] = newClass; |
54 } | 54 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 location = url; | 87 location = url; |
88 } | 88 } |
89 } | 89 } |
90 | 90 |
91 function loadStaleButtonClick() { | 91 function loadStaleButtonClick() { |
92 if (window.errorPageController) { | 92 if (window.errorPageController) { |
93 errorPageController.loadStaleButtonClick(); | 93 errorPageController.loadStaleButtonClick(); |
94 } | 94 } |
95 } | 95 } |
96 | 96 |
97 function moreButtonClick() { | 97 function detailsButtonClick() { |
98 if (window.errorPageController) { | 98 if (window.errorPageController) { |
99 errorPageController.moreButtonClick(); | 99 errorPageController.detailsButtonClick(); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 <if expr="is_macosx or is_ios or is_linux or is_android"> | |
104 // Re-orders buttons. Used on Mac, Linux, and Android, where reload should go | 103 // Re-orders buttons. Used on Mac, Linux, and Android, where reload should go |
105 // on the right. | 104 // on the right. |
mmenke
2014/08/01 18:29:33
This comment is no longer accurate. It's used eve
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
Done.
| |
106 function swapButtonOrder() { | 105 function swapButtonOrder() { |
106 var buttonDiv = document.getElementById('buttons'); | |
107 var reloadButton = document.getElementById('reload-button'); | 107 var reloadButton = document.getElementById('reload-button'); |
108 var moreLessButton = document.getElementById('more-less-button'); | 108 var detailsButton = document.getElementById('details-button'); |
109 var staleLoadButton = document.getElementById('stale-load-button'); | 109 var staleLoadButton = document.getElementById('stale-load-button'); |
110 reloadButton.parentNode.insertBefore(moreLessButton, reloadButton); | 110 |
111 reloadButton.parentNode.insertBefore(staleLoadButton, reloadButton) | 111 var primary = reloadButton; |
112 var secondary = staleLoadButton; | |
113 var primary_leftmost = true; | |
mmenke
2014/08/01 18:29:33
nit: primaryLeftmost... Or maybe primaryControlO
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
Done.
| |
114 <if expr="is_macosx or is_ios or is_linux or is_android"> | |
115 primary_leftmost = false; | |
116 </if> | |
117 | |
118 if (primary_leftmost) { | |
119 buttonDiv.insertBefore(primary, detailsButton); | |
120 buttonDiv.insertBefore(secondary, detailsButton); | |
mmenke
2014/08/01 18:29:33
Suggestion: Put the buttons in their own div, and
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
Thank you for nudging me again on this suggestions
| |
121 primary.style['float'] = "left"; | |
mmenke
2014/08/01 18:29:33
Use single quotes for JS strings.
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
Done.
| |
122 secondary.style['float'] = "left"; | |
123 detailsButton.style['float'] = "right"; | |
124 } else { | |
125 buttonDiv.insertBefore(detailsButton, primary); | |
126 buttonDiv.insertBefore(secondary, primary); | |
127 primary.style['float'] = "right"; | |
128 secondary.style['float'] = "right"; | |
129 detailsButton.style['float'] = "left"; | |
mmenke
2014/08/01 18:29:33
I could be wrong, but I suspect you're going to ge
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
I switched over to CSS, and combined with your sug
| |
130 } | |
131 | |
132 if (reloadButton.style.display == "none" && | |
133 staleLoadButton.style.display == "none") { | |
134 detailsButton.style['float'] = "center"; | |
mmenke
2014/08/01 18:29:33
I don't believe there is a such thing as float: ce
Randy Smith (Not in Mondays)
2014/08/01 20:28:24
Done.
| |
135 } | |
112 } | 136 } |
113 document.addEventListener("DOMContentLoaded", swapButtonOrder); | 137 document.addEventListener('DOMContentLoaded', swapButtonOrder); |
114 </if> | |
OLD | NEW |