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 + ')'; |