Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: components/neterror/resources/neterror.js

Issue 1750113002: Remove "Show saved copy" button from error page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/neterror/resources/neterror.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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('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;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 errorPageController.showSavedCopyButtonClick(); 113 errorPageController.showSavedCopyButtonClick();
114 } 114 }
115 } 115 }
116 116
117 function showOfflinePagesButtonClick() { 117 function showOfflinePagesButtonClick() {
118 if (window.errorPageController) { 118 if (window.errorPageController) {
119 errorPageController.showOfflinePagesButtonClick(); 119 errorPageController.showOfflinePagesButtonClick();
120 } 120 }
121 } 121 }
122 122
123 function showOfflineCopyButtonClick() {
124 if (window.errorPageController) {
125 errorPageController.showOfflineCopyButtonClick();
126 }
127 }
128
129 function detailsButtonClick() { 123 function detailsButtonClick() {
130 if (window.errorPageController) 124 if (window.errorPageController)
131 errorPageController.detailsButtonClick(); 125 errorPageController.detailsButtonClick();
132 } 126 }
133 127
134 /** 128 /**
135 * Replace the reload button with the Google cached copy suggestion. 129 * Replace the reload button with the Google cached copy suggestion.
136 */ 130 */
137 function setUpCachedButton(buttonStrings) { 131 function setUpCachedButton(buttonStrings) {
138 var reloadButton = document.getElementById('reload-button'); 132 var reloadButton = document.getElementById('reload-button');
(...skipping 18 matching lines...) Expand all
157 primaryControlOnLeft = false; 151 primaryControlOnLeft = false;
158 </if> 152 </if>
159 153
160 function onDocumentLoad() { 154 function onDocumentLoad() {
161 var controlButtonDiv = document.getElementById('control-buttons'); 155 var controlButtonDiv = document.getElementById('control-buttons');
162 var reloadButton = document.getElementById('reload-button'); 156 var reloadButton = document.getElementById('reload-button');
163 var detailsButton = document.getElementById('details-button'); 157 var detailsButton = document.getElementById('details-button');
164 var showSavedCopyButton = document.getElementById('show-saved-copy-button'); 158 var showSavedCopyButton = document.getElementById('show-saved-copy-button');
165 var showOfflinePagesButton = 159 var showOfflinePagesButton =
166 document.getElementById('show-offline-pages-button'); 160 document.getElementById('show-offline-pages-button');
167 var showOfflineCopyButton =
168 document.getElementById('show-offline-copy-button');
169 161
170 var reloadButtonVisible = loadTimeData.valueExists('reloadButton') && 162 var reloadButtonVisible = loadTimeData.valueExists('reloadButton') &&
171 loadTimeData.getValue('reloadButton').msg; 163 loadTimeData.getValue('reloadButton').msg;
172 var showSavedCopyButtonVisible = 164 var showSavedCopyButtonVisible =
173 loadTimeData.valueExists('showSavedCopyButton') && 165 loadTimeData.valueExists('showSavedCopyButton') &&
174 loadTimeData.getValue('showSavedCopyButton').msg; 166 loadTimeData.getValue('showSavedCopyButton').msg;
175 var showOfflinePagesButtonVisible = 167 var showOfflinePagesButtonVisible =
176 loadTimeData.valueExists('showOfflinePagesButton') && 168 loadTimeData.valueExists('showOfflinePagesButton') &&
177 loadTimeData.getValue('showOfflinePagesButton').msg; 169 loadTimeData.getValue('showOfflinePagesButton').msg;
178 var showOfflineCopyButtonVisible =
179 loadTimeData.valueExists('showOfflineCopyButton') &&
180 loadTimeData.getValue('showOfflineCopyButton').msg;
181 170
182 var primaryButton, secondaryButton; 171 var primaryButton, secondaryButton;
183 if (showSavedCopyButton.primary) { 172 if (showSavedCopyButton.primary) {
184 primaryButton = showSavedCopyButton; 173 primaryButton = showSavedCopyButton;
185 secondaryButton = reloadButton; 174 secondaryButton = reloadButton;
186 } else { 175 } else {
187 primaryButton = reloadButton; 176 primaryButton = reloadButton;
188 secondaryButton = showSavedCopyButton; 177 secondaryButton = showSavedCopyButton;
189 } 178 }
190 179
191 // Sets up the proper button layout for the current platform. 180 // Sets up the proper button layout for the current platform.
192 if (primaryControlOnLeft) { 181 if (primaryControlOnLeft) {
193 buttons.classList.add('suggested-left'); 182 buttons.classList.add('suggested-left');
194 controlButtonDiv.insertBefore(secondaryButton, primaryButton); 183 controlButtonDiv.insertBefore(secondaryButton, primaryButton);
195 } else { 184 } else {
196 buttons.classList.add('suggested-right'); 185 buttons.classList.add('suggested-right');
197 controlButtonDiv.insertBefore(primaryButton, secondaryButton); 186 controlButtonDiv.insertBefore(primaryButton, secondaryButton);
198 } 187 }
199 188
200 // Check for Google cached copy suggestion. 189 // Check for Google cached copy suggestion.
201 if (loadTimeData.valueExists('cacheButton')) { 190 if (loadTimeData.valueExists('cacheButton')) {
202 setUpCachedButton(loadTimeData.getValue('cacheButton')); 191 setUpCachedButton(loadTimeData.getValue('cacheButton'));
203 } 192 }
204 193
205 if (reloadButton.style.display == 'none' && 194 if (reloadButton.style.display == 'none' &&
206 showSavedCopyButton.style.display == 'none' && 195 showSavedCopyButton.style.display == 'none' &&
207 showOfflinePagesButton.style.display == 'none' && 196 showOfflinePagesButton.style.display == 'none') {
208 showOfflineCopyButton.style.display == 'none') {
209 detailsButton.classList.add('singular'); 197 detailsButton.classList.add('singular');
210 } 198 }
211 199
212 // Show control buttons. 200 // Show control buttons.
213 if (reloadButtonVisible || showSavedCopyButtonVisible || 201 if (reloadButtonVisible || showSavedCopyButtonVisible ||
214 showOfflinePagesButtonVisible || showOfflineCopyButton) { 202 showOfflinePagesButtonVisible) {
215 controlButtonDiv.hidden = false; 203 controlButtonDiv.hidden = false;
216 204
217 // Set the secondary button state in the cases of two call to actions. 205 // Set the secondary button state in the cases of two call to actions.
218 if ((reloadButtonVisible || showOfflinePagesButtonVisible || 206 if ((reloadButtonVisible || showOfflinePagesButtonVisible) &&
219 showOfflineCopyButton) &&
220 showSavedCopyButtonVisible) { 207 showSavedCopyButtonVisible) {
221 secondaryButton.classList.add('secondary-button'); 208 secondaryButton.classList.add('secondary-button');
222 } 209 }
223 } 210 }
224 } 211 }
225 212
226 document.addEventListener('DOMContentLoaded', onDocumentLoad); 213 document.addEventListener('DOMContentLoaded', onDocumentLoad);
OLDNEW
« no previous file with comments | « components/neterror/resources/neterror.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698