Created
January 23, 2010 14:52
-
-
Save mooz/284632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// initialIndex : 初期選択行を指定 | |
ext.add("list-tab-history", function () { | |
const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; | |
var tabHistory = []; | |
var sessionHistory = gBrowser.webNavigation.sessionHistory; | |
if (sessionHistory.count < 1) | |
return void display.echoStatusBar("Tab history not exist", 2000); | |
for (var i = 0; i < sessionHistory.count; i++) { | |
var entry = sessionHistory.getEntryAtIndex(i, false); | |
if (!entry) | |
continue; | |
try { | |
var iconURL = Cc["@mozilla.org/browser/favicon-service;1"] | |
.getService(Ci.nsIFaviconService) | |
.getFaviconForPage(entry.URI).spec; | |
} catch (ex) {} | |
tabHistory.push([iconURL || fav, entry.title, entry.URI.spec, i]); | |
} | |
prompt.selector( | |
{ | |
message : "select history in tab", | |
collection : tabHistory, | |
flags : [ICON | IGNORE, 0, 0, IGNORE | HIDDEN], | |
header : ["Title", "URL"], | |
initialIndex : tabHistory.length - 1, | |
callback : function(i) { if (i >= 0) gBrowser.webNavigation.gotoIndex(tabHistory[i][3]); } | |
}); | |
}, 'List tab history'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment