Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CSS-Tricks/The-Printliminator.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMottie <wowmotty@gmail.com>2015-08-22 06:34:34 +0300
committerMottie <wowmotty@gmail.com>2015-08-23 20:39:18 +0300
commit9c9471fea2d87dac16f962f12226c4e264fad703 (patch)
tree37c5a53c6ecb609213e4aba857ec59c392248400
parent4552ad2ff3a17f57a55bf41778b9264a55d8e06c (diff)
Save each replaced background image for undo method
-rw-r--r--js/printliminator.js30
1 files changed, 23 insertions, 7 deletions
diff --git a/js/printliminator.js b/js/printliminator.js
index 4cb5650..a58ad18 100644
--- a/js/printliminator.js
+++ b/js/printliminator.js
@@ -96,13 +96,29 @@ function csstricksPrintliminator( jQ ) {
// Remove Graphics
$( '<div class="_print_controls_remove_graphics">' )
.click( function() {
- var done = $('img,iframe,object,embed,input[type=image],ins').addClass( '_print_removed' ),
- bg = $('body *:not(._print_controls, ._print_controls *)').css('background'),
- item = $('body *:not(._print_controls, ._print_controls *)').css('background', 'none');
- done.addClass("_print_removed");
- history.push(function() {
- done.show();
- item.css('background', bg);
+ var indx, $el, bkgd,
+ bkgds = [],
+ $done = $( 'img, iframe, object, embed, input[type=image], ins' ),
+ $item = $( 'body *:not(._print_controls, ._print_controls *)' ),
+ len = $item.length;
+ for ( indx = 0; indx < len; indx++ ) {
+ $el = $item.eq( indx );
+ bkgd = $el.css( 'background-image' );
+ if ( bkgd !== 'none' ) {
+ bkgds.push( [ $el, bkgd ] );
+ $el.css( 'background-image', 'none' );
+ }
+ }
+ $done.addClass( '_print_removed' );
+
+ history.push( function() {
+ $done.removeClass( '_print_removed' );
+ var $el,
+ len = bkgds.length;
+ for ( indx = 0; indx < len; indx++ ) {
+ $el = bkgds[ indx ][ 0 ];
+ $el.css( 'background-image', bkgds[ indx ][ 1 ] );
+ }
});
})
.appendTo( $controls );