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