Skip to content

Commit

Permalink
save all tabs works
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Andrews committed Nov 28, 2008
1 parent 8d6d679 commit 560a15a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 14 deletions.
3 changes: 2 additions & 1 deletion chrome/content/browserOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,8 @@ function Taboo() {
};

this.addAllTaboo = function(event) {
alert('foo')
SVC.saveAll();
saved(true);
};

this.removeTaboo = function(event) {
Expand Down
4 changes: 3 additions & 1 deletion chrome/content/browserOverlay.xul
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<menuitem class="unsaved" label="Save Tab" command="cmd_addTabooWithDetails" />
<menuitem class="saved" label="Edit Notes" command="cmd_addTabooWithDetails" />
<menuitem class="saved" label="Remove Taboo" command="cmd_removeTaboo" />
<menuseparator />
<menuitem label="Save All Tabs" command="cmd_tabooAll" />
</menupopup>
</toolbarbutton>
<toolbarbutton id="taboo-toolbarbutton-view"
Expand Down Expand Up @@ -129,7 +131,7 @@
<commandset id="mainCommandSet">
<command id="cmd_showPopup" oncommand="taboo.showPanel(event)" />
<command id="cmd_showTaboos" oncommand="taboo.show(event)" />
<command id="cmd_addAllTaboo" oncommand="taboo.addAllTaboo(event)" />
<command id="cmd_tabooAll" oncommand="taboo.addAllTaboo(event)" />
<command id="cmd_addTaboo" oncommand="taboo.addTaboo(event)" />
<command id="cmd_toggleTaboo" oncommand="taboo.toggleTaboo(event)" />
<command id="cmd_addTabooWithDetails" oncommand="taboo.addTabooWithDetails(event)" />
Expand Down
18 changes: 6 additions & 12 deletions components/oyTaboo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2007 Jesse Andrews and Manish Singh
* Copyright 2007-2008 Jesse Andrews and Manish Singh
*
* This file may be used under the terms of of the
* GNU General Public License Version 2 or later (the "GPL"),
Expand Down Expand Up @@ -144,16 +144,10 @@ TabooInfo.prototype = {


function snapshot(win, outputWidth, outputHeight) {
var content = win.content;

var canvas = win.document.createElementNS("http://www.w3.org/1999/xhtml", "canvas");

var realW = content.document.body ? content.document.body.clientWidth
: content.innerWidth;
if (!realW || realW == 0) {
realW = content.innerWidth;
}
var realH = content.innerHeight;
var realW = win.innerWidth;
var realH = win.innerHeight;

var pW = outputWidth * 1.0 / realW;
var pH = outputHeight * 1.0 / realH;
Expand All @@ -172,7 +166,7 @@ function snapshot(win, outputWidth, outputHeight) {

var ctx = canvas.getContext("2d");
ctx.scale(p, p);
ctx.drawWindow(content, content.scrollX, content.scrollY, realW, realH, "rgb(0,0,0)");
ctx.drawWindow(win, win.scrollX, win.scrollY, realW, realH, "rgb(0,0,0)");

var imageData = canvas.toDataURL();
return win.atob(imageData.substr('data:image/png;base64,'.length));
Expand Down Expand Up @@ -614,7 +608,7 @@ TabooService.prototype = {
var tab = tabs[i];
var tabWin = browsers[i].contentWindow;
var state = tabStates[i];
this._saveTab(state, tabWin, tab, null);
this._saveTab(state, tabWin, tab, null);
}

return true;
Expand Down Expand Up @@ -661,7 +655,7 @@ TabooService.prototype = {
state = winState.windows[0].tabs[currentTab];
}

return this._saveTab(state, win, selectedTab, aDescription);
return this._saveTab(state, win.content, selectedTab, aDescription);
},
_saveTab: function TB__saveTab(aState, aWindow, aTab, aDescription) {
var url = aState.entries[aState.index - 1].url;
Expand Down

0 comments on commit 560a15a

Please sign in to comment.