Changeset 3487643
- Timestamp:
- 03/21/2026 07:40:36 AM (8 days ago)
- Location:
- rusnet-interactive-map/trunk
- Files:
-
- 7 edited
-
assets/css/front.css (modified) (3 diffs)
-
assets/js/frontend/map-init.js (modified) (5 diffs)
-
classes/class-admin.php (modified) (1 diff)
-
classes/class-options.php (modified) (2 diffs)
-
classes/class-shortcodes.php (modified) (11 diffs)
-
readme.txt (modified) (2 diffs)
-
rusnet-interactive-map.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
rusnet-interactive-map/trunk/assets/css/front.css
r3485624 r3487643 71 71 justify-content: center; 72 72 } 73 73 74 .rusnetim-lightbox .rusnetim-lightbox-container { 74 75 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; 77 81 } 82 78 83 .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; 81 88 display: block; 82 margin: 0 auto;89 object-fit: contain !important; 83 90 border-radius: 4px; 84 91 } 92 85 93 .rusnetim-lightbox-close { 86 94 position: absolute; … … 92 100 line-height: 1; 93 101 } 102 94 103 .rusnetim-lightbox-prev, 95 104 .rusnetim-lightbox-next { … … 98 107 transform: translateY(-50%); 99 108 color: white; 100 font-size: 50px;109 font-size: 40px; 101 110 cursor: pointer; 102 111 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; 103 121 } 122 123 .rusnetim-lightbox-prev:hover, 124 .rusnetim-lightbox-next:hover { 125 background: rgba(0,0,0,0.8); 126 } 127 104 128 .rusnetim-lightbox-prev { 105 left: -50px;129 left: 20px; 106 130 } 131 107 132 .rusnetim-lightbox-next { 108 right: -50px;133 right: 20px; 109 134 } 110 135 -
rusnet-interactive-map/trunk/assets/js/frontend/map-init.js
r3485624 r3487643 56 56 options: { 57 57 selectOnClick: false, 58 maxWidth: 30 58 maxWidth: 300 59 59 } 60 60 }); … … 117 117 var infoPanel = document.getElementById( this.data.info_panel_id ); 118 118 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'); 119 125 120 126 var titlepos = this.data.titleposition || 'below'; … … 203 209 var thumbs = infoPanel.querySelectorAll('.gallery-thumb'); 204 210 if ( mainImage && thumbs.length ) { 211 // Удаляем старые обработчики, чтобы избежать дублирования 205 212 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() { 207 220 var index = this.dataset.index; 208 221 mainImage.src = placeData.gallery[index]; … … 213 226 }); 214 227 this.classList.add('active-thumb'); 215 }); 228 }; 229 thumb._clickHandler = handler; 230 thumb.addEventListener('click', handler); 216 231 }); 217 232 } 218 233 } catch ( e ) { 219 234 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 });338 235 } 339 236 }; … … 437 334 image: markerData.image, 438 335 description: markerData.description, 439 gallery: markerData.gallery || [] 336 gallery: markerData.gallery || [], 337 infoPadding: markerData.infoPadding, // добавлено 338 infoBorderRadius: markerData.infoBorderRadius // добавлено 440 339 }; 441 340 } -
rusnet-interactive-map/trunk/classes/class-admin.php
r3485624 r3487643 216 216 'type' => 'color', 217 217 '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' ), 218 228 ], 219 229 ]; -
rusnet-interactive-map/trunk/classes/class-options.php
r3484431 r3487643 36 36 'info_title_color' => '', 37 37 'info_panel_bg_color' => '#ffffff', 38 // ADDED: new padding and border radius defaults 39 'info_panel_padding' => '10px', 40 'info_panel_border_radius' => '5px', 38 41 'cat_filter_container_justify' => 'flex-start', 39 42 'cat_filter_button_tag' => 'button', … … 168 171 } 169 172 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 170 192 if ( isset( $input['cat_filter_container_justify'] ) ) { 171 193 $valid = [ 'flex-start', 'center', 'flex-end', 'space-between', 'space-around', 'space-evenly' ]; -
rusnet-interactive-map/trunk/classes/class-shortcodes.php
r3485624 r3487643 39 39 'infowidth' => $defaults['info_panel_width'], 40 40 'infoside' => $defaults['info_panel_side'], 41 'infopadding' => $defaults['info_panel_padding'], 42 'inforadius' => $defaults['info_panel_border_radius'], 41 43 'titleposition' => $defaults['info_panel_title_position'], 42 44 'title_tag' => $defaults['info_title_tag'], … … 203 205 'infowidth' => $infowidth, 204 206 ]; 207 208 $map_data['info_panel_padding'] = $atts['infopadding']; 209 $map_data['info_panel_border_radius'] = $atts['inforadius']; 205 210 206 211 $api_key = $defaults['apikey_map_option']; … … 369 374 } 370 375 } 371 376 372 377 $terms = wp_get_post_terms( $post_id, 'rusnetim_category', [ 'fields' => 'slugs' ] ); 373 378 $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 ); 374 381 375 382 return [ … … 385 392 'icon_height' => $icon_height, 386 393 'gallery' => $gallery_urls, 394 'infoPadding' => $info_padding, 395 'infoBorderRadius' => $info_border_radius, 387 396 ]; 388 397 } … … 445 454 $post_data['coord'] = $defaults['center_map_option']; 446 455 } 447 456 $post_data['id'] = $post_id; 448 457 return $this->normalize_marker_data( $post_data ); 449 458 } … … 451 460 private function normalize_marker_data( $atts ) { 452 461 $defaults = Rusnetim_Options::get_all(); 453 462 454 463 if ( ! empty( $atts['category'] ) ) { 455 464 $term = get_term_by( 'slug', $atts['category'], 'rusnetim_category' ); … … 473 482 } 474 483 } 475 484 476 485 if ( empty( $atts['icon'] ) ) { 477 486 if ( ! empty( $defaults['custom_icon_option'] ) ) { … … 486 495 $atts['color'] = $defaults['color_icon_option']; 487 496 } 488 497 489 498 $icon = $atts['icon']; 490 499 $icon_url = ''; 491 500 $icon_preset = ''; 492 501 $icon_size = []; 493 502 494 503 if ( strpos( $icon, 'myset:' ) === 0 ) { 495 504 $slug = substr( $icon, 6 ); … … 524 533 $icon_preset = $icon; 525 534 } 526 535 527 536 if ( $icon_url && $atts['icon_width'] && $atts['icon_height'] ) { 528 537 $icon_size = [ (int) $atts['icon_width'], (int) $atts['icon_height'] ]; 529 538 } 530 539 531 540 $hint = ''; 532 541 $content = ''; … … 541 550 } 542 551 } 543 552 544 553 $link = $atts['url']; 545 554 if ( is_numeric( $link ) ) { 546 555 $link = get_permalink( intval( $link ) ); 547 556 } 548 557 558 $description = isset( $atts['description'] ) ? $atts['description'] : ''; 559 $description = wp_kses_post( wpautop( do_shortcode( $description ) ) ); 560 561 549 562 return [ 550 563 'coord' => Rusnetim_Options::sanitize_coords( $atts['coord'] ), … … 559 572 'category' => sanitize_text_field( $atts['category'] ), 560 573 'image' => esc_url_raw( $atts['image'] ), 561 'description' => wp_kses_post( $atts['description'] ),574 'description' => $description, 562 575 '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'] ) : '' ), 563 578 ]; 579 $marker_data = apply_filters( 'rusnetim_marker_data', $marker_data, $atts ); 580 581 return $marker_data; 564 582 } 565 583 -
rusnet-interactive-map/trunk/readme.txt
r3485624 r3487643 5 5 Requires at least: 5.0 6 6 Tested up to: 6.9 7 Stable tag: 2.1. 37 Stable tag: 2.1.4 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 67 67 == Changelog == 68 68 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 69 81 = 2.1.3 = 70 82 * 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 6 6 * Author URI: https://rusnet.su 7 7 * Author: ANO "Rusnet" 8 * Version: 2.1. 38 * Version: 2.1.4 9 9 * License: GPLv2 or later 10 10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 17 17 } 18 18 19 define( 'RUSNETIM_VERSION', '2.1. 3' );19 define( 'RUSNETIM_VERSION', '2.1.4' ); 20 20 define( 'RUSNETIM_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 21 21 define( 'RUSNETIM_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.