Changeset 3357543
- Timestamp:
- 09/07/2025 09:47:14 PM (7 months ago)
- Location:
- custom-smart-modal/trunk
- Files:
-
- 4 edited
-
admin/settings.php (modified) (2 diffs)
-
custom-welcome-modal.php (modified) (5 diffs)
-
js/modal.js (modified) (3 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-smart-modal/trunk/admin/settings.php
r3357539 r3357543 425 425 plugin_dir_url(dirname(__FILE__)) . 'css/admin-style.css', 426 426 array(), 427 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1. 2'427 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1.1' 428 428 ); 429 429 … … 433 433 plugin_dir_url(__FILE__) . 'js/admin-settings.js', 434 434 array('jquery'), 435 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1. 2',435 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1.1', 436 436 true 437 437 ); -
custom-smart-modal/trunk/custom-welcome-modal.php
r3357539 r3357543 7 7 * Author: Martin Dimitrov 8 8 * Author URI: https://martindimitrov.dk 9 * Version: 1. 29 * Version: 1.1 10 10 * License: GPLv2 or later 11 11 * Text Domain: custom-smart-modal … … 17 17 18 18 if ( ! defined( 'CUSTSMMO_VERSION' ) ) { 19 define( 'CUSTSMMO_VERSION', '1. 2' );19 define( 'CUSTSMMO_VERSION', '1.1' ); 20 20 } 21 21 … … 24 24 add_action('wp_head', 'custsmmo_add_preloader_script', 0); 25 25 function custsmmo_add_preloader_script() { 26 26 27 $bg_color = sanitize_hex_color( get_option('custsmmo_bg_color', '#000000') ); 27 28 $start_visible = (bool) get_option('custsmmo_start_visible', false); 28 $sentence = get_option('custsmmo_sentence', '');29 29 30 // Skip preloader if modal is not visible or no sentence is set31 if ( ! $start_visible || empty($sentence) ) {30 if ( ! $start_visible ) { 31 // If modal does NOT start visible, skip preloader 32 32 return; 33 33 } … … 35 35 // Preloader CSS (inline) 36 36 $preloader_css = " 37 #custsmmo-preloader {position:fixed;top:0;left:0;width:100%;height:100%;background-color:" . esc_attr( $bg_color ?: '#000000' ) . ";z-index:999 999;transition:opacity 0.3s ease;}37 #custsmmo-preloader {position:fixed;top:0;left:0;width:100%;height:100%;background-color:" . esc_attr( $bg_color ?: '#000000' ) . ";z-index:999;} 38 38 .custsmmo-preloader-active {overflow:hidden !important;} 39 39 .custsmmo-preloader-active * {visibility:hidden !important;} 40 #custsmmo-preloader.fade-out {opacity:0;}41 40 "; 42 41 … … 46 45 wp_add_inline_style( 'custsmmo-preloader-inline', $preloader_css ); 47 46 48 // Improved preloader JS with smoother transitions47 // Preloader JS (inline) 49 48 $preloader_js = "(function() { 50 49 try { 51 // Check for internal navigation flag52 50 if (sessionStorage.getItem('custsmmo_internal_navigation') === 'true') { 53 51 sessionStorage.removeItem('custsmmo_internal_navigation'); 54 52 return; 55 53 } 56 57 // Add preloader class to document58 54 document.documentElement.classList.add('custsmmo-preloader-active'); 59 60 // Create preloader element immediately 61 var preloader = document.createElement('div'); 62 preloader.id = 'custsmmo-preloader'; 63 document.body ? document.body.appendChild(preloader) : 64 document.addEventListener('DOMContentLoaded', function() { 55 document.addEventListener('DOMContentLoaded', function() { 56 var preloader = document.getElementById('custsmmo-preloader'); 57 if (!preloader) { 58 preloader = document.createElement('div'); 59 preloader.id = 'custsmmo-preloader'; 65 60 document.body.appendChild(preloader); 66 }); 67 68 // Improved coordination between preloader and modal 69 window.custsmmoPreloaderReady = true; 70 61 } 62 }); 71 63 // Failsafe: auto-remove after 8s 72 setTimeout(function() { 64 setTimeout(function(){ 65 var pre = document.getElementById('custsmmo-preloader'); 73 66 document.documentElement.classList.remove('custsmmo-preloader-active'); 74 if (preloader.parentNode) { 75 preloader.classList.add('fade-out'); 76 setTimeout(function() { 77 if (preloader.parentNode) preloader.parentNode.removeChild(preloader); 78 }, 300); 79 } 80 }, 8000); 81 } catch(e) { 82 console.error('Custom Smart Modal preloader error:', e); 83 } 67 if (pre) { pre.remove(); } 68 },8000); 69 } catch(e) {} 84 70 })();"; 85 71 86 // Register and enqueue inline script 72 // Register an inline-only script handle and add inline JS in head 73 // explicit version and load in header (in_footer = false) because we add this in wp_head 87 74 wp_register_script( 'custsmmo-preloader-inline', false, array(), CUSTSMMO_VERSION, false ); 88 75 wp_enqueue_script( 'custsmmo-preloader-inline' ); -
custom-smart-modal/trunk/js/modal.js
r3357539 r3357543 5 5 document.documentElement.classList.remove('custsmmo-preloader-active'); 6 6 var p = document.getElementById('custsmmo-preloader'); 7 if (p) { 8 p.classList.add('fade-out'); 9 setTimeout(function() { if (p.parentNode) p.parentNode.removeChild(p); }, 300); 10 } 7 if (p) p.remove(); 11 8 }, 8000); 12 9 … … 19 16 const preloader = document.getElementById("custsmmo-preloader"); 20 17 if (preloader) { 21 preloader.classList.add('fade-out'); 22 setTimeout(function() { 23 if (preloader.parentNode) preloader.parentNode.removeChild(preloader); 24 }, 300); 18 preloader.remove(); 25 19 } 26 20 document.documentElement.classList.remove('custsmmo-preloader-active'); … … 40 34 // Function to remove preloader 41 35 function removePreloader() { 42 const preloader = document.getElementById("custsmmo-preloader");43 36 document.documentElement.classList.remove('custsmmo-preloader-active'); 44 45 37 if (preloader) { 46 // Fade out preloader before removing47 preloader.classList.add('fade-out');48 38 setTimeout(function() { 49 if (preloader.parentNode) preloader.parentNode.removeChild(preloader);50 39 document.body.classList.add("custsmmo-preloader-remove"); 51 }, 300); 52 } else { 40 preloader.remove(); 41 }, 100); // Small delay to ensure smooth transition 42 } 43 setTimeout(function() { 53 44 document.body.classList.add("custsmmo-preloader-remove"); 54 } 45 }, 150); 55 46 } 56 47 -
custom-smart-modal/trunk/readme.txt
r3357539 r3357543 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 28 Stable tag: 1.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 64 64 == Changelog == 65 65 66 = 1.2 =67 * Fixed preloader so it dosent get triggered on page navigation.68 69 66 = 1.1 = 70 67 * Minor updates: Updated Delay Before Close default value, added shortcode for settings page under plugins and updated description text. … … 74 71 75 72 == Upgrade Notice == 76 77 = 1.2 =78 Plese update to latest version 1.2 to address all new updates.79 73 80 74 = 1.1 =
Note: See TracChangeset
for help on using the changeset viewer.