Created
December 13, 2010 05:43
-
-
Save baron/738696 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
// Keysnail function that pulls up your entire session history | |
// Based on tips from: http://malblue.tumblr.com/post/349001250/tips-japanese-keysnail-github | |
ext.add("list-session-history", function () { | |
const fav = "chrome://mozapps/skin/places/defaultFavicon.png"; | |
var tabHistory = []; | |
var faviconService = Components.classes["@mozilla.org/browser/favicon-service;1"].getService(Components.interfaces.nsIFaviconService); | |
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"].getService(Components.interfaces.nsINavHistoryService); | |
var options = historyService.getNewQueryOptions(); | |
var query = historyService.getNewQuery(); | |
var result = historyService.executeQuery(query, options); | |
var cont = result.root; | |
cont.containerOpen = true; | |
if (cont.childCount < 1) | |
return void display.echoStatusBar("No session history", 2000); | |
for (var i = 0; i < cont.childCount; i++) { | |
var entry = cont.getChild(i); | |
if (!entry) | |
continue; | |
try { | |
var iconURL = faviconService.getFaviconImageForPage(makeURI(entry.uri,null,null)).spec; | |
} catch (ex) {} | |
tabHistory.push([iconURL || fav, entry.title, entry.uri, i]); | |
} | |
tabHistory = tabHistory.reverse(); | |
cont.containerOpen = false; | |
prompt.selector( | |
{ | |
message : "select history in tab", | |
collection : tabHistory, | |
flags : [ICON | IGNORE, 0, 0, IGNORE | HIDDEN], | |
header : ["Title", "URL"], | |
initialIndex : 0, | |
callback : function(i) { if (i >= 0) gBrowser.loadURI(tabHistory[i][2]); } | |
}); | |
}, 'List session history'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment