forked from tombfix/patch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.faviconHistory.js
47 lines (42 loc) · 1.17 KB
/
action.faviconHistory.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
Tombloo.Service.actions.register( {
name : 'Favicon History',
icon : 'chrome://tombloo/skin/firefox.ico',
execute : function(){
addTab('about:blank').addCallback(function(win){
withWindow(win, function(){
var doc = win.document;
doc.title = 'Favicon History';
var root = NavHistoryService.executeQuery(
NavHistoryService.getNewQuery(),
NavHistoryService.getNewQueryOptions()).root;
root.containerOpen = true;
doc.body.appendChild(convertToDOM(<style><![CDATA[
body {
margin : 48px;
}
img {
border : 4px solid white;
}
img:hover {
border : 4px solid #DDD;
}
]]></style>));
forEach(root, function(node){
try{
var uri = createURI(node.uri);
var src = FaviconService.getFaviconForPage(uri).spec
var link = doc.body.appendChild(doc.createElement('a'));
link.href = uri.spec;
var img = link.appendChild(doc.createElement('img'));
img.src = src;
img.onerror = function(){
removeElement(img);
}
} catch(e){
// アイコンが見つからないとエラーが発生する
}
});
});
});
},
}, '----');