| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 <if expr="not chromeos"> | 140 <if expr="not chromeos"> |
| 135 // Hide the details button if there are no details to show. | 141 // Hide the details button if there are no details to show. |
| 136 if (loadTimeData.valueExists('summary') && | 142 if (loadTimeData.valueExists('summary') && |
| 137 !loadTimeData.getValue('summary').msg) { | 143 !loadTimeData.getValue('summary').msg) { |
| 138 detailsButton.style.display = 'none'; | 144 detailsButton.style.display = 'none'; |
| 139 document.getElementById('help-box-outer').style.display = 'block'; | 145 document.getElementById('details').style.display = 'block'; |
| 140 } | 146 } |
| 141 </if> | 147 </if> |
| 142 | 148 |
| 143 // Show control buttons. | 149 // Show control buttons. |
| 144 if (loadTimeData.valueExists('reloadButton') && | 150 if (loadTimeData.valueExists('reloadButton') && |
| 145 loadTimeData.getValue('reloadButton').msg || | 151 loadTimeData.getValue('reloadButton').msg || |
| 146 loadTimeData.valueExists('staleLoadButton') && | 152 loadTimeData.valueExists('staleLoadButton') && |
| 147 loadTimeData.getValue('staleLoadButton').msg) { | 153 loadTimeData.getValue('staleLoadButton').msg) { |
| 148 controlButtonDiv.hidden = false; | 154 controlButtonDiv.hidden = false; |
| 149 } | 155 } |
| 150 | 156 |
| 151 // Add a main message paragraph. | 157 // Add a main message paragraph. |
| 152 if (loadTimeData.valueExists('primaryParagraph')) { | 158 if (loadTimeData.valueExists('primaryParagraph')) { |
| 153 var p = document.querySelector('#main-message p'); | 159 var p = document.querySelector('#main-message p'); |
| 154 p.innerHTML = loadTimeData.getString('primaryParagraph'); | 160 p.innerHTML = loadTimeData.getString('primaryParagraph'); |
| 155 p.hidden = false; | 161 p.hidden = false; |
| 156 } | 162 } |
| 157 } | 163 } |
| 158 | 164 |
| 159 document.addEventListener('DOMContentLoaded', onDocumentLoad); | 165 document.addEventListener('DOMContentLoaded', onDocumentLoad); |
| OLD | NEW |