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

Side by Side Diff: chrome/browser/resources/plugins.js

Issue 9958101: [WebUI] Fix rest of CSS style nits in misc. dirs so I can turn on CSS checker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/plugins.css ('k') | chrome/browser/resources/policy.css » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * This variable structure is here to document the structure that the template 6 * This variable structure is here to document the structure that the template
7 * expects to correctly populate the page. 7 * expects to correctly populate the page.
8 */ 8 */
9 var pluginDataFormat = { 9 var pluginDataFormat = {
10 'plugins': [ 10 'plugins': [
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 chrome.send('getShowDetails', []); 95 chrome.send('getShowDetails', []);
96 } 96 }
97 97
98 function loadShowDetailsFromPrefs(show_details) { 98 function loadShowDetailsFromPrefs(show_details) {
99 tmiModeExpanded = show_details; 99 tmiModeExpanded = show_details;
100 document.getElementById('collapse').style.display = 100 document.getElementById('collapse').style.display =
101 show_details ? 'inline' : 'none'; 101 show_details ? 'inline' : 'none';
102 document.getElementById('expand').style.display = 102 document.getElementById('expand').style.display =
103 show_details ? 'none' : 'inline'; 103 show_details ? 'none' : 'inline';
104 104
105 document.body.className = 105 document.body.className = show_details ? 'show-tmi-mode' : 'hide-tmi-mode';
106 show_details ? 'showTmiMode' : 'hideTmiMode';
107 } 106 }
108 107
109 /** 108 /**
110 * Called by the web_ui_ to re-populate the page with data representing the 109 * Called by the web_ui_ to re-populate the page with data representing the
111 * current state of installed plugins. 110 * current state of installed plugins.
112 */ 111 */
113 function returnPluginsData(pluginsData){ 112 function returnPluginsData(pluginsData){
114 var bodyContainer = document.getElementById('body-container'); 113 var bodyContainer = document.getElementById('body-container');
115 var body = document.body; 114 var body = document.body;
116 115
117 // Set all page content to be visible so we can measure heights. 116 // Set all page content to be visible so we can measure heights.
118 bodyContainer.style.visibility = 'hidden'; 117 bodyContainer.style.visibility = 'hidden';
119 body.className = ''; 118 body.className = '';
120 var slidables = document.getElementsByClassName('showInTmiMode'); 119 var slidables = document.getElementsByClassName('show-in-tmi-mode');
121 for (var i = 0; i < slidables.length; i++) 120 for (var i = 0; i < slidables.length; i++)
122 slidables[i].style.height = 'auto'; 121 slidables[i].style.height = 'auto';
123 122
124 renderTemplate(pluginsData); 123 renderTemplate(pluginsData);
125 124
126 // Add handlers to dynamically created HTML elements. 125 // Add handlers to dynamically created HTML elements.
127 var links = document.getElementsByClassName('disable-plugin-link'); 126 var links = document.getElementsByClassName('disable-plugin-link');
128 for (var i = 0; i < links.length; i++) { 127 for (var i = 0; i < links.length; i++) {
129 links[i].onclick = function () { 128 links[i].onclick = function () {
130 handleEnablePlugin(this, false, false); 129 handleEnablePlugin(this, false, false);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 var maxLabelWidth = 0; 164 var maxLabelWidth = 0;
166 for (var i = 0; i < labels.length; i++) 165 for (var i = 0; i < labels.length; i++)
167 labels[i].style.width = 'auto'; 166 labels[i].style.width = 'auto';
168 for (var i = 0; i < labels.length; i++) 167 for (var i = 0; i < labels.length; i++)
169 maxLabelWidth = Math.max(maxLabelWidth, labels[i].offsetWidth); 168 maxLabelWidth = Math.max(maxLabelWidth, labels[i].offsetWidth);
170 for (var i = 0; i < labels.length; i++) 169 for (var i = 0; i < labels.length; i++)
171 labels[i].style.width = maxLabelWidth + 'px'; 170 labels[i].style.width = maxLabelWidth + 'px';
172 171
173 // Explicitly set the height for each element that wants to be "slid" in and 172 // Explicitly set the height for each element that wants to be "slid" in and
174 // out when the tmiModeExpanded is toggled. 173 // out when the tmiModeExpanded is toggled.
175 var slidables = document.getElementsByClassName('showInTmiMode'); 174 var slidables = document.getElementsByClassName('show-in-tmi-mode');
176 for (var i = 0; i < slidables.length; i++) 175 for (var i = 0; i < slidables.length; i++)
177 slidables[i].style.height = slidables[i].offsetHeight + 'px'; 176 slidables[i].style.height = slidables[i].offsetHeight + 'px';
178 177
179 // Reset visibility of page based on the current tmi mode. 178 // Reset visibility of page based on the current tmi mode.
180 document.getElementById('collapse').style.display = 179 document.getElementById('collapse').style.display =
181 tmiModeExpanded ? 'inline' : 'none'; 180 tmiModeExpanded ? 'inline' : 'none';
182 document.getElementById('expand').style.display = 181 document.getElementById('expand').style.display =
183 tmiModeExpanded ? 'none' : 'inline'; 182 tmiModeExpanded ? 'none' : 'inline';
184 bodyContainer.style.visibility = 'visible'; 183 bodyContainer.style.visibility = 'visible';
185 body.className = tmiModeExpanded ? 184 body.className = tmiModeExpanded ?
186 'showTmiModeInitial' : 'hideTmiModeInitial'; 185 'show-tmi-mode-initial' : 'hide-tmi-mode-initial';
187 } 186 }
188 187
189 /** 188 /**
190 * Handles a 'enable' or 'disable' button getting clicked. 189 * Handles a 'enable' or 'disable' button getting clicked.
191 */ 190 */
192 function handleEnablePlugin(node, enable, isGroup) { 191 function handleEnablePlugin(node, enable, isGroup) {
193 // Tell the C++ PluginsDOMHandler to enable/disable the plugin. 192 // Tell the C++ PluginsDOMHandler to enable/disable the plugin.
194 chrome.send('enablePlugin', [String(node.path), String(enable), 193 chrome.send('enablePlugin', [String(node.path), String(enable),
195 String(isGroup)]); 194 String(isGroup)]);
196 } 195 }
197 196
198 // Keeps track of whether details have been made visible (expanded) or not. 197 // Keeps track of whether details have been made visible (expanded) or not.
199 var tmiModeExpanded = false; 198 var tmiModeExpanded = false;
200 199
201 /* 200 /*
202 * Toggles visibility of details. 201 * Toggles visibility of details.
203 */ 202 */
204 function toggleTmiMode() { 203 function toggleTmiMode() {
205 tmiModeExpanded = !tmiModeExpanded; 204 tmiModeExpanded = !tmiModeExpanded;
206 205
207 document.getElementById('collapse').style.display = 206 document.getElementById('collapse').style.display =
208 tmiModeExpanded ? 'inline' : 'none'; 207 tmiModeExpanded ? 'inline' : 'none';
209 document.getElementById('expand').style.display = 208 document.getElementById('expand').style.display =
210 tmiModeExpanded ? 'none' : 'inline'; 209 tmiModeExpanded ? 'none' : 'inline';
211 210
212 document.body.className = 211 document.body.className =
213 tmiModeExpanded ? 'showTmiMode' : 'hideTmiMode'; 212 tmiModeExpanded ? 'show-tmi-mode' : 'hide-tmi-mode';
214 213
215 chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]); 214 chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]);
216 } 215 }
217 216
218 function handleSetPluginAlwaysAllowed(el) { 217 function handleSetPluginAlwaysAllowed(el) {
219 chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]); 218 chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]);
220 } 219 }
221 220
222 /** 221 /**
223 * Determines whether a plugin's version should be displayed. 222 * Determines whether a plugin's version should be displayed.
(...skipping 28 matching lines...) Expand all
252 setInterval(requestPluginsData, 30000); 251 setInterval(requestPluginsData, 30000);
253 252
254 // Get data and have it displayed upon loading. 253 // Get data and have it displayed upon loading.
255 document.addEventListener('DOMContentLoaded', requestPluginsData); 254 document.addEventListener('DOMContentLoaded', requestPluginsData);
256 255
257 // Add handlers to static HTML elements. 256 // Add handlers to static HTML elements.
258 document.getElementById('collapse').onclick = toggleTmiMode; 257 document.getElementById('collapse').onclick = toggleTmiMode;
259 document.getElementById('expand').onclick = toggleTmiMode; 258 document.getElementById('expand').onclick = toggleTmiMode;
260 document.getElementById('details-link').onclick = toggleTmiMode; 259 document.getElementById('details-link').onclick = toggleTmiMode;
261 260
OLDNEW
« no previous file with comments | « chrome/browser/resources/plugins.css ('k') | chrome/browser/resources/policy.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698