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

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: removing .py files 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
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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 =
106 show_details ? 'showTmiMode' : 'hideTmiMode'; 106 show_details ? 'show-tmi-mode' : 'hide-tmi-mode';
107 } 107 }
108 108
109 /** 109 /**
110 * Called by the web_ui_ to re-populate the page with data representing the 110 * Called by the web_ui_ to re-populate the page with data representing the
111 * current state of installed plugins. 111 * current state of installed plugins.
112 */ 112 */
113 function returnPluginsData(pluginsData){ 113 function returnPluginsData(pluginsData){
114 var bodyContainer = document.getElementById('body-container'); 114 var bodyContainer = document.getElementById('body-container');
115 var body = document.body; 115 var body = document.body;
116 116
117 // Set all page content to be visible so we can measure heights. 117 // Set all page content to be visible so we can measure heights.
118 bodyContainer.style.visibility = 'hidden'; 118 bodyContainer.style.visibility = 'hidden';
119 body.className = ''; 119 body.className = '';
120 var slidables = document.getElementsByClassName('showInTmiMode'); 120 var slidables = document.getElementsByClassName('show-in-tmi-mode');
121 for (var i = 0; i < slidables.length; i++) 121 for (var i = 0; i < slidables.length; i++)
122 slidables[i].style.height = 'auto'; 122 slidables[i].style.height = 'auto';
123 123
124 renderTemplate(pluginsData); 124 renderTemplate(pluginsData);
125 125
126 // Add handlers to dynamically created HTML elements. 126 // Add handlers to dynamically created HTML elements.
127 var links = document.getElementsByClassName('disable-plugin-link'); 127 var links = document.getElementsByClassName('disable-plugin-link');
128 for (var i = 0; i < links.length; i++) { 128 for (var i = 0; i < links.length; i++) {
129 links[i].onclick = function () { 129 links[i].onclick = function () {
130 handleEnablePlugin(this, false, false); 130 handleEnablePlugin(this, false, false);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 var maxLabelWidth = 0; 165 var maxLabelWidth = 0;
166 for (var i = 0; i < labels.length; i++) 166 for (var i = 0; i < labels.length; i++)
167 labels[i].style.width = 'auto'; 167 labels[i].style.width = 'auto';
168 for (var i = 0; i < labels.length; i++) 168 for (var i = 0; i < labels.length; i++)
169 maxLabelWidth = Math.max(maxLabelWidth, labels[i].offsetWidth); 169 maxLabelWidth = Math.max(maxLabelWidth, labels[i].offsetWidth);
170 for (var i = 0; i < labels.length; i++) 170 for (var i = 0; i < labels.length; i++)
171 labels[i].style.width = maxLabelWidth + 'px'; 171 labels[i].style.width = maxLabelWidth + 'px';
172 172
173 // Explicitly set the height for each element that wants to be "slid" in and 173 // Explicitly set the height for each element that wants to be "slid" in and
174 // out when the tmiModeExpanded is toggled. 174 // out when the tmiModeExpanded is toggled.
175 var slidables = document.getElementsByClassName('showInTmiMode'); 175 var slidables = document.getElementsByClassName('show-in-tmi-mode');
176 for (var i = 0; i < slidables.length; i++) 176 for (var i = 0; i < slidables.length; i++)
177 slidables[i].style.height = slidables[i].offsetHeight + 'px'; 177 slidables[i].style.height = slidables[i].offsetHeight + 'px';
178 178
179 // Reset visibility of page based on the current tmi mode. 179 // Reset visibility of page based on the current tmi mode.
180 document.getElementById('collapse').style.display = 180 document.getElementById('collapse').style.display =
181 tmiModeExpanded ? 'inline' : 'none'; 181 tmiModeExpanded ? 'inline' : 'none';
182 document.getElementById('expand').style.display = 182 document.getElementById('expand').style.display =
183 tmiModeExpanded ? 'none' : 'inline'; 183 tmiModeExpanded ? 'none' : 'inline';
184 bodyContainer.style.visibility = 'visible'; 184 bodyContainer.style.visibility = 'visible';
185 body.className = tmiModeExpanded ? 185 body.className = tmiModeExpanded ?
186 'showTmiModeInitial' : 'hideTmiModeInitial'; 186 'show-tmi-mode-initial' : 'hide-tmi-mode-initial';
187 } 187 }
188 188
189 /** 189 /**
190 * Handles a 'enable' or 'disable' button getting clicked. 190 * Handles a 'enable' or 'disable' button getting clicked.
191 */ 191 */
192 function handleEnablePlugin(node, enable, isGroup) { 192 function handleEnablePlugin(node, enable, isGroup) {
193 // Tell the C++ PluginsDOMHandler to enable/disable the plugin. 193 // Tell the C++ PluginsDOMHandler to enable/disable the plugin.
194 chrome.send('enablePlugin', [String(node.path), String(enable), 194 chrome.send('enablePlugin', [String(node.path), String(enable),
195 String(isGroup)]); 195 String(isGroup)]);
196 } 196 }
197 197
198 // Keeps track of whether details have been made visible (expanded) or not. 198 // Keeps track of whether details have been made visible (expanded) or not.
199 var tmiModeExpanded = false; 199 var tmiModeExpanded = false;
Evan Stade 2012/04/03 02:59:48 this is awesome if tmi == too much info
200 200
201 /* 201 /*
202 * Toggles visibility of details. 202 * Toggles visibility of details.
203 */ 203 */
204 function toggleTmiMode() { 204 function toggleTmiMode() {
205 tmiModeExpanded = !tmiModeExpanded; 205 tmiModeExpanded = !tmiModeExpanded;
206 206
207 document.getElementById('collapse').style.display = 207 document.getElementById('collapse').style.display =
208 tmiModeExpanded ? 'inline' : 'none'; 208 tmiModeExpanded ? 'inline' : 'none';
209 document.getElementById('expand').style.display = 209 document.getElementById('expand').style.display =
210 tmiModeExpanded ? 'none' : 'inline'; 210 tmiModeExpanded ? 'none' : 'inline';
211 211
212 document.body.className = 212 document.body.className =
213 tmiModeExpanded ? 'showTmiMode' : 'hideTmiMode'; 213 tmiModeExpanded ? 'show-tmi-mode' : 'hide-tmi-mode';
Evan Stade 2012/04/03 02:59:48 my hawk vision tells me this fits on one line rea
Dan Beam 2012/04/03 04:15:06 Done.
214 214
215 chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]); 215 chrome.send('saveShowDetailsToPrefs', [String(tmiModeExpanded)]);
216 } 216 }
217 217
218 function handleSetPluginAlwaysAllowed(el) { 218 function handleSetPluginAlwaysAllowed(el) {
219 chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]); 219 chrome.send('setPluginAlwaysAllowed', [el.identifier, el.checked]);
220 } 220 }
221 221
222 /** 222 /**
223 * Determines whether a plugin's version should be displayed. 223 * Determines whether a plugin's version should be displayed.
(...skipping 28 matching lines...) Expand all
252 setInterval(requestPluginsData, 30000); 252 setInterval(requestPluginsData, 30000);
253 253
254 // Get data and have it displayed upon loading. 254 // Get data and have it displayed upon loading.
255 document.addEventListener('DOMContentLoaded', requestPluginsData); 255 document.addEventListener('DOMContentLoaded', requestPluginsData);
256 256
257 // Add handlers to static HTML elements. 257 // Add handlers to static HTML elements.
258 document.getElementById('collapse').onclick = toggleTmiMode; 258 document.getElementById('collapse').onclick = toggleTmiMode;
259 document.getElementById('expand').onclick = toggleTmiMode; 259 document.getElementById('expand').onclick = toggleTmiMode;
260 document.getElementById('details-link').onclick = toggleTmiMode; 260 document.getElementById('details-link').onclick = toggleTmiMode;
261 261
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698