forked from nqbao/chromesniffer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpopup.html
58 lines (48 loc) · 1.47 KB
/
popup.html
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<script type="text/javascript" src="common.js"></script>
<script language="javascript">
var bg = chrome.extension.getBackgroundPage();
chrome.tabs.getSelected(null,function(tab){
chrome.extension.sendRequest({msg: "get",tab: tab.id}, function(response){
var display = document.getElementById('app_list');
var info = response.info;
var html = '';
if (!info || info.length == 0)
{
html = '<em>No framework detected</em>';
}
else
{
var appinfo = bg.appinfo;
for (var i = 0;i < info.length;i++)
{
appid = info[i];
app = appinfo[appid] ? appinfo[appid] : {};
// i'm lazy to fill all kind of the information :(
if (!app.title) app.title = appid;
if (!app.url) app.url = appinfo[''].url.replace('%s',appid); // it's google one
if (!app.icon) app.icon = appinfo[''].icon;
html += '<a target="_blank" title="' + app.title + '" href="' + app.url + '">';
html += '<img alt="' + app.title + '" width=16 height=16 src="apps/' + app.icon + '"/>';
html += '</a>';
// space
html += ' ';
}
if (info.length < 8) // correct the width for better view
{
display.style.width = (info.length*20) + "px";
}
else
{
display.style.width = "160px";
}
}
display.innerHTML = html;
});
});
</script>
<div id="app_list" style="width: 10px;">
</div>
<!--
Chrome AppSniffer by Bao Nguyen <[email protected]>
Released under GLPv3 license.
-->