Ignore:
Timestamp:
11/05/12 18:26:34 (12 years ago)
Author:
vmipsl
Message:

print ok pour mozilla & chrome

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_statistics/web/resources/js/classesForJQuery/PrintContent.js

    r662 r663  
    1515        this.divButtons = $( '<div id="printButtons"></div>' ); 
    1616        this.divContent = $( '<div id="printContent"></div>' ); 
    17  
    18 //        this.print_frame = $( '<iframe id="print-modal-content" scrolling="no" border="0" frameborder="0" name="print-frame" />' ); 
    19         this.divContent.append( $( "#title" ).clone() ); 
    20         this.divContent.append( $( "#leftTop" ).clone().animate( {'marginLeft' : "+=80px"} ) ); 
    21         this.divContent.append( $( "#leftMiddleSlide" ).clone().animate( {'marginLeft' : "+=80px"} ) ); 
    22         this.divContent.append( $( "#leftBottomSlide" ).clone().animate( {'marginLeft' : "+=80px"} ) ); 
    23         this.divContent.append( $( "#middle" ).clone().animate( {'marginLeft' : "+=120px"} ) ); 
    2417    }, 
    2518 
     
    2922        this.divWrapper.append( this.divButtons ); 
    3023        this.divWrapper.append( this.divContent ); 
    31 //        this.divWrapper.append( this.print_frame ); 
    3224        $( 'body' ).append( this.divWrapper ); 
    3325 
    34         // The frame lives 
    35 //        for( var i = 0; i < window.frames.length; i++ ) 
    36 //        { 
    37 //            if( window.frames[i].name == "print-frame" ) 
    38 //            { 
    39 //                this.print_frame_ref = window.frames[i].document; 
    40 //                break; 
    41 //            } 
    42 //        } 
    43  
    44 //        this.print_frame_ref.open(); 
    45 //        this.print_frame_ref.write( '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + 
    46 //                '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' + 
    47 //                '<head><title>zzzzzzzzzzz</title></head>' + 
    48 //                '<body></body>' + 
    49 //                '</html>' ); 
    50 //        this.print_frame_ref.close(); 
    51  
    52 //        if( !$.browser.msie && !($.browser.version < 7) ) 
    53 //        { 
    54 //            $( 'head', this.print_frame_ref ).append( "headhhhhh" ); 
    55 //            $( 'body', this.print_frame_ref ).append( this.content ); 
    56 //        } 
    57 //        else 
    58 //        { 
    59 //            $( 'body > *:not(#printWrapper):not(script)' ).clone().each( function() 
    60 //            { 
    61 //                $( 'body', this.print_frame_ref ).append( this.outerHTML ); 
    62 //            } ); 
    63 //            $( 'head link[media*=print], head link[media=all]' ).each( function() 
    64 //            { 
    65 //                $( 'head', this.print_frame_ref ).append( $( this ).clone().attr( 'media', 'all' )[0].outerHTML ); 
    66 //            } ); 
    67 //        } 
    68  
     26        // Display mask 
    6927        this.loadMask(); 
    70  
    71         // Disable scrolling 
    72 //        $( 'body' ).css( {overflowY: 'hidden', height: '100%'} ); 
    73 //        $( 'img', this.print_frame_ref ).load( function() 
    74 //        { 
    75 //            this.print_frame.height( $( 'body', this.print_frame.contents() )[0].scrollHeight ); 
    76 //        } ); 
    7728 
    7829        // Position modal 
     
    9142        }, this ) ); 
    9243 
    93 //        this.print_frame.height( $( 'body', this.print_frame.contents() )[0].scrollHeight ); 
    94 //        this.print_frame.height( $( 'body', this.print_frame.contents() )[0].scrollHeight ); 
    9544        this.createButtons(); 
    9645    }, 
     
    10352        this.printButton.bind( "click", jQuery.proxy( function() 
    10453        { 
    105 //            this.mask.animate( { opacity: 1}, 400, jQuery.proxy( function() 
    106 //            { 
    107             window.print(); 
    108 //            }, this ) ); 
    109  
    110 //            var thePopup = window.open( '', "Customer Listing", "menubar=0,location=0,height=700,width=700" ); 
    111 //            thePopup.document.body.innerHTML = this.content; 
    112 //            this.divWrapper.clone().appendTo( thePopup.document.body ); 
    113 //            thePopup.print(); 
    114 //            window.open() 
    115 //            window.document.body.innerHTML = "paf"; 
    116 //            document.location.href = ""; 
     54            this.mask.animate( { opacity: 1}, 400, jQuery.proxy( function() 
     55            { 
     56                window.print(); 
     57            }, this ) ); 
     58//            window.print(); 
    11759        }, this ) ); 
    11860        this.divButtons.append( this.printButton ); 
     
    12668        this.divButtons.append( this.closeButton ); 
    12769    }, 
    128  
    129 //    printdiv: function( printpage ) 
    130 //    { 
    131 //        var headstr = "<html><head><title></title></head><body>"; 
    132 //        var footstr = "</body>"; 
    133 //        var newstr = document.all.item( printpage ).innerHTML; 
    134 //        var newstr = "<div>qsdqmsdkqsmdkqsd</div>"; 
    135 //        var oldstr = document.body.innerHTML; 
    136 //        document.body.innerHTML = headstr + newstr + footstr; 
    137 //        window.print(); 
    138 //        document.body.innerHTML = oldstr; 
    139 //        return false; 
    140 //    }, 
    14170 
    14271    distroyPrintPreview: function() 
     
    189118        { 
    190119            if( e.keyCode == 27 ) 
    191             { 
    192120                this.distroyPrintPreview(); 
    193             } 
    194121        }, this ) ); 
    195122    }, 
     
    204131                window.innerWidth || // ie7+ 
    205132                        document.documentElement.clientWidth || // ie6 
    206                         document.body.clientWidth,                     // ie6 quirks mode 
     133                        document.body.clientWidth, // ie6 quirks mode 
    207134                d - w < 20 ? w : d 
    208135            ]; 
     
    216143        this.size = this.getMaskSize(); 
    217144        this.mask.css( {width: this.size[0], height: this.size[1]} ); 
     145    }, 
     146 
     147    setContent: function( content ) 
     148    { 
     149        this.divContent.append( content ); 
     150    }, 
     151 
     152    addContent: function( content ) 
     153    { 
     154        this.divContent.append( content ); 
    218155    } 
     156 
    219157} ); 
Note: See TracChangeset for help on using the changeset viewer.