Make WordPress Themes

Changeset 315534


Ignore:
Timestamp:
02/26/2026 08:49:40 PM (4 weeks ago)
Author:
extendify
Message:

Release version 2.1.2

Location:
extendable/2.1.2
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • extendable/2.1.2/assets/editor/animation-settings-modal.js

    r315179 r315534  
    6464                });
    6565
    66                 if (response.ext_animation_settings) {
    67                     setSettings(response.ext_animation_settings);
     66                if (response.extendify_animation_settings) {
     67                    setSettings(response.extendify_animation_settings);
    6868                }
    6969            } catch (err) {
     
    8585                    method: 'POST',
    8686                    data: {
    87                         ext_animation_settings: newSettings
     87                        extendify_animation_settings: newSettings
    8888                    },
    8989                });
  • extendable/2.1.2/assets/js/animations-interactivity.js

    r315179 r315534  
    2020    const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
    2121    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
    2225
    2326    function initAnimations() {
    24         if (prefersReducedMotion.matches) {
     27        if (currentType === 'none' || prefersReducedMotion.matches) {
    2528            return;
    2629        }
    2730   
    2831        if (!('IntersectionObserver' in window)) {
    29             Object.keys(config.map || {}).forEach(selector => {
     32            Object.keys(currentMap).forEach(selector => {
    3033                try {
    3134                    document.querySelectorAll(selector).forEach(el => el.style.opacity = '1');
     
    5760        trackedElements = [];
    5861       
    59         Object.keys(config.map || {}).forEach(selector => {
     62        Object.keys(currentMap).forEach(selector => {
    6063            try {
    6164                const elements = document.querySelectorAll(selector);
    62                 const animationType = config.map[selector];
     65                const animationType = currentMap[selector];
    6366               
    6467                // Group elements by parent for proper stagger
     
    161164    }
    162165
     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
    163243    window.ExtendableAnimations = window.ExtendableAnimations || {};
    164244    window.ExtendableAnimations.reset = resetAnimations;
    165245    window.ExtendableAnimations.setSpeed = setSpeed;
     246    window.ExtendableAnimations.setType = setType;
    166247
    167248    if (document.readyState === 'loading') {
  • extendable/2.1.2/inc/animations.php

    r315179 r315534  
    2020 */
    2121function extendable_register_animation_settings() {
    22     register_setting( 'extendable_animations', 'ext_animation_settings', array(
     22    register_setting( 'extendable_animations', 'extendify_animation_settings', array(
    2323        'type' => 'object',
    2424        'default' => array(
     
    8787function extendable_enqueue_animations() {
    8888
    89     $animation_settings = get_option( 'ext_animation_settings', array(
     89    $animation_settings = get_option( 'extendify_animation_settings', array(
    9090        'type' => 'none',
    9191        'speed' => 'medium'
     
    9595    $animation_speed = $animation_settings['speed'] ?? 'medium';
    9696   
    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 ) ) {
    10298        return;
    10399    }
     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    }
    104106
    105107    $config_file = get_template_directory() . '/assets/config/animations.json';
     
    124126    $defaults = $config['defaults'] ?? array();
    125127    $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    }
    126145
    127146    $sanitized = array();
     
    156175    wp_localize_script( 'extendable-animations', 'ExtendableAnimations', array(
    157176        'map' => $sanitized,
     177        'allTypes' => $all_types,
    158178        'defaults' => array_map( 'sanitize_text_field', $defaults ),
    159179        'speed' => sanitize_key( $animation_speed ),
     180        'type' => sanitize_key( $animation_type ),
    160181    ));
    161182
    162183    // Generate FOUC prevention CSS (respects override classes and reduced motion preference)
     184   
     185    if ( 'none' === $animation_type ) {
     186        return;
     187    }
     188
    163189    $animation_css = '';
    164190    foreach ( $sanitized as $selector => $animation ) {
     
    185211function extendable_enqueue_animation_editor_control() {
    186212   
    187     $animation_settings = get_option( 'ext_animation_settings', array(
     213    $animation_settings = get_option( 'extendify_animation_settings', array(
    188214        'type' => 'none',
    189215        'speed' => 'medium'
     
    225251    );
    226252
    227     $animation_settings = get_option( 'ext_animation_settings', array(
     253    $animation_settings = get_option( 'extendify_animation_settings', array(
    228254        'type' => 'none',
    229255        'speed' => 'medium'
  • extendable/2.1.2/readme.txt

    r315338 r315534  
    44Tested up to: 6.8
    55Requires PHP: 7.4
    6 Stable tag: 2.1.1
     6Stable tag: 2.1.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1313
    1414== Changelog ==
     15
     16= 2.1.2 - 2026-02-27 =
     17- Fixed: Dynamic animation type switching
    1518
    1619= 2.1.1 - 2026-02-25 =
  • extendable/2.1.2/style.css

    r315338 r315534  
    88Tested up to: 6.9
    99Requires PHP: 7.4
    10 Version: 2.1.1
     10Version: 2.1.2
    1111License: GNU General Public License v2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
Note: See TracChangeset for help on using the changeset viewer.