OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 init(); | |
6 | |
7 function init() { | |
8 var extensionIds = location.hash.substring(1).split(','); | |
9 populateHeading(extensionIds.length); | |
10 | |
11 var template = document.querySelector('.row'); | |
12 extensionIds.forEach(populateRow.bind(null, template)); | |
13 } | |
14 | |
15 function populateHeading(numExtensions) { | |
16 // TODO(aa): Internationalize. Copy whatever bookmark manager is doing. | |
17 var singular = ' extension is interacting with this page'; | |
18 var plural = ' extensions are interacting with this page'; | |
19 var phrase = numExtensions == 1 ? singular : plural; | |
20 document.querySelector('h1').textContent = numExtensions + phrase; | |
21 } | |
22 | |
23 function populateRow(template, extensionId) { | |
24 chrome.management.get(extensionId, function(info) { | |
25 var row = template.cloneNode(true); | |
26 row.querySelector('.icon').src = | |
27 'chrome://extension-icon/' + extensionId + '/16/1'; | |
28 row.querySelector('.name').textContent = info.name; | |
29 row.classList.remove('template'); | |
30 template.parentNode.appendChild(row); | |
31 }); | |
32 } | |
OLD | NEW |