From cb56fe0c423f5ff9f61b8767f161f147b448f300 Mon Sep 17 00:00:00 2001 From: Switzerbaden Date: Mon, 23 May 2022 10:51:45 +0200 Subject: [PATCH] release 2.1.4 moved pause before print to print-elements script to prevent issue with having to click print twice --- README.md | 4 ++-- js/print_elements.js | 13 ++++++++----- js/printomat.js | 9 +++++---- print-o-matic.php | 8 ++++---- readme.txt | 6 ++++-- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index b86b04a..0c953db 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Print-O-Matic * Donate link: https://pluginoven.com/panares-fund/ * Tags: print, print element, print shortcode, send to print, print button, print me, jQuery, print page, javascript, twinpictures, plugin oven * Requires at least: 4.9 -* Tested up to: 5.9.2 -* Stable tag: 2.1.5a +* Tested up to: 5.9.3 +* Stable tag: 2.1.5 * License: GPLv2 or later * License URI: https://www.gnu.org/licenses/gpl-2.0.html diff --git a/js/print_elements.js b/js/print_elements.js index 30c513f..bd47098 100644 --- a/js/print_elements.js +++ b/js/print_elements.js @@ -59,14 +59,17 @@ var PrintElements = (function () { } }; - var _print = function (elements) { + var _print = function (elements, pause_time) { for (var i = 0; i < elements.length; i++) { _walkTree(elements[i], _attachPrintClasses); } - window.print(); - for (i = 0; i < elements.length; i++) { - _walkTree(elements[i], _cleanup); - } + setTimeout(function () { + window.print(); + for (i = 0; i < elements.length; i++) { + _walkTree(elements[i], _cleanup); + } + }, pause_time); + }; return { diff --git a/js/printomat.js b/js/printomat.js index 055a984..7de0184 100755 --- a/js/printomat.js +++ b/js/printomat.js @@ -1,5 +1,5 @@ /*! - * Print-O-Matic JavaScript v2.0.7 + * Print-O-Matic JavaScript v2.0.8 * https://pluginoven.com/plugins/print-o-matic/ */ @@ -88,9 +88,9 @@ jQuery(document).ready(function() { pause_time = this_print_data.pom_pause_time; } - setTimeout(function () { + //setTimeout(function () { if(targets){ - PrintElements.print(targets); + PrintElements.print(targets, pause_time); } if ( has_top_html ){ @@ -99,7 +99,8 @@ jQuery(document).ready(function() { if ( has_bot_html ){ jQuery( '#pom_bot_html' ).remove(); } - }, pause_time); + //}, pause_time); + }); }); diff --git a/print-o-matic.php b/print-o-matic.php index daec703..90f8869 100644 --- a/print-o-matic.php +++ b/print-o-matic.php @@ -4,7 +4,7 @@ Text Domain: print-o-matic Plugin URI: https://pluginoven.com/plugins/print-o-matic/ Description: Shortcode that adds a printer icon, allowing the user to print the post or a specified HTML element in the post. -Version: 2.1.5a +Version: 2.1.4 Author: twinpictures Author URI: https://twinpictures.de License: GPL2 @@ -17,7 +17,7 @@ */ class WP_Print_O_Matic { - var $version = '2.1.5a'; + var $version = '2.1.4'; var $domain = 'printomat'; var $options_name = 'WP_Print_O_Matic_options'; var $options = array( @@ -65,8 +65,8 @@ function load_textdomain() { */ function printMaticInit() { //script - wp_register_script('printomatic-js', plugins_url('js/printomat.js', __FILE__), array('jquery'), '2.0.7', true); - wp_register_script('pe-js', plugins_url('js/print_elements.js', __FILE__), array('printomatic-js'), '1.0', true); + wp_register_script('printomatic-js', plugins_url('js/printomat.js', __FILE__), array('jquery'), '2.0.8', true); + wp_register_script('pe-js', plugins_url('js/print_elements.js', __FILE__), array('printomatic-js'), '1.1', true); //prep options for injection $print_data = [ diff --git a/readme.txt b/readme.txt index d1fba61..a0153f2 100644 --- a/readme.txt +++ b/readme.txt @@ -3,8 +3,8 @@ Contributors: twinpictures, baden03 Donate link: https://pluginoven.com/panares-fund/ Tags: print, print element, print shortcode, send to print, print button, print me, jQuery, print page, javascript, twinpictures, plugin oven Requires at least: 4.9 -Tested up to: 5.9.2 -Stable tag: 2.1.5a +Tested up to: 5.9.3 +Stable tag: 2.1.4 Requires PHP: 7.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -52,6 +52,7 @@ We like to rock the party. = 2.1.5 = * reverted back to wp_localize_script to pass print data to js script +* moved pause before print to the print-elements script = 2.1.4 = * try and force lazy load images to load before print @@ -240,3 +241,4 @@ We like to rock the party. == Upgrade Notice == * reverted back to wp_localize_script to pass print data to js script +* moved pause before print to the print-elements script