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

Side by Side Diff: chrome/renderer/resources/neterror.js

Issue 599653003: Remove old template html boilerplate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bydefault
Patch Set: fix android Created 6 years, 2 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
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('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 11 matching lines...) Expand all
22 22
23 // Subframes use a different layout but the same html file. This is to make it 23 // Subframes use a different layout but the same html file. This is to make it
24 // easier to support platforms that load the error page via different 24 // easier to support platforms that load the error page via different
25 // mechanisms (Currently just iOS). 25 // mechanisms (Currently just iOS).
26 if (window.top.location != window.location) 26 if (window.top.location != window.location)
27 document.documentElement.setAttribute('subframe', ''); 27 document.documentElement.setAttribute('subframe', '');
28 28
29 // Re-renders the error page using |strings| as the dictionary of values. 29 // Re-renders the error page using |strings| as the dictionary of values.
30 // Used by NetErrorTabHelper to update DNS error pages with probe results. 30 // Used by NetErrorTabHelper to update DNS error pages with probe results.
31 function updateForDnsProbe(strings) { 31 function updateForDnsProbe(strings) {
32 i18nTemplate.process(document, strings);
33 var context = new JsEvalContext(strings); 32 var context = new JsEvalContext(strings);
34 jstProcess(context, document.getElementById('t')); 33 jstProcess(context, document.getElementById('t'));
35 } 34 }
36 35
37 // Given the classList property of an element, adds an icon class to the list 36 // Given the classList property of an element, adds an icon class to the list
38 // and removes the previously- 37 // and removes the previously-
39 function updateIconClass(classList, newClass) { 38 function updateIconClass(classList, newClass) {
40 var oldClass; 39 var oldClass;
41 40
42 if (classList.hasOwnProperty('last_icon_class')) { 41 if (classList.hasOwnProperty('last_icon_class')) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 function detailsButtonClick() { 100 function detailsButtonClick() {
102 if (window.errorPageController) 101 if (window.errorPageController)
103 errorPageController.detailsButtonClick(); 102 errorPageController.detailsButtonClick();
104 } 103 }
105 104
106 var primaryControlOnLeft = true; 105 var primaryControlOnLeft = true;
107 <if expr="is_macosx or is_ios or is_linux or is_android"> 106 <if expr="is_macosx or is_ios or is_linux or is_android">
108 primaryControlOnLeft = false; 107 primaryControlOnLeft = false;
109 </if> 108 </if>
110 109
111 // Sets up the proper button layout for the current platform. 110 function onDocumentLoad() {
112 function setButtonLayout() {
113 var buttonsDiv = document.getElementById('buttons'); 111 var buttonsDiv = document.getElementById('buttons');
114 var controlButtonDiv = document.getElementById('control-buttons'); 112 var controlButtonDiv = document.getElementById('control-buttons');
115 var reloadButton = document.getElementById('reload-button'); 113 var reloadButton = document.getElementById('reload-button');
116 var detailsButton = document.getElementById('details-button'); 114 var detailsButton = document.getElementById('details-button');
117 var staleLoadButton = document.getElementById('stale-load-button'); 115 var staleLoadButton = document.getElementById('stale-load-button');
118 116
119 var primaryButton = reloadButton; 117 var primaryButton = reloadButton;
120 var secondaryButton = staleLoadButton; 118 var secondaryButton = staleLoadButton;
121 119
120 // Sets up the proper button layout for the current platform.
122 if (primaryControlOnLeft) { 121 if (primaryControlOnLeft) {
123 buttons.classList.add('suggested-left'); 122 buttons.classList.add('suggested-left');
124 controlButtonDiv.insertBefore(primaryButton, secondaryButton); 123 controlButtonDiv.insertBefore(primaryButton, secondaryButton);
125 } else { 124 } else {
126 buttons.classList.add('suggested-right'); 125 buttons.classList.add('suggested-right');
127 controlButtonDiv.insertBefore(secondaryButton, primaryButton); 126 controlButtonDiv.insertBefore(secondaryButton, primaryButton);
128 } 127 }
129 128
130 if (reloadButton.style.display == 'none' && 129 if (reloadButton.style.display == 'none' &&
131 staleLoadButton.style.display == 'none') { 130 staleLoadButton.style.display == 'none') {
132 detailsButton.classList.add('singular'); 131 detailsButton.classList.add('singular');
133 } 132 }
134 133
135 if (templateData) { 134 // Hide the details button if there are no details to show.
136 // Hide the details button if there are no details to show. 135 if (loadTimeData.valueExists('summary') &&
137 if (templateData.summary && !templateData.summary.msg) { 136 !loadTimeData.getValue('summary').msg) {
138 detailsButton.hidden = true; 137 detailsButton.hidden = true;
139 document.getElementById('help-box-outer').style.display = 'block'; 138 document.getElementById('help-box-outer').style.display = 'block';
140 } 139 }
141 140
142 // Show control buttons. 141 // Show control buttons.
143 if (templateData.reloadButton && templateData.reloadButton.msg || 142 if (loadTimeData.valueExists('reloadButton') &&
144 templateData.staleLoadButton && templateData.staleLoadButton.msg) { 143 loadTimeData.getValue('reloadButton').msg ||
145 controlButtonDiv.hidden = false; 144 loadTimeData.valueExists('staleLoadButton') &&
146 } 145 loadTimeData.getValue('staleLoadButton').msg) {
146 controlButtonDiv.hidden = false;
147 }
148
149 // Add a main message paragraph.
150 if (loadTimeData.valueExists('primaryParagraph')) {
151 var p = document.querySelector('#main-message p');
152 p.textContent = loadTimeData.getString('primaryParagraph');
153 p.hidden = false;
147 } 154 }
148 } 155 }
149 156
150 document.addEventListener('DOMContentLoaded', setButtonLayout); 157 document.addEventListener('DOMContentLoaded', onDocumentLoad);
OLDNEW
« no previous file with comments | « chrome/renderer/resources/neterror.html ('k') | components/dom_distiller/webui/dom_distiller_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698