Created
February 17, 2012 08:17
-
-
Save bamanzi/1851778 to your computer and use it in GitHub Desktop.
[firefox] hacking tabundle extension: only list tabs in current group (panorama)
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
//extensions/tabundle@relucks.org/chrome/content/tabundle.js | |
Tabundle.createGroupListHtml = function() { | |
var height = window.innerHeight; | |
var currentGroup = TabView._window.GroupItems.getActiveGroupItem(); | |
var list = Array.map(currentGroup._children, function(tabitem) { | |
var w = gBrowser.getBrowserForTab(tabitem.tab).contentWindow | |
var c = Tabundle.capture(w, {x: 0, y:0}, {h: height, w: w.innerWidth}, 0.3) | |
return [w.document.title, w.location.href, c] | |
}) | |
var date = Tabundle.dateString(); | |
var size = currentGroup._children.length.toString(); | |
var group = currentGroup.getTitle(); | |
var opt = { | |
list: list, | |
size: size, | |
date: date, | |
title: "[" + group + "]: " + size + 'tabs ' + date, | |
fav: Tabundle.icon(size).toDataURL(), | |
style: Tabundle.style() | |
} | |
var html = Tabundle.listHtml(opt) | |
var fileName = date + "-" + group + '.html' | |
var out = Tabundle.IOUtils.getFile(Tabundle.getHtmlDir()) | |
out.append(fileName); | |
var path = out.path; | |
if (out.exists()) { | |
var opt = { | |
mode: Components.interfaces.nsIFilePicker.modeSave, | |
defaultString: fileName, | |
displayDirectory: Tabundle.IOUtils.getFile(Tabundle.getHtmlDir()), | |
filters: Components.interfaces.nsIFilePicker.filterHTML | |
} | |
path = Tabundle.selectFile(opt) | |
} | |
if (path) { | |
Tabundle.IOUtils.write(path, html) | |
return path | |
} | |
} | |
//then replace all occurrence of `createListHtml' to `createGroupListHtml' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to support groups of TabGroups Manager, the first lines should be: