Ticket #5190: 5190.diff
File 5190.diff, 3.2 KB (added by , 3 years ago) |
---|
-
themes/pub/wporg-plugins/client/components/plugin/sections/screenshots/image-gallery/index.jsx
export default class ImageGallery extend 435 435 } 436 436 437 437 _slideRight( event ) { 438 438 this.slideToIndex( this.state.currentIndex + 1, event ); 439 439 } 440 440 441 441 _renderItem( item ) { 442 442 return ( 443 443 <figure className="image-gallery-image"> 444 444 <a href={ item.original }> 445 445 <img 446 446 src={ item.original } 447 447 alt={ item.originalAlt } 448 448 srcSet={ item.srcSet } 449 449 sizes={ item.sizes } 450 loading="lazy" 450 451 onLoad={ this.props.onImageLoad } 451 452 onError={ this._handleImageError.bind( this ) } 452 453 /> 453 454 </a> 454 455 { 455 456 item.description && 456 457 <figcaption className="image-gallery-description"> 457 458 { item.description } 458 459 </figcaption> 459 460 } 460 461 </figure> 461 462 ); 462 463 } 463 464 464 465 render() { … … export default class ImageGallery extend 501 502 type="button" 502 503 onMouseOver={ this._handleMouseOverThumbnails.bind( this, index ) } 503 504 onMouseLeave={ this._handleMouseLeaveThumbnails.bind( this, index ) } 504 505 key={ index } 505 506 className={ 506 507 'button-link image-gallery-thumbnail' + 507 508 ( currentIndex === index ? ' active' : '' ) + 508 509 thumbnailClass 509 510 } 510 511 onTouchStart={ event => this.slideToIndex.call( this, index, event ) } 511 512 onClick={ event => this.slideToIndex.call( this, index, event ) } 512 513 > 513 514 <img 514 515 src={ item.thumbnail } 515 516 alt={ item.thumbnailAlt } 517 loading="lazy" 516 518 onError={ this._handleImageError.bind( this ) } /> 517 519 <div className="image-gallery-thumbnail-label"> 518 520 { item.thumbnailLabel } 519 521 </div> 520 522 </button> 521 523 ); 522 524 } ); 523 525 524 526 return ( 525 527 <section ref={ i => this._imageGallery = i } className="image-gallery"> 526 528 <div 527 529 onMouseOver={ this._handleMouseOver.bind( this ) } 528 530 onMouseLeave={ this._handleMouseLeave.bind( this ) } 529 531 className="image-gallery-content"> 530 532 { -
plugins/plugin-directory/shortcodes/class-screenshots.php
class Screenshots { 13 13 14 14 /** 15 15 * @return string 16 16 */ 17 17 static function display() { 18 18 $output = ''; 19 19 20 20 $screenshots = Template::get_screenshots(); 21 21 22 22 if ( ! $screenshots ) { 23 23 return ''; 24 24 } 25 25 26 26 foreach ( $screenshots as $image ) { 27 27 $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>', 29 29 esc_url( $image['src'] ) 30 30 ); 31 31 32 32 if ( $image['caption'] ) { 33 33 $screen_shot .= '<figcaption>' . $image['caption'] . '</figcaption>'; 34 34 } 35 35 36 36 $output .= '<li><figure>' . $screen_shot . '</figure></li>'; 37 37 } 38 38 39 39 return '<ul class="plugin-screenshots">' . $output . '</ul>'; 40 40 } 41 41 }