Changeset 315534
- Timestamp:
- 02/26/2026 08:49:40 PM (4 weeks ago)
- Location:
- extendable/2.1.2
- Files:
-
- 5 edited
- 1 copied
-
. (copied) (copied from extendable/2.1.1)
-
assets/editor/animation-settings-modal.js (modified) (2 diffs)
-
assets/js/animations-interactivity.js (modified) (3 diffs)
-
inc/animations.php (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
style.css (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
extendable/2.1.2/assets/editor/animation-settings-modal.js
r315179 r315534 64 64 }); 65 65 66 if (response.ext _animation_settings) {67 setSettings(response.ext _animation_settings);66 if (response.extendify_animation_settings) { 67 setSettings(response.extendify_animation_settings); 68 68 } 69 69 } catch (err) { … … 85 85 method: 'POST', 86 86 data: { 87 ext _animation_settings: newSettings87 extendify_animation_settings: newSettings 88 88 }, 89 89 }); -
extendable/2.1.2/assets/js/animations-interactivity.js
r315179 r315534 20 20 const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)'); 21 21 let currentSpeed = config.speed || 'medium'; 22 let currentType = config.type || 'none'; 23 let currentMap = config.map || {}; 24 const initialType = config.type || 'none'; // Track if PHP added FOUC CSS 22 25 23 26 function initAnimations() { 24 if ( prefersReducedMotion.matches) {27 if (currentType === 'none' || prefersReducedMotion.matches) { 25 28 return; 26 29 } 27 30 28 31 if (!('IntersectionObserver' in window)) { 29 Object.keys(c onfig.map || {}).forEach(selector => {32 Object.keys(currentMap).forEach(selector => { 30 33 try { 31 34 document.querySelectorAll(selector).forEach(el => el.style.opacity = '1'); … … 57 60 trackedElements = []; 58 61 59 Object.keys(c onfig.map || {}).forEach(selector => {62 Object.keys(currentMap).forEach(selector => { 60 63 try { 61 64 const elements = document.querySelectorAll(selector); 62 const animationType = c onfig.map[selector];65 const animationType = currentMap[selector]; 63 66 64 67 // Group elements by parent for proper stagger … … 161 164 } 162 165 166 function setType(type) { 167 currentType = type || 'none'; 168 169 if (initialType === 'none') { 170 const existingStyle = document.getElementById('ext-fouc-styles'); 171 if (existingStyle) { 172 existingStyle.remove(); 173 } 174 } 175 176 trackedElements.forEach(element => { 177 element.classList.remove( 178 'ext-animate', 179 'ext-animated-fade', 180 'ext-animated-fade-up', 181 'ext-animated-fade-down', 182 'ext-animated-fade-left', 183 'ext-animated-fade-right', 184 'ext-animated-zoom-in', 185 'ext-animation-complete' 186 ); 187 element.style.opacity = ''; 188 element.style.transform = ''; 189 element.style.animationDuration = ''; 190 element.style.animationDelay = ''; 191 }); 192 193 trackedElements = []; 194 195 if (observer) { 196 observer.disconnect(); 197 } 198 199 if (currentType === 'none') { 200 // Force elements visible (override PHP FOUC CSS) 201 Object.keys(config.allTypes?.['fade'] || currentMap || {}).forEach(selector => { 202 try { 203 document.querySelectorAll(selector).forEach(el => { 204 el.style.opacity = '1'; 205 el.style.transform = 'none'; 206 }); 207 } catch (e) {} 208 }); 209 return true; 210 } 211 212 if (config.allTypes && config.allTypes[currentType]) { 213 currentMap = config.allTypes[currentType]; 214 } 215 216 Object.keys(currentMap).forEach(selector => { 217 try { 218 document.querySelectorAll(selector).forEach(el => { 219 el.style.opacity = ''; 220 }); 221 } catch (e) {} 222 }); 223 224 // Only inject FOUC CSS if PHP didn't add it 225 if (initialType === 'none') { 226 const styleEl = document.createElement('style'); 227 styleEl.id = 'ext-fouc-styles'; 228 let css = ''; 229 Object.keys(currentMap).forEach(selector => { 230 css += `@media (prefers-reduced-motion: no-preference) { ${selector}:not(.ext-animate--off) { opacity: 0; } } `; 231 }); 232 styleEl.textContent = css; 233 document.head.appendChild(styleEl); 234 } 235 236 requestAnimationFrame(() => { 237 initAnimations(); 238 }); 239 240 return true; 241 } 242 163 243 window.ExtendableAnimations = window.ExtendableAnimations || {}; 164 244 window.ExtendableAnimations.reset = resetAnimations; 165 245 window.ExtendableAnimations.setSpeed = setSpeed; 246 window.ExtendableAnimations.setType = setType; 166 247 167 248 if (document.readyState === 'loading') { -
extendable/2.1.2/inc/animations.php
r315179 r315534 20 20 */ 21 21 function extendable_register_animation_settings() { 22 register_setting( 'extendable_animations', 'ext _animation_settings', array(22 register_setting( 'extendable_animations', 'extendify_animation_settings', array( 23 23 'type' => 'object', 24 24 'default' => array( … … 87 87 function extendable_enqueue_animations() { 88 88 89 $animation_settings = get_option( 'ext _animation_settings', array(89 $animation_settings = get_option( 'extendify_animation_settings', array( 90 90 'type' => 'none', 91 91 'speed' => 'medium' … … 95 95 $animation_speed = $animation_settings['speed'] ?? 'medium'; 96 96 97 if ( is_admin() || 98 ! apply_filters( 'extendable_enable_animations', true ) || 99 false === $animation_type || 100 empty( $animation_type ) || 101 'none' === $animation_type ) { 97 if ( ! apply_filters( 'extendable_enable_animations', true ) ) { 102 98 return; 103 99 } 100 101 // Skip loading for visitors when animations disabled 102 // Logged-in users need JS for real-time switching in agent UI 103 if ( 'none' === $animation_type && ! is_user_logged_in() ) { 104 return; 105 } 104 106 105 107 $config_file = get_template_directory() . '/assets/config/animations.json'; … … 124 126 $defaults = $config['defaults'] ?? array(); 125 127 $css_config = $config['css'] ?? array(); 128 129 $all_types = array(); 130 foreach ( $config['types'] as $type_key => $type_config ) { 131 $type_mappings = array(); 132 if ( isset( $type_config['mappings'] ) && is_array( $type_config['mappings'] ) ) { 133 foreach ( $type_config['mappings'] as $selector => $animation ) { 134 $clean_selector = sanitize_text_field( trim( $selector ) ); 135 $clean_animation = sanitize_key( trim( $animation ) ); 136 if ( ! empty( $clean_selector ) && ! empty( $clean_animation ) ) { 137 $type_mappings[ $clean_selector ] = $clean_animation; 138 } 139 } 140 } 141 if ( ! empty( $type_mappings ) ) { 142 $all_types[ sanitize_key( $type_key ) ] = $type_mappings; 143 } 144 } 126 145 127 146 $sanitized = array(); … … 156 175 wp_localize_script( 'extendable-animations', 'ExtendableAnimations', array( 157 176 'map' => $sanitized, 177 'allTypes' => $all_types, 158 178 'defaults' => array_map( 'sanitize_text_field', $defaults ), 159 179 'speed' => sanitize_key( $animation_speed ), 180 'type' => sanitize_key( $animation_type ), 160 181 )); 161 182 162 183 // Generate FOUC prevention CSS (respects override classes and reduced motion preference) 184 185 if ( 'none' === $animation_type ) { 186 return; 187 } 188 163 189 $animation_css = ''; 164 190 foreach ( $sanitized as $selector => $animation ) { … … 185 211 function extendable_enqueue_animation_editor_control() { 186 212 187 $animation_settings = get_option( 'ext _animation_settings', array(213 $animation_settings = get_option( 'extendify_animation_settings', array( 188 214 'type' => 'none', 189 215 'speed' => 'medium' … … 225 251 ); 226 252 227 $animation_settings = get_option( 'ext _animation_settings', array(253 $animation_settings = get_option( 'extendify_animation_settings', array( 228 254 'type' => 'none', 229 255 'speed' => 'medium' -
extendable/2.1.2/readme.txt
r315338 r315534 4 4 Tested up to: 6.8 5 5 Requires PHP: 7.4 6 Stable tag: 2.1. 16 Stable tag: 2.1.2 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 13 13 14 14 == Changelog == 15 16 = 2.1.2 - 2026-02-27 = 17 - Fixed: Dynamic animation type switching 15 18 16 19 = 2.1.1 - 2026-02-25 = -
extendable/2.1.2/style.css
r315338 r315534 8 8 Tested up to: 6.9 9 9 Requires PHP: 7.4 10 Version: 2.1. 110 Version: 2.1.2 11 11 License: GNU General Public License v2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset
for help on using the changeset viewer.