Plugin Directory

Changeset 3487643


Ignore:
Timestamp:
03/21/2026 07:40:36 AM (8 days ago)
Author:
rusnet
Message:

Update 2.1.4

Location:
rusnet-interactive-map/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • rusnet-interactive-map/trunk/assets/css/front.css

    r3485624 r3487643  
    7171    justify-content: center;
    7272}
     73
    7374.rusnetim-lightbox .rusnetim-lightbox-container {
    7475    position: relative;
    75     max-width: 90vw;
    76     max-height: 90vh;
     76    width: 90vw;
     77    height: 90vh;
     78    display: flex;
     79    align-items: center;
     80    justify-content: center;
    7781}
     82
    7883.rusnetim-lightbox img {
    79     max-width: 100%;
    80     max-height: 100%;
     84    max-width: 100% !important;
     85    max-height: 100% !important;
     86    width: 100% !important;
     87    height: 100% !important;
    8188    display: block;
    82     margin: 0 auto;
     89    object-fit: contain !important;
    8390    border-radius: 4px;
    8491}
     92
    8593.rusnetim-lightbox-close {
    8694    position: absolute;
     
    92100    line-height: 1;
    93101}
     102
    94103.rusnetim-lightbox-prev,
    95104.rusnetim-lightbox-next {
     
    98107    transform: translateY(-50%);
    99108    color: white;
    100     font-size: 50px;
     109    font-size: 40px;
    101110    cursor: pointer;
    102111    user-select: none;
     112    background: rgba(0,0,0,0.5);
     113    width: 50px;
     114    height: 50px;
     115    display: flex;
     116    align-items: center;
     117    justify-content: center;
     118    border-radius: 50%;
     119    z-index: 100001;
     120    transition: background 0.2s;
    103121}
     122
     123.rusnetim-lightbox-prev:hover,
     124.rusnetim-lightbox-next:hover {
     125    background: rgba(0,0,0,0.8);
     126}
     127
    104128.rusnetim-lightbox-prev {
    105     left: -50px;
     129    left: 20px;
    106130}
     131
    107132.rusnetim-lightbox-next {
    108     right: -50px;
     133    right: 20px;
    109134}
    110135
  • rusnet-interactive-map/trunk/assets/js/frontend/map-init.js

    r3485624 r3487643  
    5656                    options: {
    5757                        selectOnClick: false,
    58                         maxWidth: 30
     58                        maxWidth: 300
    5959                    }
    6060                });
     
    117117                    var infoPanel = document.getElementById( this.data.info_panel_id );
    118118                    if ( ! infoPanel ) return;
     119
     120                    // APPLY CUSTOM PADDING AND BORDER RADIUS
     121                    var padding = placeData.infoPadding || this.data.info_panel_padding || '10px';
     122                    infoPanel.style.setProperty('padding', padding, 'important');
     123                    var borderRadius = placeData.infoBorderRadius || this.data.info_panel_border_radius || '5px';
     124                    infoPanel.style.setProperty('border-radius', borderRadius, 'important');
    119125           
    120126                    var titlepos = this.data.titleposition || 'below';
     
    203209                    var thumbs = infoPanel.querySelectorAll('.gallery-thumb');
    204210                    if ( mainImage && thumbs.length ) {
     211                        // Удаляем старые обработчики, чтобы избежать дублирования
    205212                        thumbs.forEach(function(thumb) {
    206                             thumb.addEventListener('click', function() {
     213                            if (thumb._clickHandler) {
     214                                thumb.removeEventListener('click', thumb._clickHandler);
     215                            }
     216                        });
     217
     218                        thumbs.forEach(function(thumb) {
     219                            var handler = function() {
    207220                                var index = this.dataset.index;
    208221                                mainImage.src = placeData.gallery[index];
     
    213226                                });
    214227                                this.classList.add('active-thumb');
    215                             });
     228                            };
     229                            thumb._clickHandler = handler;
     230                            thumb.addEventListener('click', handler);
    216231                        });
    217232                    }
    218233                } catch ( e ) {
    219234                    console.error( 'Rusnetim: ошибка в showInfoPanel', e );
    220                 }
    221 
    222                 var mainImageLink = infoPanel.querySelector('.rusnetim-main-image-link');
    223                 if (mainImageLink) {
    224                     mainImageLink.addEventListener('click', function(e) {
    225                         if (e.ctrlKey || e.metaKey) {
    226                             return;
    227                         }
    228                         e.preventDefault();
    229            
    230                         var images = [];
    231                         if (placeData.gallery && placeData.gallery.length) {
    232                             images = placeData.gallery;
    233                         } else if (placeData.image) {
    234                             images = [placeData.image];
    235                         }
    236                         if (images.length === 0) return;
    237            
    238                         var index = 0;
    239                         var activeThumb = infoPanel.querySelector('.gallery-thumb.active-thumb');
    240                         if (activeThumb) {
    241                             var idx = parseInt(activeThumb.dataset.index, 10);
    242                             if (!isNaN(idx)) index = idx;
    243                         }
    244            
    245                         function openLightbox(imgArray, startIdx) {
    246                             var existing = document.querySelector('.rusnetim-lightbox');
    247                             if (existing) existing.remove();
    248            
    249                             var overlay = document.createElement('div');
    250                             overlay.className = 'rusnetim-lightbox';
    251            
    252                             var container = document.createElement('div');
    253                             container.className = 'rusnetim-lightbox-container';
    254            
    255                             var img = document.createElement('img');
    256                             img.src = imgArray[startIdx];
    257            
    258                             var closeBtn = document.createElement('span');
    259                             closeBtn.className = 'rusnetim-lightbox-close';
    260                             closeBtn.innerHTML = '×';
    261            
    262                             var prevBtn = document.createElement('span');
    263                             prevBtn.className = 'rusnetim-lightbox-prev';
    264                             prevBtn.innerHTML = '❮';
    265                             var nextBtn = document.createElement('span');
    266                             nextBtn.className = 'rusnetim-lightbox-next';
    267                             nextBtn.innerHTML = '❯';
    268            
    269                             container.appendChild(img);
    270                             container.appendChild(closeBtn);
    271                             container.appendChild(prevBtn);
    272                             container.appendChild(nextBtn);
    273                             overlay.appendChild(container);
    274                             document.body.appendChild(overlay);
    275            
    276                             var currentIdx = startIdx;
    277            
    278                             function updateImage(newIdx) {
    279                                 if (newIdx < 0) newIdx = imgArray.length - 1;
    280                                 if (newIdx >= imgArray.length) newIdx = 0;
    281                                 img.src = imgArray[newIdx];
    282                                 currentIdx = newIdx;
    283                             }
    284            
    285                             prevBtn.addEventListener('click', function(ev) {
    286                                 ev.stopPropagation();
    287                                 updateImage(currentIdx - 1);
    288                             });
    289            
    290                             nextBtn.addEventListener('click', function(ev) {
    291                                 ev.stopPropagation();
    292                                 updateImage(currentIdx + 1);
    293                             });
    294            
    295                             closeBtn.addEventListener('click', function(ev) {
    296                                 ev.stopPropagation();
    297                                 overlay.remove();
    298                             });
    299            
    300                             overlay.addEventListener('click', function() {
    301                                 overlay.remove();
    302                             });
    303            
    304                             container.addEventListener('click', function(ev) {
    305                                 ev.stopPropagation();
    306                             });
    307            
    308                             var keyHandler = function(ev) {
    309                                 if (ev.key === 'Escape') {
    310                                     overlay.remove();
    311                                     document.removeEventListener('keydown', keyHandler);
    312                                 } else if (ev.key === 'ArrowLeft') {
    313                                     updateImage(currentIdx - 1);
    314                                 } else if (ev.key === 'ArrowRight') {
    315                                     updateImage(currentIdx + 1);
    316                                 }
    317                             };
    318                             document.addEventListener('keydown', keyHandler);
    319            
    320                             var observer = new MutationObserver(function(mutations) {
    321                                 mutations.forEach(function(mutation) {
    322                                     if (mutation.removedNodes.length) {
    323                                         for (var i = 0; i < mutation.removedNodes.length; i++) {
    324                                             if (mutation.removedNodes[i] === overlay) {
    325                                                 document.removeEventListener('keydown', keyHandler);
    326                                                 observer.disconnect();
    327                                                 break;
    328                                             }
    329                                         }
    330                                     }
    331                                 });
    332                             });
    333                             observer.observe(document.body, { childList: true });
    334                         }
    335            
    336                         openLightbox(images, index);
    337                     });
    338235                }
    339236            };
     
    437334                            image: markerData.image,
    438335                            description: markerData.description,
    439                             gallery: markerData.gallery || []
     336                            gallery: markerData.gallery || [],
     337                            infoPadding: markerData.infoPadding,      // добавлено
     338                            infoBorderRadius: markerData.infoBorderRadius // добавлено
    440339                        };
    441340                    }
  • rusnet-interactive-map/trunk/classes/class-admin.php

    r3485624 r3487643  
    216216                'type'  => 'color',
    217217                'desc'  => esc_html__( 'Select background color for the info panel.', 'rusnet-interactive-map' ),
     218            ],
     219            'info_panel_padding' => [
     220                'title' => esc_html__( 'Panel padding', 'rusnet-interactive-map' ),
     221                'type'  => 'text',
     222                'desc'  => esc_html__( 'CSS padding value, e.g. "10px" or "10px 15px".', 'rusnet-interactive-map' ),
     223            ],
     224            'info_panel_border_radius' => [
     225                'title' => esc_html__( 'Panel border radius', 'rusnet-interactive-map' ),
     226                'type'  => 'text',
     227                'desc'  => esc_html__( 'CSS border-radius, e.g. "5px".', 'rusnet-interactive-map' ),
    218228            ],
    219229        ];
  • rusnet-interactive-map/trunk/classes/class-options.php

    r3484431 r3487643  
    3636            'info_title_color'           => '',
    3737            'info_panel_bg_color'        => '#ffffff',
     38            // ADDED: new padding and border radius defaults
     39            'info_panel_padding'          => '10px',
     40            'info_panel_border_radius'    => '5px',
    3841            'cat_filter_container_justify'    => 'flex-start',
    3942            'cat_filter_button_tag'            => 'button',
     
    168171        }
    169172
     173        // ADDED: sanitize padding and border radius
     174        if ( isset( $input['info_panel_padding'] ) ) {
     175            $padding = sanitize_text_field( $input['info_panel_padding'] );
     176            if ( preg_match( '/^[0-9a-zA-Z%.\s]+$/', $padding ) ) {
     177                $sanitized['info_panel_padding'] = $padding;
     178            } else {
     179                $sanitized['info_panel_padding'] = '10px';
     180            }
     181        }
     182
     183        if ( isset( $input['info_panel_border_radius'] ) ) {
     184            $radius = sanitize_text_field( $input['info_panel_border_radius'] );
     185            if ( preg_match( '/^[0-9a-zA-Z%.\s]+$/', $radius ) ) {
     186                $sanitized['info_panel_border_radius'] = $radius;
     187            } else {
     188                $sanitized['info_panel_border_radius'] = '5px';
     189            }
     190        }
     191
    170192        if ( isset( $input['cat_filter_container_justify'] ) ) {
    171193            $valid = [ 'flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly' ];
  • rusnet-interactive-map/trunk/classes/class-shortcodes.php

    r3485624 r3487643  
    3939                'infowidth'     => $defaults['info_panel_width'],
    4040                'infoside'      => $defaults['info_panel_side'],
     41                'infopadding'   => $defaults['info_panel_padding'],
     42                'inforadius'    => $defaults['info_panel_border_radius'],
    4143                'titleposition' => $defaults['info_panel_title_position'],
    4244                'title_tag'     => $defaults['info_title_tag'],
     
    203205            'infowidth'       => $infowidth,
    204206        ];
     207       
     208        $map_data['info_panel_padding'] = $atts['infopadding'];
     209        $map_data['info_panel_border_radius'] = $atts['inforadius'];
    205210
    206211        $api_key = $defaults['apikey_map_option'];
     
    369374            }
    370375        }
    371 
     376       
    372377        $terms = wp_get_post_terms( $post_id, 'rusnetim_category', [ 'fields' => 'slugs' ] );
    373378        $category = ! empty( $terms ) ? $terms[0] : '';
     379        $info_padding = get_post_meta( $post_id, '_marker_info_padding', true );
     380        $info_border_radius = get_post_meta( $post_id, '_marker_info_border_radius', true );
    374381
    375382        return [
     
    385392            'icon_height' => $icon_height,
    386393            'gallery'     => $gallery_urls,
     394            'infoPadding' => $info_padding,
     395            'infoBorderRadius' => $info_border_radius,
    387396        ];
    388397    }
     
    445454            $post_data['coord'] = $defaults['center_map_option'];
    446455        }
    447 
     456        $post_data['id'] = $post_id;
    448457        return $this->normalize_marker_data( $post_data );
    449458    }
     
    451460    private function normalize_marker_data( $atts ) {
    452461        $defaults = Rusnetim_Options::get_all();
    453 
     462   
    454463        if ( ! empty( $atts['category'] ) ) {
    455464            $term = get_term_by( 'slug', $atts['category'], 'rusnetim_category' );
     
    473482            }
    474483        }
    475 
     484   
    476485        if ( empty( $atts['icon'] ) ) {
    477486            if ( ! empty( $defaults['custom_icon_option'] ) ) {
     
    486495            $atts['color'] = $defaults['color_icon_option'];
    487496        }
    488 
     497   
    489498        $icon = $atts['icon'];
    490499        $icon_url = '';
    491500        $icon_preset = '';
    492501        $icon_size = [];
    493 
     502   
    494503        if ( strpos( $icon, 'myset:' ) === 0 ) {
    495504            $slug = substr( $icon, 6 );
     
    524533            $icon_preset = $icon;
    525534        }
    526 
     535   
    527536        if ( $icon_url && $atts['icon_width'] && $atts['icon_height'] ) {
    528537            $icon_size = [ (int) $atts['icon_width'], (int) $atts['icon_height'] ];
    529538        }
    530 
     539   
    531540        $hint = '';
    532541        $content = '';
     
    541550            }
    542551        }
    543 
     552   
    544553        $link = $atts['url'];
    545554        if ( is_numeric( $link ) ) {
    546555            $link = get_permalink( intval( $link ) );
    547556        }
    548 
     557   
     558        $description = isset( $atts['description'] ) ? $atts['description'] : '';
     559        $description = wp_kses_post( wpautop( do_shortcode( $description ) ) );
     560       
     561   
    549562        return [
    550563            'coord'       => Rusnetim_Options::sanitize_coords( $atts['coord'] ),
     
    559572            'category'    => sanitize_text_field( $atts['category'] ),
    560573            'image'       => esc_url_raw( $atts['image'] ),
    561             'description' => wp_kses_post( $atts['description'] ),
     574            'description' => $description,
    562575            'gallery'     => array_map( 'esc_url_raw', $atts['gallery'] ),
     576            'infoPadding'      => isset( $atts['infoPadding'] ) ? sanitize_text_field( $atts['infoPadding'] ) : ( isset( $atts['info_padding'] ) ? sanitize_text_field( $atts['info_padding'] ) : '' ),
     577            'infoBorderRadius' => isset( $atts['infoBorderRadius'] ) ? sanitize_text_field( $atts['infoBorderRadius'] ) : ( isset( $atts['info_border_radius'] ) ? sanitize_text_field( $atts['info_border_radius'] ) : '' ),
    563578        ];
     579        $marker_data = apply_filters( 'rusnetim_marker_data', $marker_data, $atts );
     580
     581        return $marker_data;
    564582    }
    565583
  • rusnet-interactive-map/trunk/readme.txt

    r3485624 r3487643  
    55Requires at least: 5.0
    66Tested up to: 6.9
    7 Stable tag: 2.1.3
     7Stable tag: 2.1.4
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6767== Changelog ==
    6868
     69= 2.1.4 =
     70* Fixed: Lightbox image display – images no longer get cropped and are now scaled correctly while preserving aspect ratio.
     71* Improved: Synchronization of the active thumbnail in the gallery – when switching images with the arrow keys in the lightbox, the corresponding thumbnail is now highlighted.
     72* Fixed: Possible duplication of click handlers on gallery thumbnails, which could lead to incorrect behavior.
     73* Fixed: Marker description formatting – paragraphs, line breaks, and shortcodes are now displayed correctly in the info panel.
     74* Added: Global padding settings for the info panel – you can now set top, right, bottom, and left padding independently.
     75* Added: Global border radius settings for the info panel – each corner (top‑left, top‑right, bottom‑right, bottom‑left) can be configured individually.
     76* Improved: Info panel styling – more flexible control over appearance without the need to write CSS.
     77* Fixed: Minor compatibility issues with the latest version of WordPress.
     78* Fixed: Compatibility with third‑party plugins.
     79* Improved: Info panel styling – more flexible control over appearance without custom CSS.
     80
    6981= 2.1.3 =
    7082* Improved info panel layout: the panel now opens beside the map (using flexbox) instead of overlapping it. The map maintains a reasonable minimum width and does not shrink too much.
  • rusnet-interactive-map/trunk/rusnet-interactive-map.php

    r3485624 r3487643  
    66 * Author URI:  https://rusnet.su
    77 * Author:      ANO "Rusnet"
    8  * Version:     2.1.3
     8 * Version:     2.1.4
    99 * License:     GPLv2 or later
    1010 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1717}
    1818
    19 define( 'RUSNETIM_VERSION', '2.1.3' );
     19define( 'RUSNETIM_VERSION', '2.1.4' );
    2020define( 'RUSNETIM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
    2121define( 'RUSNETIM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.