forked from johnmichel/Library-Detector-for-Chrome
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
31 lines (24 loc) · 965 Bytes
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
file: main.js
description: Responds to notification from the Content Script and displays the icon
license: Library Detector is freely distributable under the MIT License
http://www.opensource.org/licenses/mit-license.php
copyright: Copyright (c) 2010 Andrew Bredow <[email protected]>. All rights reserved.
author: Andrew Bredow http://andrewbredow.com
inspiration: Library detect class inspired by Paul Bakaus' Library Detector for
Firefox http://paulbakaus.com/
**/
var setLibrary = function(library, tabId) {
chrome.pageAction.setIcon({
tabId: tabId,
path: 'icons/'+library.icon+'.png'
});
chrome.pageAction.setTitle({
tabId: tabId,
title: library.name + ' ' + library.version
});
chrome.pageAction.show(tabId);
};
chrome.extension.onRequest.addListener(function(library, sender, sendResponse) {
setLibrary(library, sender.tab.id);
});