Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
Fix for issue #519: Make print preview usable
Browse files Browse the repository at this point in the history
  • Loading branch information
aleth committed Sep 10, 2011
1 parent ae77b99 commit f0c8a2f
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lessChromeHD/bootstrap.js
Expand Up @@ -95,8 +95,10 @@ function prepareLessChrome(window) {
// Calculate the height of toolbars that should be shown
let TabsBar = document.getElementById("TabsToolbar");
let ToolbarMenu = document.getElementById("toolbar-menubar");
let PrintPreviewToolbarHeight = 0;
function getToolbarHeight() {
return TabsBar.getBoundingClientRect().height + ToolbarMenu.getBoundingClientRect().height;
return TabsBar.getBoundingClientRect().height + ToolbarMenu.getBoundingClientRect().height
+ PrintPreviewToolbarHeight;
}

// Figure out how much to shift the main browser
Expand All @@ -120,6 +122,30 @@ function prepareLessChrome(window) {
};
});

// Watch for creation of print preview toolbar
change(gNavToolbox.parentNode, "insertBefore", function(orig) {
return function(newElement, referenceElement) {
var insElement = orig.call(this, newElement, referenceElement);
if (newElement.id == "print-preview-toolbar") {
PrintPreviewToolbarHeight = insElement.getBoundingClientRect().height;
updateOffset();
}
return insElement;
};
});

// Watch for removal of print preview toolbar
change(gNavToolbox.parentNode, "removeChild", function(orig) {
return function(child) {
var oldChild = orig.call(this, child);
if (child.id == "print-preview-toolbar") {
PrintPreviewToolbarHeight = 0;
async(function() updateOffset(), 200);
}
return oldChild;
};
});

// Set the opacity of potentially hidden toolbars or clear it
function updateOpacity(opacity) {
// Set the opacity for every toolbar except tabs
Expand Down

0 comments on commit f0c8a2f

Please sign in to comment.