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