Plugin Directory

Changeset 3805887


Ignore:
Timestamp:
11/16/2026 06:52:00 PM (less than one hour ago)
Author:
globesign
Message:

LCP Fix

Location:
globesign-speed-optimization/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • globesign-speed-optimization/trunk/globesign-speed-optimization.php

    r3805838 r3805887  
    33 * Plugin Name:       GlobeSign Speed Optimization
    44 * Description:       Safe, all-in-one speed optimization: page cache, browser cache, GZIP, minification, JS defer & delay, lazy loading, preloading and database cleanup. Built to never break your site.
    5  * Version:           1.5.2
     5 * Version:           1.5.3
    66 * Requires at least: 6.9
    77 * Requires PHP:      7.4
    … …  
    1515defined( 'ABSPATH' ) || exit;
    1616
    17 define( 'GSSO_VERSION', '1.5.2' );
     17define( 'GSSO_VERSION', '1.5.3' );
    1818define( 'GSSO_FILE', __FILE__ );
    1919define( 'GSSO_DIR', plugin_dir_path( __FILE__ ) );
  • globesign-speed-optimization/trunk/includes/class-gsso-optimizer.php

    r3805838 r3805887  
    8585
    8686                $steps = array();
     87
     88                // Theme compatibility fixes that stop the page jumping (always on: they
     89                // only change code that would otherwise run a moment later).
     90                $steps['theme_fixes'] = array( $this, 'theme_fixes' );
    8791
    8892                if ( GSSO_Settings::get( 'google_fonts_swap' ) ) {
    … …  
    540544         * above it synchronous, because it may depend on them.
    541545         */
     546        /**
     547         * StylemixThemes themes (Consulting and others) size their "Spacing" blocks
     548         * with an inline script right after each block, but only on document ready,
     549         * so every spacer is 0px tall at first paint and the page jumps when they
     550         * open (370px on the Consulting hero). jQuery is loaded in <head>, so the
     551         * script can size its block immediately; the ready/resize handlers stay.
     552         * The script is also marked so Defer/Delay leave it in place.
     553         */
     554        public function theme_fixes( $html ) {
     555                if ( false === strpos( $html, 'stmSpacing' ) ) {
     556                        return $html;
     557                }
     558                return preg_replace_callback(
     559                        '#<script\b([^>]*)>(.*?)</script>#is',
     560                        function ( $m ) {
     561                                if ( false !== stripos( $m[1], 'src=' ) || false === strpos( $m[2], 'spacingID' ) ) {
     562                                        return $m[0];
     563                                }
     564                                $body = preg_replace(
     565                                        '/\$\(\s*document\s*\)\.ready\(\s*function\s*\(\)\s*\{\s*stmSpacing\(\);\s*\}\s*\);/',
     566                                        'stmSpacing(); $(document).ready(function() { stmSpacing(); });',
     567                                        $m[2],
     568                                        1,
     569                                        $count
     570                                );
     571                                if ( ! $count ) {
     572                                        return $m[0];
     573                                }
     574                                return '<script data-no-defer="1"' . $m[1] . '>' . $body . '</script>';
     575                        },
     576                        $html
     577                );
     578        }
     579
    542580        /** Turn a script into one that runs on interaction (or after the timeout). */
    543581        private static function delay_script( array $s ) {
  • globesign-speed-optimization/trunk/readme.txt

    r3805838 r3805887  
    55Tested up to: 7.1
    66Requires PHP: 7.4
    7 Stable tag: 1.5.2
     7Stable tag: 1.5.3
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
    … …  
    128128== Changelog ==
    129129
     130= 1.5.3 =
     131* Fix: on StylemixThemes themes (Consulting and others), "Spacing" blocks were 0px tall until the page finished loading and then opened up, pushing everything down (a large layout shift on the Consulting hero). Their sizing now runs immediately, so the page doesn't jump. Resizing still adjusts them as before.
     132
    130133= 1.5.2 =
    131134* Fix: Minify JavaScript could break a file containing an "if" (or "for"/"while") with an empty body, such as  if ( ... ) ;  which made the browser reject the whole file. On the Consulting theme this stopped text from fading in. Minified files now keep that semicolon.
    … …  
    189192== Upgrade Notice ==
    190193
     194= 1.5.3 =
     195Stops the page jumping on StylemixThemes themes (Consulting and others) caused by spacing blocks opening after load.
     196
    191197= 1.5.2 =
    192198Fixes a JavaScript minification bug that could hide animated text on some themes, and reCAPTCHA errors on Contact Form 7 when delaying scripts.
Note: See TracChangeset for help on using the changeset viewer.