public
Description: Using Mozilla Jetpack to render a favicon-list of the last five closed tabs in the status bar
Homepage: http://suttree.com/
Clone URL: git://github.com/suttree/Recently-Closed-Tabs-for-Mozilla-Jetpack.git
Recently-Closed-Tabs-for-Mozilla-Jetpack / recently_closed_tabs.js
100644 27 lines (24 sloc) 0.669 kb
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
/* Recent closed tab history - showing favicons in the status bar */
/* Duncan Gough - http://suttree.com */
var favIcons = new Array(5);
var statusBar = null;
 
jetpack.tabs.onClose(function(){
  addFavicon(this);
});
 
function addFavicon(tab){
  var img = '<img src="' + tab.favicon + '" height="16" width="16">';
  if (favIcons.push(img) > 5) {
    favIcons = favIcons.splice(1,5);
  }
  statusBar.html( favIcons.join(' ') );
}
 
jetpack.statusBar.append({
  html: '<span id="favicons"></span>',
  onReady: function(doc){
    statusBar = $(doc).find("#favicons");
    $(doc).click(function(){
      console.log( favicons.join(' ') );
    });
  },
  width: 200
});