Changeset 3357629
- Timestamp:
- 09/08/2025 07:10:26 AM (7 months ago)
- Location:
- custom-smart-modal/trunk
- Files:
-
- 4 edited
-
admin/settings.php (modified) (2 diffs)
-
custom-welcome-modal.php (modified) (3 diffs)
-
js/modal.js (modified) (4 diffs)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
custom-smart-modal/trunk/admin/settings.php
r3357543 r3357629 425 425 plugin_dir_url(dirname(__FILE__)) . 'css/admin-style.css', 426 426 array(), 427 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1. 1'427 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1.2' 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. 1',435 defined('CUSTSMMO_VERSION') ? CUSTSMMO_VERSION : '1.2', 436 436 true 437 437 ); -
custom-smart-modal/trunk/custom-welcome-modal.php
r3357543 r3357629 7 7 * Author: Martin Dimitrov 8 8 * Author URI: https://martindimitrov.dk 9 * Version: 1. 19 * Version: 1.2 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. 1' );19 define( 'CUSTSMMO_VERSION', '1.2' ); 20 20 } 21 21 … … 48 48 $preloader_js = "(function() { 49 49 try { 50 // Create a domain-specific localStorage key 51 const domainKey = 'custsmmo_shown_before_' + window.location.hostname; 52 53 // Generate a unique session identifier 54 if (!sessionStorage.getItem('custsmmo_session_id')) { 55 sessionStorage.setItem('custsmmo_session_id', Date.now().toString() + Math.random().toString(36).substring(2, 15)); 56 } 57 58 // Get navigation information 59 const navEntry = performance.getEntriesByType('navigation')[0]; 60 const navType = navEntry ? navEntry.type : ''; 61 62 // Reset localStorage on reload or new session (new window/tab) 63 if (navType === 'reload' || !localStorage.getItem('custsmmo_current_session')) { 64 localStorage.removeItem(domainKey); 65 localStorage.setItem('custsmmo_current_session', sessionStorage.getItem('custsmmo_session_id')); 66 } else if (localStorage.getItem('custsmmo_current_session') !== sessionStorage.getItem('custsmmo_session_id')) { 67 // Different session ID means new window/tab 68 localStorage.removeItem(domainKey); 69 localStorage.setItem('custsmmo_current_session', sessionStorage.getItem('custsmmo_session_id')); 70 } 71 72 // Check for internal navigation flag 50 73 if (sessionStorage.getItem('custsmmo_internal_navigation') === 'true') { 51 74 sessionStorage.removeItem('custsmmo_internal_navigation'); 52 75 return; 53 76 } 77 78 // Check if modal has been shown before and not a refresh 79 if (navType !== 'reload' && localStorage.getItem(domainKey) === 'true') { 80 return; // Skip preloader if modal was shown before and not refreshing 81 } 82 54 83 document.documentElement.classList.add('custsmmo-preloader-active'); 55 84 document.addEventListener('DOMContentLoaded', function() { -
custom-smart-modal/trunk/js/modal.js
r3357543 r3357629 8 8 }, 8000); 9 9 10 const navEntry = performance.getEntriesByType("navigation")[0]; 11 const navType = navEntry ? navEntry.type : "navigate"; 12 13 const domainKey = 'custsmmo_shown_before_' + window.location.hostname; 14 15 if (!sessionStorage.getItem('custsmmo_session_id')) { 16 sessionStorage.setItem('custsmmo_session_id', Date.now().toString() + Math.random().toString(36).substring(2, 15)); 17 } 18 19 if (navType === "reload" || !localStorage.getItem('custsmmo_current_session')) { 20 localStorage.removeItem(domainKey); 21 localStorage.setItem('custsmmo_current_session', sessionStorage.getItem('custsmmo_session_id')); 22 } else if (localStorage.getItem('custsmmo_current_session') !== sessionStorage.getItem('custsmmo_session_id')) { 23 // Different session ID means new window/tab 24 localStorage.removeItem(domainKey); 25 localStorage.setItem('custsmmo_current_session', sessionStorage.getItem('custsmmo_session_id')); 26 } 27 28 if (localStorage.getItem(domainKey) === 'true' && navType !== "reload") { 29 const preloader = document.getElementById("custsmmo-preloader"); 30 if (preloader) { 31 preloader.remove(); 32 } 33 document.documentElement.classList.remove('custsmmo-preloader-active'); 34 return; 35 } 10 36 11 37 if (sessionStorage.getItem('custsmmo_internal_navigation') === 'true') { … … 13 39 sessionStorage.removeItem('custsmmo_internal_navigation'); 14 40 15 // Skip modal 41 // Skip modal on internal navigation 16 42 const preloader = document.getElementById("custsmmo-preloader"); 17 43 if (preloader) { … … 50 76 return; 51 77 } 52 53 const navEntry = performance.getEntriesByType("navigation")[0];54 const navType = navEntry ? navEntry.type : "navigate";55 78 56 79 const isReloadOrDirect = navType === "reload" || navType === "navigate"; … … 64 87 return; 65 88 } 89 90 localStorage.setItem(domainKey, 'true'); 66 91 67 92 // ✅ Apply settings -
custom-smart-modal/trunk/readme.txt
r3357543 r3357629 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 18 Stable tag: 1.2 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 * Important update: Fixed preloader to not show on page navigation and fixed modal not to show on page navigation 68 66 69 = 1.1 = 67 70 * Minor updates: Updated Delay Before Close default value, added shortcode for settings page under plugins and updated description text. … … 71 74 72 75 == Upgrade Notice == 76 77 = 1.2 = 78 Plese update to latest version 1.2 to address all new updates. 73 79 74 80 = 1.1 =
Note: See TracChangeset
for help on using the changeset viewer.