Plugin Directory

Changeset 2869326


Ignore:
Timestamp:
02/22/2023 11:21:29 AM (3 years ago)
Author:
baden03
Message:

fixed issue with safari not printing correctly

Location:
print-o-matic/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • print-o-matic/trunk/README.md

    r2846064 r2869326  
    66* Requires at least: 4.9
    77* Tested up to: 6.1.1
    8 * Stable tag: 2.1.9
     8* Stable tag: 2.1.10
    99* License: GPLv2 or later
    1010* License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • print-o-matic/trunk/js/print_elements.js

    r2742530 r2869326  
    6060    };
    6161
    62     var _print = function (elements, pause_time, has_top_html, has_bot_html) {
     62    var _print = function (elements, has_top_html, has_bot_html) {
    6363        for (var i = 0; i < elements.length; i++) {
    6464            _walkTree(elements[i], _attachPrintClasses);
    6565        }
    66         setTimeout(function () {
    67             window.print();
    68         }, 500);
     66 
     67        window.addEventListener('afterprint', e => after_print_clean_up(elements, has_top_html, has_bot_html) );
     68        window.print();
     69    };
    6970
    70         setTimeout(function () {
    71             for (i = 0; i < elements.length; i++) {
    72                 _walkTree(elements[i], _cleanup);
    73             }
    74             pom_cleanup(has_top_html, has_bot_html);
    75         }, pause_time);
    76        
    77     };
     71    function after_print_clean_up(elements, has_top_html, has_bot_html){
     72        //console.log('clean up on isle 5');
     73        for (var i = 0; i < elements.length; i++) {
     74            _walkTree(elements[i], _cleanup);
     75        }
     76        pom_cleanup(has_top_html, has_bot_html);
     77    }
    7878
    7979    return {
  • print-o-matic/trunk/js/printomat.js

    r2742530 r2869326  
    11/*!
    2  * Print-O-Matic JavaScript v2.0.11
     2 * Print-O-Matic JavaScript v2.0.13
    33 * https://pluginoven.com/plugins/print-o-matic/
    44*/
     
    1010        var this_print_data;
    1111
     12        // TODO: must be a better way of assigning this dynamic print_data variable
    1213        if(eval('typeof print_data_' + id) !== "undefined"){
    1314            this_print_data = eval('print_data_' + id );
     
    4445        var trigger = jQuery(this);
    4546        var target = trigger.data('print_target');
    46    
     47       
    4748        if(!target){
    4849            classes = trigger.attr("class").split(/\s+/);
     
    7778                });
    7879            }
    79            
    8080        });
    8181
     
    8686       
    8787        var pause_time = print_data.pom_pause_time;
    88         if(!pause_time){
    89             pause_time = 2000;
    90         }
    9188        if(this_print_data && 'pom_pause_time' in this_print_data){
    9289            pause_time = this_print_data.pom_pause_time;
     
    9491
    9592        if(targets){
     93            if(pause_time){
     94                console.log('pause_time hase been removed for now');
     95            }
    9696            PrintElements.print(targets, pause_time, has_top_html, has_bot_html);
    9797        }       
  • print-o-matic/trunk/print-o-matic.php

    r2846064 r2869326  
    55Plugin URI: https://pluginoven.com/plugins/print-o-matic/
    66Description: Shortcode that adds a printer icon, allowing the user to print the post or a specified HTML element in the post.
    7 Version: 2.1.9
     7Version: 2.1.10
    88Author: twinpictures
    99Author URI: https://twinpictures.de
     
    1818class WP_Print_O_Matic {
    1919
    20     var $version = '2.1.9';
     20    var $version = '2.1.10';
    2121    var $domain = 'printomat';
    2222    var $options_name = 'WP_Print_O_Matic_options';
     
    6868        wp_register_script('printomatic-js', plugins_url('js/printomat.js', __FILE__), array('jquery'), '2.0.11', true);
    6969        wp_register_script('pe-js', plugins_url('js/print_elements.js', __FILE__), array('printomatic-js'), '1.1', true);
    70 
     70       
    7171        //prep options for injection
    7272        $print_data = [
     
    7676            'pom_pause_time' => $this->options['pause_time'],
    7777        ];
    78         wp_add_inline_script( 'printomatic-js', 'const print_data = ' . json_encode( $print_data ), 'before' );
     78        wp_add_inline_script( 'printomatic-js', 'var print_data = ' . json_encode( $print_data ), 'before' );
    7979
    8080        //css
     
    199199            $print_data['pom_pause_time'] = $pause_before_print;
    200200        }
    201         wp_add_inline_script( 'printomatic-js', 'const print_data_'.$id.' = ' . json_encode( $print_data ) );
     201        wp_add_inline_script( 'printomatic-js', 'var print_data_'.$id.' = ' . json_encode( $print_data ) );
    202202
    203203        //return nothing if usign an external button
  • print-o-matic/trunk/readme.txt

    r2846064 r2869326  
    55Requires at least: 4.9
    66Tested up to: 6.1.1
    7 Stable tag: 2.1.9
     7Stable tag: 2.1.10
    88Requires PHP: 7.2
    99License: GPLv2 or later
     
    5050
    5151== Changelog ==
     52
     53= 2.1.10 =
     54* removed pause before print
     55* fixed issue of not printing correctly in safari
    5256
    5357= 2.1.9 =
Note: See TracChangeset for help on using the changeset viewer.