Making WordPress.org

Ticket #5190: 5190.diff

File 5190.diff, 3.2 KB (added by dd32, 3 years ago)
  • themes/pub/wporg-plugins/client/components/plugin/sections/screenshots/image-gallery/index.jsx

    export default class ImageGallery extend 
    435435        }
    436436
    437437        _slideRight( event ) {
    438438                this.slideToIndex( this.state.currentIndex + 1, event );
    439439        }
    440440
    441441        _renderItem( item ) {
    442442                return (
    443443                        <figure className="image-gallery-image">
    444444                                <a href={ item.original }>
    445445                                        <img
    446446                                                src={ item.original }
    447447                                                alt={ item.originalAlt }
    448448                                                srcSet={ item.srcSet }
    449449                                                sizes={ item.sizes }
     450                                                loading="lazy"
    450451                                                onLoad={ this.props.onImageLoad }
    451452                                                onError={ this._handleImageError.bind( this ) }
    452453                                        />
    453454                                </a>
    454455                                {
    455456                                        item.description &&
    456457                                        <figcaption className="image-gallery-description">
    457458                                                { item.description }
    458459                                        </figcaption>
    459460                                }
    460461                        </figure>
    461462                );
    462463        }
    463464
    464465        render() {
    export default class ImageGallery extend 
    501502                                        type="button"
    502503                                        onMouseOver={ this._handleMouseOverThumbnails.bind( this, index ) }
    503504                                        onMouseLeave={ this._handleMouseLeaveThumbnails.bind( this, index ) }
    504505                                        key={ index }
    505506                                        className={
    506507                                                'button-link image-gallery-thumbnail' +
    507508                                                ( currentIndex === index ? ' active' : '' ) +
    508509                                                thumbnailClass
    509510                                        }
    510511                                        onTouchStart={ event => this.slideToIndex.call( this, index, event ) }
    511512                                        onClick={ event => this.slideToIndex.call( this, index, event ) }
    512513                                >
    513514                                        <img
    514515                                                src={ item.thumbnail }
    515516                                                alt={ item.thumbnailAlt }
     517                                                loading="lazy"
    516518                                                onError={ this._handleImageError.bind( this ) } />
    517519                                        <div className="image-gallery-thumbnail-label">
    518520                                                { item.thumbnailLabel }
    519521                                        </div>
    520522                                </button>
    521523                        );
    522524                } );
    523525
    524526                return (
    525527                        <section ref={ i => this._imageGallery = i } className="image-gallery">
    526528                                <div
    527529                                        onMouseOver={ this._handleMouseOver.bind( this ) }
    528530                                        onMouseLeave={ this._handleMouseLeave.bind( this ) }
    529531                                        className="image-gallery-content">
    530532                                        {
  • plugins/plugin-directory/shortcodes/class-screenshots.php

    class Screenshots { 
    1313
    1414        /**
    1515         * @return string
    1616         */
    1717        static function display() {
    1818                $output = '';
    1919
    2020                $screenshots = Template::get_screenshots();
    2121
    2222                if ( ! $screenshots ) {
    2323                        return '';
    2424                }
    2525
    2626                foreach ( $screenshots as $image ) {
    2727                        $screen_shot = sprintf(
    28                                 '<a href="%1$s" rel="nofollow"><img class="screenshot" src="%1$s" alt="" /></a>',
     28                                '<a href="%1$s" rel="nofollow"><img class="screenshot" src="%1$s" alt="" loading="lazy" /></a>',
    2929                                esc_url( $image['src'] )
    3030                        );
    3131
    3232                        if ( $image['caption'] ) {
    3333                                $screen_shot .= '<figcaption>' . $image['caption'] . '</figcaption>';
    3434                        }
    3535
    3636                        $output .= '<li><figure>' . $screen_shot . '</figure></li>';
    3737                }
    3838
    3939                return '<ul class="plugin-screenshots">' . $output . '</ul>';
    4040        }
    4141}