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('details'); | 6 var helpBoxOuter = document.getElementById('help-box-outer'); |
7 helpBoxOuter.classList.toggle('hidden'); | 7 helpBoxOuter.classList.toggle('hidden'); |
8 var detailsButton = document.getElementById('details-button'); | 8 var detailsButton = document.getElementById('details-button'); |
9 if (helpBoxOuter.classList.contains('hidden')) | 9 if (helpBoxOuter.classList.contains('hidden')) |
10 detailsButton.innerText = detailsButton.detailsText; | 10 detailsButton.innerText = detailsButton.detailsText; |
11 else | 11 else |
12 detailsButton.innerText = detailsButton.hideDetailsText; | 12 detailsButton.innerText = detailsButton.hideDetailsText; |
13 | |
14 // Details appears over the main content on small screens. | |
15 if (mobileNav) | |
16 document.getElementById('main-content').classList.toggle('hidden'); | |
17 } | 13 } |
18 | 14 |
19 function diagnoseErrors() { | 15 function diagnoseErrors() { |
20 var extensionId = 'idddmepepmjcgiedknnmlbadcokidhoa'; | 16 var extensionId = 'idddmepepmjcgiedknnmlbadcokidhoa'; |
21 var diagnoseFrame = document.getElementById('diagnose-frame'); | 17 var diagnoseFrame = document.getElementById('diagnose-frame'); |
22 diagnoseFrame.innerHTML = | 18 diagnoseFrame.innerHTML = |
23 '<iframe src="chrome-extension://' + extensionId + | 19 '<iframe src="chrome-extension://' + extensionId + |
24 '/index.html"></iframe>'; | 20 '/index.html"></iframe>'; |
25 } | 21 } |
26 | 22 |
(...skipping 23 matching lines...) Expand all Loading... |
50 | 46 |
51 classList.add(newClass); | 47 classList.add(newClass); |
52 if (oldClass !== undefined) | 48 if (oldClass !== undefined) |
53 classList.remove(oldClass); | 49 classList.remove(oldClass); |
54 | 50 |
55 classList['last_icon_class'] = newClass; | 51 classList['last_icon_class'] = newClass; |
56 | 52 |
57 if (newClass == 'icon-offline') { | 53 if (newClass == 'icon-offline') { |
58 document.body.classList.add('offline'); | 54 document.body.classList.add('offline'); |
59 new Runner('.interstitial-wrapper'); | 55 new Runner('.interstitial-wrapper'); |
60 } else { | |
61 document.body.classList.add('neterror'); | |
62 } | 56 } |
63 } | 57 } |
64 | 58 |
65 // Does a search using |baseSearchUrl| and the text in the search box. | 59 // Does a search using |baseSearchUrl| and the text in the search box. |
66 function search(baseSearchUrl) { | 60 function search(baseSearchUrl) { |
67 var searchTextNode = document.getElementById('search-box'); | 61 var searchTextNode = document.getElementById('search-box'); |
68 document.location = baseSearchUrl + searchTextNode.value; | 62 document.location = baseSearchUrl + searchTextNode.value; |
69 return false; | 63 return false; |
70 } | 64 } |
71 | 65 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 if (reloadButton.style.display == 'none' && | 129 if (reloadButton.style.display == 'none' && |
136 staleLoadButton.style.display == 'none') { | 130 staleLoadButton.style.display == 'none') { |
137 detailsButton.classList.add('singular'); | 131 detailsButton.classList.add('singular'); |
138 } | 132 } |
139 | 133 |
140 <if expr="not chromeos"> | 134 <if expr="not chromeos"> |
141 // Hide the details button if there are no details to show. | 135 // Hide the details button if there are no details to show. |
142 if (loadTimeData.valueExists('summary') && | 136 if (loadTimeData.valueExists('summary') && |
143 !loadTimeData.getValue('summary').msg) { | 137 !loadTimeData.getValue('summary').msg) { |
144 detailsButton.style.display = 'none'; | 138 detailsButton.style.display = 'none'; |
145 document.getElementById('details').style.display = 'block'; | 139 document.getElementById('help-box-outer').style.display = 'block'; |
146 } | 140 } |
147 </if> | 141 </if> |
148 | 142 |
149 // Show control buttons. | 143 // Show control buttons. |
150 if (loadTimeData.valueExists('reloadButton') && | 144 if (loadTimeData.valueExists('reloadButton') && |
151 loadTimeData.getValue('reloadButton').msg || | 145 loadTimeData.getValue('reloadButton').msg || |
152 loadTimeData.valueExists('staleLoadButton') && | 146 loadTimeData.valueExists('staleLoadButton') && |
153 loadTimeData.getValue('staleLoadButton').msg) { | 147 loadTimeData.getValue('staleLoadButton').msg) { |
154 controlButtonDiv.hidden = false; | 148 controlButtonDiv.hidden = false; |
155 } | 149 } |
156 | 150 |
157 // Add a main message paragraph. | 151 // Add a main message paragraph. |
158 if (loadTimeData.valueExists('primaryParagraph')) { | 152 if (loadTimeData.valueExists('primaryParagraph')) { |
159 var p = document.querySelector('#main-message p'); | 153 var p = document.querySelector('#main-message p'); |
160 p.innerHTML = loadTimeData.getString('primaryParagraph'); | 154 p.innerHTML = loadTimeData.getString('primaryParagraph'); |
161 p.hidden = false; | 155 p.hidden = false; |
162 } | 156 } |
163 } | 157 } |
164 | 158 |
165 document.addEventListener('DOMContentLoaded', onDocumentLoad); | 159 document.addEventListener('DOMContentLoaded', onDocumentLoad); |
OLD | NEW |