Make WordPress Core

Changeset 35281


Ignore:
Timestamp:
10/20/2015 05:35:07 AM (11 years ago)
Author:
wonderboymusic
Message:

Theme Installer: toggle iframe-ready on the overlay to control the spinner animated GIF and high CPU usage.

Props afercia, adamsilverstein.
Fixes #33322.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/css/themes.css

    r35220 r35281  
    16351635
    16361636.theme-install-overlay .wp-full-overlay-main {
     1637        position: relative;
     1638        z-index: 0;
     1639        background-color: #fff;
     1640}
     1641
     1642.theme-install-overlay .wp-full-overlay-main:before {
     1643        content: '';
     1644        display: block;
     1645        width: 20px;
     1646        height: 20px;
     1647        position: absolute;
     1648        left: 50%;
     1649        top: 50%;
     1650        z-index: -1;
     1651        margin: -10px 0 0 -10px;
     1652        transform: translateZ(0);
    16371653        background: #fff url(../images/spinner.gif) no-repeat center center;
    16381654        -webkit-background-size: 20px 20px;
    16391655        background-size: 20px 20px;
     1656}
     1657
     1658.theme-install-overlay.iframe-ready .wp-full-overlay-main:before {
     1659        background-image: none;
    16401660}
    16411661
    … …  
    16571677        #customize-preview.wp-full-overlay-main,
    16581678        .customize-loading #customize-container,
    1659         .theme-install-overlay .wp-full-overlay-main {
     1679        .theme-install-overlay .wp-full-overlay-main:before {
    16601680                background-image: url(../images/spinner-2x.gif);
    16611681        }
  • trunk/src/wp-admin/js/theme.js

    r35273 r35281  
    767767
    768768        render: function() {
    769                 var data = this.model.toJSON();
    770 
    771                 this.$el.html( this.html( data ) );
     769                var self = this,
     770                        data = this.model.toJSON();
     771
     772                this.$el.removeClass( 'iframe-ready' ).html( this.html( data ) );
    772773
    773774                themes.router.navigate( themes.router.baseUrl( themes.router.themePath + this.model.get( 'id' ) ), { replace: true } );
    … …  
    777778                        $( '.close-full-overlay' ).focus();
    778779                });
     780
     781                this.$el.find( 'iframe' ).one( 'load', function() {
     782                        self.iframeLoaded();
     783                });
     784        },
     785
     786        iframeLoaded: function() {
     787                this.$el.addClass( 'iframe-ready' );
    779788        },
    780789
    … …  
    787796                                themes.focusedTheme.focus();
    788797                        }
    789                 });
     798                }).removeClass( 'iframe-ready' );
    790799
    791800                themes.router.navigate( themes.router.baseUrl( '' ) );
Note: See TracChangeset for help on using the changeset viewer.