From 9899eabf45944f228331621107e78347a6c0916d Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Fri, 22 Dec 2023 13:09:18 +0200 Subject: [PATCH 1/3] - used _.debounce when resize; --- assets/js/common-frontend.js | 2 +- assets/js/common-frontend.min.js | 2 +- assets/js/common.min.js | 2 +- assets/js/um-responsive.js | 7 +++++-- assets/js/um-responsive.min.js | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/assets/js/common-frontend.js b/assets/js/common-frontend.js index 767cf64f..fef49375 100644 --- a/assets/js/common-frontend.js +++ b/assets/js/common-frontend.js @@ -91,7 +91,7 @@ UM.frontend = { } }, destroy: function() { - if ( jQuery('.cropper-container').length > 0 ) { + if ( jQuery('.cropper-container').length > 0 && UM.frontend.cropper.obj ) { UM.frontend.cropper.obj.destroy(); // destroy Cropper.JS method UM.frontend.cropper.obj = null; // flush our own object } diff --git a/assets/js/common-frontend.min.js b/assets/js/common-frontend.min.js index 8748e4ea..aae402d3 100644 --- a/assets/js/common-frontend.min.js +++ b/assets/js/common-frontend.min.js @@ -1 +1 @@ -"object"!=typeof window.UM&&(window.UM={}),"object"!=typeof UM.frontend&&(UM.frontend={}),UM.frontend={cropper:{obj:null,init:function(){var o=jQuery(".um-modal .um-single-image-preview img").first();if(o.length&&""!==o.attr("src")){UM.frontend.cropper.obj&&UM.frontend.cropper.destroy();var t=jQuery(".um-modal .um-single-image-preview"),r=o.parent().data("crop"),n=o.parent().data("min_width"),i=o.parent().data("min_height"),a=o.parent().data("ratio"),d=jQuery(".um-modal").find("#um_upload_single").data("ratio"),d=(d&&(a=d.split(":")[0]),jQuery(window).height()-(jQuery(".um-modal-footer a").height()+20)-50-jQuery(".um-modal-header:visible").height());o.css({height:"auto"}),t.css({height:"auto"}),jQuery(window).height()<=400?(t.css({height:d+"px","max-height":d+"px"}),o.css({height:"auto"})):(o.css({height:"auto","max-height":d+"px"}),t.css({height:o.height(),"max-height":d+"px"}));let e;"square"===r?e={minWidth:n,minHeight:i,dragCrop:!1,aspectRatio:1,zoomable:!1,rotatable:!1,dashed:!1}:"cover"===r?(0 Date: Wed, 3 Jan 2024 14:18:22 +0200 Subject: [PATCH 2/3] - increased debounce interval; --- assets/js/um-responsive.js | 2 +- assets/js/um-responsive.min.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/js/um-responsive.js b/assets/js/um-responsive.js index 4eb6f3bf..c753672f 100644 --- a/assets/js/um-responsive.js +++ b/assets/js/um-responsive.js @@ -13,7 +13,7 @@ jQuery(window).on( 'resize', _.debounce( function() { um_responsive(); um_modal_responsive(); -}, 100 ) ); +}, 300 ) ); wp.hooks.addAction( 'um_admin_modal_success_result', 'um_frontend_responsive', function( $adminModal ) { // Make responsive script only when live preview, diff --git a/assets/js/um-responsive.min.js b/assets/js/um-responsive.min.js index 8549ddb2..c05ec19e 100644 --- a/assets/js/um-responsive.min.js +++ b/assets/js/um-responsive.min.js @@ -1 +1 @@ -jQuery(window).on("load",function(){um_responsive(),um_modal_responsive()}),jQuery(window).on("resize",_.debounce(function(){responsive_Modal(),wp.hooks.doAction("um_window_resize"),um_responsive(),um_modal_responsive()},100)),wp.hooks.addAction("um_admin_modal_success_result","um_frontend_responsive",function(o){o.find(".um-admin-modal-body").find(".um").length&&um_responsive()}); \ No newline at end of file +jQuery(window).on("load",function(){um_responsive(),um_modal_responsive()}),jQuery(window).on("resize",_.debounce(function(){responsive_Modal(),wp.hooks.doAction("um_window_resize"),um_responsive(),um_modal_responsive()},300)),wp.hooks.addAction("um_admin_modal_success_result","um_frontend_responsive",function(o){o.find(".um-admin-modal-body").find(".um").length&&um_responsive()}); \ No newline at end of file From ceebdb3953a5005008cf30ce609137733238e68f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 3 Jan 2024 14:43:00 +0200 Subject: [PATCH 3/3] - added class="fusion-lazyload-ignore" to empty images in modal window while upload avatar or cover photo. Avoid the conflict with Fusion Images lazyload functionality; --- includes/core/class-fields.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index 59cb850a..5aeae98a 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2963,7 +2963,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } else { $img_value = UM()->files()->get_download_link( $this->set_id, $key, um_user( 'ID' ) ); } - $img = ''; + $img = ''; } else { $img = ''; } @@ -2981,7 +2981,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { if ( empty( $disabled ) ) { $output .= ''; } - $output .= '
'; + $output .= '
'; if ( empty( $disabled ) ) { $output .= '' . esc_html( $data['button_text'] ) . ''; } @@ -3014,7 +3014,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } $nonce = wp_create_nonce( 'um_upload_nonce-' . $this->timestamp ); - $output .= '
'; + $output .= '
'; $output .= '
' . esc_html( $data['button_text'] ) . '
'; $output .= '