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 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; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 oldClass = classList['last_icon_class']; | 43 oldClass = classList['last_icon_class']; |
44 if (oldClass == newClass) | 44 if (oldClass == newClass) |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
48 classList.add(newClass); | 48 classList.add(newClass); |
49 if (oldClass !== undefined) | 49 if (oldClass !== undefined) |
50 classList.remove(oldClass); | 50 classList.remove(oldClass); |
51 | 51 |
52 classList['last_icon_class'] = newClass; | 52 classList['last_icon_class'] = newClass; |
| 53 |
| 54 if (newClass == 'icon-offline') { |
| 55 document.body.classList.add('offline'); |
| 56 new Runner('.interstitial-wrapper'); |
| 57 } |
53 } | 58 } |
54 | 59 |
55 // Does a search using |baseSearchUrl| and the text in the search box. | 60 // Does a search using |baseSearchUrl| and the text in the search box. |
56 function search(baseSearchUrl) { | 61 function search(baseSearchUrl) { |
57 var searchTextNode = document.getElementById('search-box'); | 62 var searchTextNode = document.getElementById('search-box'); |
58 document.location = baseSearchUrl + searchTextNode.value; | 63 document.location = baseSearchUrl + searchTextNode.value; |
59 return false; | 64 return false; |
60 } | 65 } |
61 | 66 |
62 // Use to track clicks on elements generated by the navigation correction | 67 // Use to track clicks on elements generated by the navigation correction |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 } else { | 125 } else { |
121 buttons.classList.add('suggested-right'); | 126 buttons.classList.add('suggested-right'); |
122 controlButtonDiv.insertBefore(secondaryButton, primaryButton); | 127 controlButtonDiv.insertBefore(secondaryButton, primaryButton); |
123 } | 128 } |
124 | 129 |
125 if (reloadButton.style.display == 'none' && | 130 if (reloadButton.style.display == 'none' && |
126 staleLoadButton.style.display == 'none') { | 131 staleLoadButton.style.display == 'none') { |
127 detailsButton.classList.add('singular'); | 132 detailsButton.classList.add('singular'); |
128 } | 133 } |
129 | 134 |
130 // Hide the details button if there are no details to show. | 135 if (templateData) { |
131 if (templateData && templateData.summary && !templateData.summary.msg) { | 136 // Hide the details button if there are no details to show. |
132 document.getElementById('details-button').hidden = true; | 137 if (templateData.summary && !templateData.summary.msg) { |
133 document.getElementById('help-box-outer').style.display = 'block'; | 138 detailsButton.hidden = true; |
| 139 document.getElementById('help-box-outer').style.display = 'block'; |
| 140 } |
| 141 |
| 142 // Show control buttons. |
| 143 if (templateData.reloadButton && templateData.reloadButton.msg || |
| 144 templateData.staleLoadButton && templateData.staleLoadButton.msg) { |
| 145 controlButtonDiv.hidden = false; |
| 146 } |
134 } | 147 } |
135 } | 148 } |
136 | 149 |
137 document.addEventListener('DOMContentLoaded', function() { | 150 document.addEventListener('DOMContentLoaded', setButtonLayout); |
138 setButtonLayout(); | |
139 if (document.querySelector('.icon-offline')) { | |
140 document.body.classList.add('offline'); | |
141 new Runner('.interstitial-wrapper'); | |
142 } | |
143 }); | |
OLD | NEW |