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

Unified Diff: chrome/browser/resources/extensions/extension_list.js

Issue 11434024: Support extension highlighting on the extensions page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extensions.css » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/extensions/extension_list.js
===================================================================
--- chrome/browser/resources/extensions/extension_list.js (revision 170285)
+++ chrome/browser/resources/extensions/extension_list.js (working copy)
@@ -50,6 +50,19 @@
// Iterate over the extension data and add each item to the list.
this.data_.extensions.forEach(this.createNode_, this);
+ var id_to_highlight = parseQueryParams(document.location)['id'];
+ if (id_to_highlight) {
+ // Scroll offset should be calculated slightly higher than the actual
+ // offset of the element being scrolled to, so that it ends up not all
+ // the way at the top. That way it is clear that there are more elements
+ // above the element being scrolled to.
+ var offset = $(id_to_highlight).offsetTop -
+ (1.2 * $(id_to_highlight).clientHeight);
James Hawkins 2012/11/30 20:11:05 nit: Pull 1.2 out into a constant.
Finnur 2012/11/30 21:49:28 const are not allowed in strict mode, but I factor
+ var wrapper = this.parentNode;
+ var list = wrapper.parentNode;
+ list.scrollTop = offset;
+ }
+
if (this.data_.extensions.length == 0)
this.classList.add('empty-extension-list');
else
@@ -74,6 +87,10 @@
if (!extension.userModifiable)
node.classList.add('may-not-disable');
+ var id_to_highlight = parseQueryParams(document.location)['id'];
James Hawkins 2012/11/30 20:11:05 Optional nit: Pull parseQueryParams...; out into a
Finnur 2012/11/30 21:49:28 Done.
+ if (node.id == id_to_highlight)
+ node.classList.add('extension-highlight');
+
var item = node.querySelector('.extension-list-item');
item.style.backgroundImage = 'url(' + extension.icon + ')';
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extensions.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698