This repository has been archived by the owner on Apr 20, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When printing, revert all elements to their default non-CSS3 state, t…
…o avoid positioning errors and to honor the browser's settings for printing backgrounds etc.
- Loading branch information
Jason Johnston
committed
Oct 31, 2010
1 parent
6212f97
commit 828dac6
Showing
7 changed files
with
114 additions
and
43 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Create an observable listener for the onbeforeunload event | ||
*/ | ||
PIE.OnBeforeUnload = new PIE.Observable(); | ||
window.attachEvent( 'onbeforeunload', function() { PIE.OnBeforeUnload.fire(); } ); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Listen for printing events, destroy all active PIE instances when printing, and | ||
* restore them afterward. | ||
*/ | ||
(function() { | ||
|
||
var elements, | ||
win = window; | ||
|
||
function beforePrint() { | ||
elements = PIE.Element.destroyAll(); | ||
} | ||
|
||
function afterPrint() { | ||
if( elements ) { | ||
for( var i = 0, len = elements.length; i < len; i++ ) { | ||
PIE[ 'attach' ]( elements[i] ); | ||
} | ||
elements = 0; | ||
} | ||
} | ||
|
||
win.attachEvent( 'onbeforeprint', beforePrint ); | ||
win.attachEvent( 'onafterprint', afterPrint ); | ||
|
||
PIE.OnBeforeUnload.observe( function() { | ||
win.detachEvent( 'onbeforeprint', beforePrint ); | ||
win.detachEvent( 'onafterprint', afterPrint ); | ||
} ); | ||
|
||
})(); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
/** | ||
* Create a single observable listener for window resize events. | ||
*/ | ||
PIE.OnResize = new PIE.Observable(); | ||
window.attachEvent( 'onresize', function() { PIE.OnResize.fire(); } ); | ||
(function() { | ||
PIE.OnResize = new PIE.Observable(); | ||
|
||
function resized() { | ||
PIE.OnResize.fire(); | ||
} | ||
|
||
window.attachEvent( 'onresize', resized ); | ||
PIE.OnBeforeUnload.observe( function() { | ||
window.detachEvent( 'onresize', resized ); | ||
} ); | ||
})(); |
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
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
828dac6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
I have many problems with the printing. Can i have an example in HTML , please ?
Thank you very much