Plugin Directory

Changeset 3355919


Ignore:
Timestamp:
09/04/2025 09:46:54 AM (7 months ago)
Author:
luzuk
Message:

Fixed Errors

Location:
luzuk-photo-gallery
Files:
38 added
3 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • luzuk-photo-gallery/trunk/assets/css/frontend.css

    r3355792 r3355919  
    33.lzg-layout-grid .lzg-items{grid-template-columns:repeat(var(--lzg-cols),1fr)}
    44.lzg-layout-justified .lzg-items{grid-auto-rows:1fr}
    5 .lzg-layout-masonry .lzg-items{position:relative;display:block}
    6 .lzg-layout-masonry .lzg-item{position:absolute;width:calc((100% - (var(--lzg-gutter) * (var(--lzg-cols) - 1)) / var(--lzg-cols))}
     5.lzg-layout-masonry .lzg-items{display:block;column-count:var(--lzg-cols);column-gap:var(--lzg-gutter)}
     6.lzg-layout-masonry .lzg-item{break-inside:avoid;page-break-inside:avoid;-webkit-column-break-inside:avoid;-moz-column-break-inside:avoid;margin-bottom:var(--lzg-gutter)}
     7.lzg-layout-masonry .lzg-img{width:100%;height:auto;object-fit:initial}
    78.lzg-item{position:relative;overflow:hidden;border-radius:var(--lzg-radius)}
    89.lzg-img{width:100%;height:100%;object-fit:cover;display:block;transition:transform .3s ease,opacity .3s ease}
  • luzuk-photo-gallery/trunk/assets/js/frontend.js

    r3355792 r3355919  
    1313    });
    1414
    15     // Masonry layout initialization
    16     document.querySelectorAll('.lzg-layout-masonry .lzg-items').forEach(function(container){
    17         // Wait for images to load before initializing masonry
    18         var images = container.querySelectorAll('.lzg-img');
    19         var loadedImages = 0;
    20        
    21         if (images.length === 0) {
    22             // No images, initialize immediately
    23             initMasonry(container);
    24         } else {
    25             // Wait for all images to load
    26             images.forEach(function(img){
    27                 if (img.complete) {
    28                     loadedImages++;
    29                     if (loadedImages === images.length) {
    30                         initMasonry(container);
    31                     }
    32                 } else {
    33                     img.addEventListener('load', function(){
    34                         loadedImages++;
    35                         if (loadedImages === images.length) {
    36                             initMasonry(container);
    37                         }
    38                     });
    39                     img.addEventListener('error', function(){
    40                         loadedImages++;
    41                         if (loadedImages === images.length) {
    42                             initMasonry(container);
    43                         }
    44                     });
    45                 }
    46             });
    47         }
    48     });
    49 
    50     // Initialize masonry layout
    51     function initMasonry(container) {
    52         if (typeof window.Masonry !== 'undefined') {
    53             // Use the Masonry library if available
    54             new window.Masonry(container, {
    55                 itemSelector: '.lzg-item',
    56                 columnWidth: '.lzg-item',
    57                 percentPosition: true,
    58                 gutter: parseInt(getComputedStyle(container).getPropertyValue('--lzg-gutter')) || 0
    59             });
    60         } else {
    61             // Fallback to custom masonry implementation
    62             initCustomMasonry(container);
    63         }
    64     }
    65 
    66     // Custom masonry implementation
    67     function initCustomMasonry(container) {
    68         var items = container.querySelectorAll('.lzg-item');
    69         var gutter = parseInt(getComputedStyle(container).getPropertyValue('--lzg-gutter')) || 0;
    70         var cols = parseInt(getComputedStyle(container).getPropertyValue('--lzg-cols')) || 3;
    71        
    72         if (items.length === 0) return;
    73 
    74         // Reset container height
    75         container.style.height = 'auto';
    76        
    77         // Calculate item width
    78         var containerWidth = container.offsetWidth;
    79         var itemWidth = (containerWidth - (gutter * (cols - 1))) / cols;
    80        
    81         // Set item widths
    82         items.forEach(function(item){
    83             item.style.width = itemWidth + 'px';
    84             item.style.position = 'absolute';
    85         });
    86 
    87         // Calculate positions
    88         var colHeights = new Array(cols).fill(0);
    89         var positions = [];
    90 
    91         items.forEach(function(item, index){
    92             var col = index % cols;
    93             var x = col * (itemWidth + gutter);
    94             var y = colHeights[col];
    95            
    96             positions.push({x: x, y: y, item: item});
    97            
    98             // Update column height
    99             colHeights[col] += item.offsetHeight + gutter;
    100         });
    101 
    102         // Apply positions
    103         positions.forEach(function(pos){
    104             pos.item.style.left = pos.x + 'px';
    105             pos.item.style.top = pos.y + 'px';
    106         });
    107 
    108         // Set container height
    109         var maxHeight = Math.max.apply(null, colHeights);
    110         container.style.height = maxHeight + 'px';
    111     }
    112 
    11315    // Lightbox init
    11416    if(typeof window.lzgLightboxInit === 'function'){
  • luzuk-photo-gallery/trunk/includes/class-lzg-assets.php

    r3355792 r3355919  
    5353        wp_enqueue_style( 'lzg-frontend', LZG_URL . 'assets/css/frontend.css', array(), LZG_VER );
    5454        wp_enqueue_style( 'lzg-lightbox', LZG_URL . 'assets/css/lightbox.css', array(), LZG_VER );
    55         wp_enqueue_script( 'lzg-ev-emitter', LZG_URL . 'assets/js/ev-emitter.js', array(), LZG_VER, true );
    56         wp_enqueue_script( 'lzg-masonry', LZG_URL . 'assets/js/masonry.min.js', array( 'lzg-ev-emitter' ), LZG_VER, true );
    5755        wp_enqueue_script( 'lzg-lightbox', LZG_URL . 'assets/js/lightbox.js', array(), LZG_VER, true );
    58         wp_enqueue_script( 'lzg-frontend', LZG_URL . 'assets/js/frontend.js', array( 'lzg-masonry' ), LZG_VER, true );
     56        wp_enqueue_script( 'lzg-frontend', LZG_URL . 'assets/js/frontend.js', array(), LZG_VER, true );
    5957    }
    6058
  • luzuk-photo-gallery/trunk/luzuk-photo-gallery.php

    r3355792 r3355919  
    44 * Plugin URI:        https://wordpress.org/plugins/luzuk-photo-gallery/
    55 * Description:       Lightweight, accessible photo gallery with grid, masonry, justified, and carousel layouts. Shortcode and Gutenberg block included.
    6  * Version:           1.0.0
     6 * Version:           1.0.1
    77 * Author:            Luzuk
    88 * Author URI:        https://www.luzuk.com/
  • luzuk-photo-gallery/trunk/readme.txt

    r3355792 r3355919  
    55Tested up to: 6.6
    66Requires PHP: 7.4
    7 Stable tag: 1.0.0
     7Stable tag: 1.0.1
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    5050= 1.0.0 =
    5151* Initial release.
     52
     53= 1.0.2 =
     54* Fixed some errors.
    5255
    5356=== Luzuk Photo Gallery ===
Note: See TracChangeset for help on using the changeset viewer.