Ugrás a tartalomhoz

„MediaWiki:Common.js” változatai közötti eltérés

Innen: MKOE wiki
Nincs szerkesztési összefoglaló
Címke: Visszaállítva
Nincs szerkesztési összefoglaló
 
(30 közbenső módosítás ugyanattól a felhasználótól nincs mutatva)
1. sor: 1. sor:
@charset "UTF-8";
/**
/*
* VECTOR 2022 TELEPORT BUGFIX - DRGYZ
cd /home/drgyz/Dokumentumok/wiki.kaktuszgyujtok.hu/wiki_lua_html_css_js
* Létrehozza a hiányzó teleportációs célpontokat, mielőtt a skin JS elhasalna
sass --watch --style=expanded gyz.scss:gyz.css
*/
*/
(function() {
/* Legújabb DataTables CSS betöltése */
    function injectVectorTargets() {
@import url("https://cdn.datatables.net/2.1.8/css/dataTables.dataTables.min.css");
        var targets = ['p-lang-btn', 'vector-user-links-dropdown', 'vector-toc-landmark'];
/* MediaWiki specifikus finomhangolás */
 
table.datatable-hook {
        targets.forEach(function(id) {
  width: 100% !important;
            if (!document.getElementById(id)) {
  margin: 1em 0 !important;
                var dummy = document.createElement('div');
  border: 1px solid #a2a9b1 !important;
                dummy.id = id;
  font-size: 0.9em;
                dummy.className = 'vector-teleport-dummy-target';
                dummy.style.display = 'none';
                document.body.appendChild(dummy);
            }
        });
    }
 
    injectVectorTargets();
 
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', injectVectorTargets);
    }
})();
 
/**
* ============================================================================
* LIGHTGALLERY GLOBÁLIS INTEGRÁCIÓ (Egyedi sablon galériák előkészítése)
* ============================================================================
*/
(function() {
    $(function() {
        if ($('.wiki-dynamic-gallery').length > 0) {
            initWikiDynamicGallery();
        }
        if ($('.egyedi-galeria-container').length > 0) {
            prePrepareEgyediGaleriak();
        }
    });
 
    // --- RÉGI WIKI DYNAMIC GALLERY LOGIKA ---
    function initWikiDynamicGallery() {
        $('.wiki-dynamic-gallery').each(function() {
            var $container = $(this);
            if ($container.data('initialized')) return;
            $container.data('initialized', true);
 
            var searchTerm = $container.data('search');
            var limit = $container.data('limit') || 3;
            var targetHeight = 200;
 
            var apiUrl = "https://commons.wikimedia.org/w/api.php?action=query&format=json&generator=search&gsrsearch=File:" +
                        encodeURIComponent(searchTerm) + "&gsrlimit=" + limit +
                        "&prop=imageinfo&iiprop=url|size&iiurlheight=" + targetHeight + "&origin=*";
 
            $.getJSON(apiUrl, function(data) {
                if (data && data.query && data.query.pages) {
                    var pages = data.query.pages;
                    var galleryHtml = '';
 
                    for (var id in pages) {
                        if (!pages[id].imageinfo) continue;
                        var img = pages[id].imageinfo[0];
 
                        // Szebbé tesszük a címet a felugró ablakhoz
                        var title = pages[id].title.replace('File:', '').replace(/\.[^/.]+$/, "");
 
                        // LightGallery felugró ablak felirata és az ERDETI NAGY KÉP LINKJE (img.url)
                        var captionHtml = '<div class="lg-egyedi-felirat"><h4>' + title + '</h4>' +
                                          '<br/><span class="galeria-forras-jelzo" style="font-size:0.85em; color:#bbb; display:block; margin-top:4px;">' +
                                          'Forrás: <a href="' + img.url + '" target="_blank" rel="noopener noreferrer" style="color:#66b2ff; text-decoration:underline;">Wikimedia Commons</a> ↗' +
                                          '</span></div>';
 
                        // ÖSSZEÁLLÍTJUK A JAVÍTOTT KÁRTYA STRUKTÚRÁT
                        galleryHtml += '<div class="galeria-elem">';
                        galleryHtml += '  <div class="kulso-url-doboz" data-src="' + img.url + '" data-elokeszitve="true">';
                        galleryHtml += '    <figure class="mw-default-size col-url-figure" style="position: relative !important; overflow: visible !important;">';
 
                        // HIBÁTLAN LIGHTGALLERY INTEGRÁCIÓ: a href és data-src attribútumba is a NAGY KÉP (img.url) megy!
                        galleryHtml += '      <a href="' + img.url + '" class="lg-egyedi-kulso-item lg-dinamikus-item" data-src="' + img.url + '" data-sub-html="' + captionHtml.replace(/"/g, '&quot;') + '" style="display: block !important; position: relative !important;">';
                        galleryHtml += '        <img src="' + img.thumburl + '" class="galeria-kep url-kep" alt="' + title + '" />';
 
                        // A FÖLDGÖMB IKONT KÖZVETLENÜL A KÉPRE (A LINKEN BELÜLRE) POZICIONÁLJUK A BAL FELSŐ SAROKBA
                        galleryHtml += '        <div class="kulso-link-ikon" style="position: absolute !important; top: 6px !important; left: 6px !important; z-index: 10 !important; font-size: 14px !important; background: rgba(255, 255, 255, 0.85) !important; padding: 2px 4px !important; border-radius: 4px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important; line-height: 1 !important; display: block !important;">🌐</div>';
                        galleryHtml += '      </a>';
 
                        // FIGCAPTION: Kizárólag a galéria feliratot tartalmazza, a forrás szöveg (Wikimedia Commons) KI LETT TÖRÖLVE!
                        galleryHtml += '      <figcaption>';
                        galleryHtml += '        <span class="galeria-felirat">' + title + '</span>';
                        galleryHtml += '      </figcaption>';
                        galleryHtml += '    </figure>';
                        galleryHtml += '  </div>';
                        galleryHtml += '</div>';
                    }
                    // Behelyezzük a kártyákat a konténerbe és megadjuk neki a globális galéria osztályt
                    $container.addClass('egyedi-galeria-container').html(galleryHtml);
                }
            });
        });
    }
 
    // --- EGYEDI GALÉRIÁK ELŐKÉSZÍTÉSE (Csak a feliratokat és a DOM-ot hozzuk helyre, de nem inicializálunk LG-t) ---
    function prePrepareEgyediGaleriak() {
        $('.egyedi-galeria-container').each(function() {
            var $container = $(this);
 
            // 1. Külső URL és Commons dobozok formázása (MediaWiki kompatibilis <figure> struktúra)
            $container.find('.kulso-url-doboz').each(function() {
                var $doboz = $(this);
                if ($doboz.data('elokeszitve')) return;
                $doboz.data('elokeszitve', true);
 
                var eredetiUrl = $doboz.attr('data-src');
                var biztonsagosUrl = eredetiUrl;
 
                // HTTPS képproxy (weserv.nl) a vegyes tartalom és a hotlink tiltás ellen
                if (eredetiUrl && eredetiUrl.indexOf('http://') === 0) {
                    var tisztaUrl = eredetiUrl.replace('http://', '');
                    biztonsagosUrl = 'https://images.weserv.nl/?url=' + encodeURIComponent(tisztaUrl);
                }
 
                var forrasNev = $doboz.attr('data-forras-nev') || 'Külső forrás';
                var $feliratElem = $doboz.find('.galeria-felirat');
                var felirat = $feliratElem.text().trim();
 
                if (!felirat) {
                    var fileTitle = eredetiUrl.substring(eredetiUrl.lastIndexOf('/') + 1).split('.')[0];
                    felirat = decodeURIComponent(fileTitle).replace(/_/g, ' ');
                }
 
                // LightGallery felugró ablak felirata
                var forrasLinkHtml = '<br/><span class="galeria-forras-jelzo" style="font-size:0.85em; color:#bbb; display:block; margin-top:4px;">' +
                                    'Forrás: <a href="' + eredetiUrl + '" target="_blank" rel="noopener noreferrer" style="color:#66b2ff; text-decoration:underline;">' + forrasNev + '</a> ↗' +
                                    '</span>';
                var captionHtml = '<div class="lg-egyedi-felirat"><h4>' + felirat + '</h4>' + forrasLinkHtml + '</div>';
 
                // ÖSSZEÁLLÍTJUK A JAVÍTOTT, EGYSÉGES SZABVÁNYOS MEDIAWIKI STRUKTÚRÁT:
                var $figure = $('<figure>', {
                    'class': 'mw-default-size col-url-figure',
                    'style': 'position: relative !important; overflow: visible !important;'
                });
 
                var $lgItem = $('<a>', {
                    'href': biztonsagosUrl,
                    'class': 'lg-egyedi-kulso-item',
                    'data-src': biztonsagosUrl,
                    'data-sub-html': captionHtml,
                    'style': 'display: block !important; position: relative !important;'
                });
 
                // A beágyazott előkép
                $('<img>', {
                    'src': biztonsagosUrl,
                    'class': 'galeria-kep url-kep',
                    'alt': felirat
                }).appendTo($lgItem);
 
                // JAVÍTÁS: A FÖLDGÖMB IKON BEKERÜL A LINKEN BELÜLRE, ABSZOLÚT POZÍCIÓVAL A BAL FELSŐ SAROKBA
                $('<div>', {
                    'class': 'kulso-link-ikon',
                    'style': 'position: absolute !important; top: 6px !important; left: 6px !important; z-index: 10 !important; font-size: 14px !important; background: rgba(255, 255, 255, 0.85) !important; padding: 2px 4px !important; border-radius: 4px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important; line-height: 1 !important; display: block !important;',
                    'text': '🌐'
                }).appendTo($lgItem);
 
                // JAVÍTÁS: Szabványos figcaption, amiből a zárójeles forrásszöveg teljesen ki lett hagyva
                var $figcaption = $('<figcaption>').html(
                    '<span class="galeria-felirat">' + felirat + '</span>'
                );
 
                // Egymás mögé fűzzük őket a dobozon belül
                $lgItem.appendTo($figure);
                $figcaption.appendTo($figure);
 
                $doboz.empty().append($figure);
            });
 
            // 2. Belső képek noviewer osztállyal való ellátása
            $container.find('figure a.mw-file-description').addClass('noviewer');
        });
    }
})();
 
/**
* ============================================================================
* KIEGÉSZÍTŐIKONOK ÉS STÍLUSLAPOK BETÖLTÉSE
* ============================================================================
*/
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css";
document.head.appendChild(link);
 
/**
* ============================================================================
* JOGOSULTSÁGKEZELÉS (Fülek elrejtése anonim felhasználóknak)
* ============================================================================
*/
if (mw.config.get('wgUserName') === null) {
    var hideTabs = function () {
        var el1 = document.querySelector('#ca-history');
        var el2 = document.querySelector('#ca-viewsource');
        if (el1) el1.style.display = 'none';
        if (el2) el2.style.display = 'none';
 
        if (el1 || el2) clearInterval(observer);
    };
    var observer = setInterval(hideTabs, 100);
}
}


/* A MediaWiki saját rendező nyilainak elrejtése, ha ütközne */
/**
table.datatable-hook th.headerSort {
* ============================================================================
  background-image: none !important;
* KÜLSŐ LINK VISLEKEDÉS (Új lapon nyíló külső hivatkozások)
}
* ============================================================================
*/
$(function () {
    $('a.external').attr('target', '_blank');
});
 
/**
* ============================================================================
* NAVIGÁCIÓS GOMBOK (Tetejére és Vissza gomb logikája)
* ============================================================================
*/
$(function() {
    var $btn = $('<button/>', {
        html: '<i class="bi bi-arrow-up-square"></i> Tetejére',
        id: 'backToTopBtn',
        title: 'Az oldal tetejére',
        css: {
            position: 'fixed',
            bottom: '20px',
            right: '20px',
            padding: '10px 15px',
            'font-size': '14px',
            'background-color': '#888446ff',
            color: 'white',
            border: 'none',
            'border-radius': '10px',
            cursor: 'pointer',
            display: 'none',
            width: '100px',
            'z-index': 1000
        },
        click: function() {
            window.scrollTo({top: 0, behavior: 'smooth'});
        }
    });
 
    var $backBtn = $('<button/>', {
        html: '<i class="bi bi-arrow-left-square"></i> Vissza',
        id: 'backBtn',
        title: 'Előző oldal',
        css: {
            position: 'fixed',
            bottom: '60px',
            right: '20px',
            padding: '10px 15px',
            'font-size': '14px',
            'background-color': '#547454ff',
            color: 'white',
            border: 'none',
            'border-radius': '10px',
            cursor: 'pointer',
            display: 'none',
            width: '100px',
            'z-index': 1000
        },
        click: function() {
            window.history.back();
        }
    });
 
    $('body').append($btn).append($backBtn);
 
    $(window).scroll(function() {
        if ($(window).scrollTop() > 100) {
            $btn.fadeIn();
            $backBtn.fadeIn();
        } else {
            $btn.fadeOut();
            $backBtn.fadeOut();
        }
    });
});
 
/**
* ============================================================================
* TAXOBOX ÉS RENDSZERTANI LINKEK KEZELÉSE
* ============================================================================
*/
$(document).ready(function() {
    $('.taxobox-icons a').attr('target', '_blank');
});
 
/**
* ============================================================================
* DATATABLES INTEGRÁCIÓ (Javított táblázatkezelés)
* ============================================================================
*/
mw.loader.using( ['jquery', 'mediawiki.util'] ).done( function () {
    if ( $( '.datatable-hook' ).length > 0 ) {
        $.getScript( 'https://cdn.datatables.net/2.1.8/js/dataTables.min.js' )
            .done( function() {
                $( '.datatable-hook' ).each( function() {
                    var $table = $(this);
                    var $headerRow = $table.find( 'tr:has(th)' ).first();
 
                    if ( $headerRow.length > 0 ) {
                        var $thead = $( '<thead></thead>' );
                        $headerRow.detach().appendTo( $thead );
                        $table.prepend( $thead );
                    }
 
                    $table.DataTable({
                        language: {
                            url: '//cdn.datatables.net/plug-ins/2.1.8/i18n/hu.json'
                        },
                        layout: {
                            topStart: 'pageLength',
                            topEnd: 'search',
                            bottomStart: 'info',
                            bottomEnd: 'paging'
                        },
                        pageLength: 10,
                        columnDefs: [ { targets: '_all', defaultContent: '' } ]
                    });
                });
            })
            .fail( function() {
                console.error( 'Hiba: Nem sikerült betölteni a DataTables szkriptet.' );
            });
    }
});
 
/**
* ============================================================================
* SZUKKULENS NÖVÉNYHATÁROZÓ KULCSOK LOGIKÁJA
* ============================================================================
*/
mw.hook('wikipage.content').add(function () {
    const aktualisKategoriak = mw.config.get('wgCategories') || [];
    if (!aktualisKategoriak.includes('Szukkulens növényhatározó kulcsok')) {
        return;
    }
 
    const regexKoztespont = /^Szukkulens határozó:/;
    const bodyContent = document.getElementById('bodyContent');
    if (!bodyContent) return;
 
    bodyContent.querySelectorAll('a').forEach(a => {
        const teljesNev = a.getAttribute('title') || '';
 
        if (regexKoztespont.test(teljesNev)) {
            let tisztaGombSzöveg = teljesNev.replace(/\s*\(a lap nem létezik\)$/, '');
            a.innerHTML = '';
 
            const arrowSpan = document.createElement('span');
            arrowSpan.className = 'arrow-prefix';
            arrowSpan.textContent = '→';
 
            const spaceNode = document.createTextNode(' ');
            const textNode = document.createTextNode(tisztaGombSzöveg);
 
            a.appendChild(arrowSpan);
            a.appendChild(spaceNode);
            a.appendChild(textNode);
 
            a.className = "new hatarozo-koztespont-btn";
 
            let previousNode = a.previousSibling;
            if (previousNode && previousNode.nodeType === Node.TEXT_NODE) {
                previousNode.textContent = previousNode.textContent.replace(/[→\s\xA0&rarr;]+$/, '');
            }
        }
    });
 
    bodyContent.querySelectorAll('li').forEach(li => {
        const bendoLinkek = li.querySelectorAll('a[href*="/wiki/"]:not(.external)');
 
        bendoLinkek.forEach(link => {
            const title = link.getAttribute('title') || '';
 
            if (regexKoztespont.test(title) || link.classList.contains('hatarozo-koztespont-btn')) {
                return;
            }
 
            let vizsgaltNode = link.previousSibling;
            if (link.parentElement.tagName.toLowerCase() === 'i') {
                vizsgaltNode = link.parentElement.previousSibling;
            }
 
            let elotteLevoSzo = "";
            if (vizsgaltNode && vizsgaltNode.nodeType === Node.TEXT_NODE) {
                elotteLevoSzo = vizsgaltNode.textContent;
            }
 
            if (!elotteLevoSzo.includes('Pl.') && !elotteLevoSzo.includes('(')) {
                if (!link.classList.contains('hatarozo-vegpont-btn')) {
                    const tisztaFajnev = link.textContent.replace(/^[→\s\xA0]+/, '').replace(/[→\s\xA0]+$/, '').trim() || title;
 
                    link.innerHTML = `<span class="arrow-prefix">→ </span><span class="botanical-name">${tisztaFajnev}</span>`;
                    link.classList.add("hatarozo-vegpont-btn");
 
                    if (link.parentElement.tagName.toLowerCase() === 'i') {
                        link.parentElement.style.fontStyle = "normal";
                    }
                }
 
                if (vizsgaltNode && vizsgaltNode.nodeType === Node.TEXT_NODE) {
                    vizsgaltNode.textContent = vizsgaltNode.textContent.replace(/[→\s\xA0&rarr;]+$/, '');
                }
            }
        });
    });
});
 
/**
* ============================================================================
* GLOBÁLIS, ÖSSZEFÜGGŐ DINAMIKUS LIGHTGALLERY (Minden képet egy galériába fűz)
* ============================================================================
*/
window.addEventListener('click', function(e) {
    // Elkapjuk az összes lehetséges képlinket (Natív MediaWiki, Előkészített egyedi külső, és régi dinamikus galéria)
    var targetLink = e.target.closest('a.mw-file-description, a.image, a.lg-egyedi-kulso-item, a.lg-dinamikus-item');
    if (!targetLink) return;
 
    // Fájl leíró oldalakon hagyjuk a gyári működést
    if (window.location.pathname.includes('/wiki/F%C3%A1jl:') || window.location.pathname.includes('/wiki/File:')) {
        return;
    }
 
    // Elfojtjuk a gyári átirányítást és eseményeket
    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();
 
    var dynamicSlides = [];
    var clickedIndex = 0;
 
    // Szelektáljuk az ÖSSZES képlinket az oldalon a megjelenés sorrendjében
    var $mindenKepA = $('a.mw-file-description, a.image, a.lg-egyedi-kulso-item, a.lg-dinamikus-item');
 
    $mindenKepA.each(function(index) {
        var $el = $(this);
        var $img = $el.find('img');
 
        // JAVÍTVA: Ha külső egyedi galéria elemről van szó, nem kötelező az <img> tag jelenléte!
        if ($img.length === 0 && !$el.hasClass('lg-egyedi-kulso-item')) return;
 
        if ($el.is(targetLink)) {
            clickedIndex = dynamicSlides.length; // Pontos index elmentése a dinamikus tömbben
        }
 
        var origSrc = '';
        var thumbSrc = $img.attr('src') || '';
        var captionText = '';


/* Keresőmező stílusának igazítása a MediaWiki beviteli mezőihez */
        // 1. ESET: Előkészített egyedi külső URL / Commons doboz kép (Nincs kötelező <img> tag!)
.dt-search input {
        if ($el.hasClass('lg-egyedi-kulso-item')) {
  border: 1px solid #a2a9b1 !important;
            origSrc = $el.attr('data-src');
  border-radius: 2px;
            thumbSrc = origSrc; // Indexképként is a külső forrást használjuk, mivel nincs helyi thumb
  padding: 4px;
            captionText = $el.attr('data-sub-html') || '';
}
        }
        // 2. ESET: Régi dinamikus (Commons search) galéria elem
        else if ($el.hasClass('lg-dinamikus-item')) {
            origSrc = $el.attr('data-src');
            captionText = $el.attr('data-sub-html') || '';
        }
        // 3. ESET: Natív cikkbeli kép (Hagyományos MediaWiki galéria vagy <figure>)
        else {
            // Intelligens URL tisztítás az eredeti képhez
            origSrc = thumbSrc;
            if (origSrc.indexOf('/thumb/') !== -1) {
                origSrc = origSrc.replace('/thumb/', '/');
                if (origSrc.lastIndexOf('/') !== -1) {
                    origSrc = origSrc.substring(0, origSrc.lastIndexOf('/'));
                }
            }


/* Közös CSS az összes felületnek */
            // Képaláírás kinyerése
/* Anonim felhasználóknál rejtsük el a felesleges füleket */
            var nativeEl = $el[0];
body.anonymous #ca-history,
            if (nativeEl) {
body.anonymous #ca-viewsource {
                var figure = nativeEl.closest('figure, .thumb');
  display: none !important;
                if (figure) {
}
                    var figcaption = figure.querySelector('figcaption, .thumbcaption');
                    if (figcaption) {
                        captionText = figcaption.textContent.replace(/×/g, '').trim();
                    }
                }
            }
            if (!captionText) {
                captionText = $img.attr('alt') || $img.attr('title') || '';
            }
            if (captionText) {
                captionText = '<h4>' + captionText + '</h4>';
            }
        }


/* Csak a kategóriaoldalak elsődleges címe (namespace + kettőspont) elrejtése */
        dynamicSlides.push({
.mw-page-title-namespace,
            src: origSrc,
.mw-page-title-separator {
            thumb: thumbSrc,
  display: none;
            subHtml: captionText
}
        });
    });


@media screen {
     // LightGallery indítása az összesített tömbbel
  .mw-body header h1.firstHeading {
     if (window.lightGallery && dynamicSlides.length > 0) {
    padding-bottom: 3px;
        var container = document.createElement('div');
  }
        var dynamicGallery = lightGallery(container, {
  .mw-body header h1.firstHeading span {
            dynamic: true,
    background-color: beige;
            dynamicEl: dynamicSlides,
    border-top-right-radius: 6px;
            licenseKey: '0000-0000-000-0000',
    border-top-left-radius: 6px;
            thumbnail: true,
    color: #436d38;
            animateThumb: true,
    padding: 0px 10px 0 10px;
            showThumbByDefault: true,
  }
            index: clickedIndex,
  .mw-body header .vector-page-titlebar::after {
            download: true,
    height: 3px;
            counter: dynamicSlides.length > 1,
     background-color: #436d38;
            getCaptionFromTitleOrAlt: false
  }
        });
  .mw-body .mw-body-content div.tn li {
    line-height: 1.8em;
    margin-bottom: 10px;
  }
  .mw-body .mw-body-content div.tn li span.tnb b {
    border-radius: 10px;
    color: black;
    font-size: 110%;
    padding: 2px 5px;
  }
  .mw-body .mw-body-content div.tn li span.tnb-acc b {
    background: #ccffcc;
  }
  .mw-body .mw-body-content div.tn li span.tnb-syn b {
    background: #ffebcc;
  }
  .mw-body .mw-body-content div.tn li span.tnb-unres b {
    background: #ffcccc;
  }
  .mw-body .mw-body-content div.tn li span.tnb-hyb b {
    background: #f2e6d9;
  }
  .mw-body .mw-body-content div.tn li span.tns {
    border-radius: 10px;
    color: white;
    font-size: 90%;
    font-weight: bold;
    padding: 2px 5px;
  }
  .mw-body .mw-body-content div.tn li span.tns-acc {
    background: green;
  }
  .mw-body .mw-body-content div.tn li span.tns-syn {
    background: orange;
  }
  .mw-body .mw-body-content div.tn li span.tns-unres {
    background: red;
  }
  .mw-body .mw-body-content div.tn li span.tns-hyb {
    background: brown;
  }
  .mw-body .mw-body-content div.tn li span.sec {
    background: #ccf5ff;
    color: black;
    padding: 0 3px;
  }
  .mw-body .mw-body-content .mw-heading h1, .mw-body .mw-body-content .mw-heading h2, .mw-body .mw-body-content .mw-heading h3, .mw-body .mw-body-content .mw-heading h4, .mw-body .mw-body-content .mw-heading h5, .mw-body .mw-body-content .mw-heading h6 {
    color: #274f1c;
  }
  .mw-body .mw-body-content .mw-heading h3, .mw-body .mw-body-content .mw-heading h4 {
    text-decoration-line: underline;
  }
  .mw-body .mw-body-content .mw-heading2 h2 {
    background-color: rgb(250, 250, 239);
    padding: 0px 5px;
  }
  .mw-body .mw-body-content .mw-heading2 {
    border-bottom: 1px solid #436d38;
  }
  .mw-body .mw-body-content ul span.syn {
    background: beige;
    border-radius: 10px;
    padding-left: 5px;
    padding-right: 5px;
  }
  .mw-body .mw-body-content ul span.syn a {
    color: #436d38; /* A fejlécben is használt zölded */
     text-decoration: none;
  }
  .mw-body .mw-body-content ul span.syn a:hover {
    text-decoration: underline;
  }
  .mw-body .mw-body-content img {
    vertical-align: middle;
    float: left;
    padding-right: 10px;
    padding-bottom: 10px;
  }
  .mw-body .mw-body-content .hatarozo-koztespont-btn {
    display: inline-block;
    background-color: #e7e7c9 !important;
    color: #274f1c !important;
    font-weight: bold !important;
    padding: 3px 6px;
    margin: 2px;
    text-decoration: none !important;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  }
  .mw-body .mw-body-content {
    /* JAVÍTVA: Kényszerített stílusok a hover állapothoz */
  }
  .mw-body .mw-body-content .hatarozo-koztespont-btn:hover {
    background-color: #c0c078 !important;
    color: #1b3813 !important; /* Kicsit sötétebb szöveg hoverkor */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    text-decoration: none !important;
  }
  .mw-body .mw-body-content .hatarozo-vegpont-btn {
    display: inline-block;
    background-color: #d7e7c9 !important;
    color: #274f1c !important;
    font-weight: bold !important;
    padding: 3px 6px;
    margin: 2px;
    text-decoration: none !important;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
  }
  .mw-body .mw-body-content {
    /* JAVÍTVA: Kényszerített stílusok a hover állapothoz */
  }
  .mw-body .mw-body-content .hatarozo-vegpont-btn:hover {
    background-color: #9ab385 !important;
    color: #1b3813 !important; /* Kicsit sötétebb szöveg hoverkor */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    text-decoration: none !important;
  }
  .mw-body .mw-body-content {
    /* Biztosítjuk, hogy a gombban lévő nyíl egyenes maradjon */
  }
  .mw-body .mw-body-content .hatarozo-vegpont-btn .arrow-prefix {
    font-style: normal !important;
    margin-right: 5px;
  }
  .mw-body .mw-body-content {
    /* Csak a fajnév lesz dőlt a gombon belül */
  }
  .mw-body .mw-body-content .hatarozo-vegpont-btn .botanical-name {
    font-style: italic !important;
  }
  .mw-body .mw-body-content {
    /* Első szint: Sima számok */
  }
  .mw-body .mw-body-content ol {
    list-style-type: decimal;
  }
  .mw-body .mw-body-content ol > li::marker {
    font-weight: bold;
    color: #009933; /* Sötétzöld szín */
  }
  .mw-body .mw-body-content {
    /* Második szint: nagybetűs ábécé */
  }
  .mw-body .mw-body-content ol li > ol {
    list-style-type: upper-alpha;
  }
  .mw-body .mw-body-content ol li > ol > li::marker {
    font-weight: bold;
    color: #99cc00; /* szín az alpontoknak */
  }
  .mw-body .mw-body-content {
    /* Harmadik szint: kis római számok */
  }
  .mw-body .mw-body-content ol li > ol li > ol {
    list-style-type: upper-roman;
  }
  .mw-body .mw-body-content ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #009999; /* szín a harmadik szintnek */
  }
  .mw-body .mw-body-content {
    /* Negyedik szint: kisbetű */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol {
    list-style-type: lower-alpha;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #cc9900; /* szín a 4. szintnek */
  }
  .mw-body .mw-body-content {
    /* 5 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol {
    list-style-type: lower-roman;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #b1551f; /* szín a 5. szintnek */
  }
  .mw-body .mw-body-content {
    /* 6 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol {
    list-style-type: decimal;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #1f7bb1; /* szín a 6. szintnek */
  }
  .mw-body .mw-body-content {
    /* 7 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol {
    list-style-type: upper-alpha;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #831fb1; /* szín a 7. szintnek */
  }
  .mw-body .mw-body-content {
    /* 8 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol {
    list-style-type: upper-roman;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #7a9c3a; /* szín a 8. szintnek */
  }
  .mw-body .mw-body-content {
    /* 9 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol {
    list-style-type: upper-greek;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #9c3a3a; /* szín a 9. szintnek */
  }
  .mw-body .mw-body-content {
    /* 10 szint */
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol {
    list-style-type: lower-greek;
  }
  .mw-body .mw-body-content ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol li > ol > li::marker {
    font-weight: bold;
    color: #104ac7; /* szín a 10. szintnek */
  }
  .mw-body .mw-body-content .wiki-dynamic-gallery {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end; /* Így az aljuk lesz egy vonalban */
    gap: 10px;
    margin: 15px 0;
  }
  .mw-body .mw-body-content .wiki-dynamic-gallery a {
    display: block;
    height: 210px; /* Fix magasság */
    background: #f0f0f0; /* Betöltődés alatti szín */
    border-radius: 8px;
  }
  .mw-body .mw-body-content .wiki-dynamic-gallery a img {
    height: 200px;
    display: block;
    object-fit: contain;
    padding: 0;
    width: auto; /* A szélesség alkalmazkodik az arányokhoz */
  }
  .mw-body .mw-body-content .egyedi-galeria-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin: 20px 0;
    width: 100%;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem {
    background: #f8f9fa !important;
    border: 1px solid #c8ccd1 !important;
    border-radius: 6px !important;
    padding: 10px !important;
    margin: 0 !important;
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08) !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    box-sizing: border-box !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    float: none !important;
    min-height: 220px !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15) !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure[typeof*="mw:File/Thumb"],
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    float: none !important;
    overflow: visible !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure[typeof*="mw:File/Thumb"] a.mw-file-description,
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure a.mw-file-description {
    display: block !important;
    width: auto !important;
    height: 160px !important;
    cursor: pointer !important;
    margin-bottom: 8px !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure[typeof*="mw:File/Thumb"] img.mw-file-element,
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure img.mw-file-element {
    width: auto !important;
    max-width: 100% !important;
    height: 160px !important;
    max-height: 160px !important;
    object-fit: contain !important;
    border-radius: 4px !important;
    padding: 0 !important;
    margin: 0 !important;
    float: none !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure[typeof*="mw:File/Thumb"] figcaption,
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem figure figcaption {
    display: block !important;
    border: none !important;
    font-size: 0.85em !important;
    color: #202122 !important;
    text-align: center !important;
    line-height: 1.3 !important;
    padding: 5px 0 0 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    word-wrap: break-word !important;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem .kulso-url-doboz {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem .kulso-url-doboz .lg-vegyes-item {
    display: block;
    width: auto;
    height: 160px;
    cursor: pointer;
    margin-bottom: 8px;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem .kulso-url-doboz .url-kep {
    max-width: 100%;
    height: 160px;
    max-height: 160px;
    width: auto;
    display: block;
    object-fit: contain;
    border-radius: 4px;
    padding: 0;
    margin: 0;
    float: none;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem .galeria-felirat {
    display: block !important;
    font-size: 0.85em;
    color: #202122;
    text-align: center;
    line-height: 1.3;
    padding-top: 5px;
    width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
  }
  .mw-body .mw-body-content .egyedi-galeria-container .galeria-elem .url-link-szoveg {
    font-size: 0.8em;
    color: #72777d;
    padding: 40px 10px;
    text-align: center;
    font-style: italic;
  }
  .mw-body table.datatable-hook {
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    border: 1px solid #ebebe0 !important;
    border-radius: 6px;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    color: grey;
  }
  .mw-body table.dataTable > thead > tr th {
    background-color: #eaeadd;
    border-width: 0px;
  }
  .mw-body table.dataTable > thead > tr th:first-child {
    border-top-left-radius: 6px;
  }
  .mw-body table.dataTable > thead > tr th:last-child {
    border-top-right-radius: 6px;
  }
  .mw-body .wikitable {
    background-color: #fffff9;
  }
  .mw-body .wikitable tr.accepted {
    background-color: #dcecd7;
  }
  .mw-body .wikitable > * > tr > td {
    border-color: beige;
    border-width: 1px;
  }
  .mw-body div.dt-container.dt-empty-footer tbody > tr:last-child > * {
    border-bottom-width: 0px;
  }
  .mw-body table.infobox.biota {
    background-color: #f8f9fa;
    border: 1px solid #ebebe0;
    border-radius: 6px;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    clear: right;
    color: black;
    float: right;
    margin: 0.5em 0 0.5em 1.4em;
    padding: 10px 2px;
    text-align: center;
    width: 22em;
  }
  .mw-body table.infobox.biota.acc th {
    background-color: #e6ffee;
  }
  .mw-body table.infobox.biota.acc th.taxonnev {
    background-color: green;
    color: white;
  }
  .mw-body table.infobox.biota.syn th {
    background-color: #fff5e6;
  }
  .mw-body table.infobox.biota.syn th.taxonnev {
    background-color: orange;
    color: black;
  }
  .mw-body table.infobox.biota.unres th {
    background-color: #ffe6e6;
  }
  .mw-body table.infobox.biota.unres th.taxonnev {
    background-color: red;
    color: white;
  }
  .mw-body table.infobox.biota.hyb th {
    background-color: #f9f2ec;
  }
  .mw-body table.infobox.biota.hyb th.taxonnev {
    background-color: brown;
    color: white;
  }
  .mw-body table.infobox.biota th.taxonnev {
    font-size: 110%;
  }
  .mw-body table.infobox.biota th.suha-svg {
    padding: 10px 0 !important;
  }
  .mw-body table.infobox.biota th.taxobox-icons {
    /* Csak a taxobox keresőikonjaira vonatkozó stílus eleje */
    /* Eltávolítjuk az alapértelmezett belső margókat a celláról */
    background-color: #ebebe0;
    padding: 10px 0 !important;
  }
  .mw-body table.infobox.biota th.taxobox-icons a {
    /* Minden linkre (a-tag), ami a taxobox-icons cellában van */
    margin: 0 5px !important;
    display: inline-block;
    vertical-align: middle;
    text-decoration: none !important; /* Eltünteti az esetleges aláhúzást */
  }
  .mw-body table.infobox.biota th.taxobox-icons .external {
    /* Opcionális: a külső link ikon elrejtése, ha zavarja a logót */
    background-image: none !important;
    padding-right: 0 !important;
  }
  .mw-body table.infobox.biota th.taxobox-icons img {
    /* Biztosítjuk, hogy a kép ne lógjon ki */
    display: block;
    float: none;
    opacity: 0.7;
  }
  .mw-body table.infobox.biota th.taxobox-icons img:hover {
    /* Ha szeretnél egy kis hover effektet (elhalkul/erősödik ha rámutatsz) */
    opacity: 1;
    transition: opacity 0.2s;
  }
  .mw-body table.infobox.biota th.taxobox-icons {
    /* Csak a taxobox keresőikonjaira vonatkozó stílus vége */
  }
  .mw-body table.infobox.biota th img {
    float: none;
  }
  .mw-body table.infobox.biota.ember th img {
    width: 340px;
  }
  .mw-body table.infobox.biota td {
    padding: 4px 2px;
  }
  .mw-body table.infobox.biota td.left {
    background-color: lightgray;
    font-size: 90%;
    line-height: 95%;
    padding-right: 4px;
    text-align: right;
    width: 105px;
  }
  .mw-body table.infobox.biota td.right {
    font-size: 95%;
    line-height: 95%;
    text-align: left;
  }
  .mw-body table.infobox.biota caption {
    background-color: #afe1af;
    text-align: center;
  }
  .mw-body .catlinks {
    background-color: #f8f9fa;
    border: 1px solid #ebebe0;
    border-radius: 6px;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    color: grey;
    display: block !important;
    overflow: hidden;
  }
  .vector-column-start .vector-main-menu-container,
  .vector-column-start .vector-sticky-pinned-container {
    margin-bottom: 10px;
    margin-left: 0;
  }
  .vector-column-start .vector-main-menu-container nav#mw-panel .vector-pinned-container,
  .vector-column-start .vector-sticky-pinned-container nav#mw-panel .vector-pinned-container {
    background-image: url(https://wiki.kaktuszgyujtok.hu/images/d/d5/Epicactus.png);
    background-repeat: no-repeat;
    background-position-x: right;
  }
  .vector-column-start .vector-main-menu-container nav#mw-panel,
  .vector-column-start .vector-main-menu-container nav#mw-panel-toc,
  .vector-column-start .vector-sticky-pinned-container nav#mw-panel,
  .vector-column-start .vector-sticky-pinned-container nav#mw-panel-toc {
    border: 1px solid #ebebe0;
    border-radius: 6px;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    color: grey;
    display: block !important;
    overflow: hidden;
  }
  .vector-column-start .vector-main-menu-container nav#mw-panel .vector-pinned-container,
  .vector-column-start .vector-main-menu-container nav#mw-panel-toc .vector-pinned-container,
  .vector-column-start .vector-sticky-pinned-container nav#mw-panel .vector-pinned-container,
  .vector-column-start .vector-sticky-pinned-container nav#mw-panel-toc .vector-pinned-container {
    background-color: #fffff9;
    margin-bottom: 0;
    padding-bottom: 5px;
  }
  html, body {
    font-family: sans-serif;
    height: 100%;
  }
  body {
    background-color: var(--background-color-neutral-subtle, #f8f9fa);
    color: var(--color-base, #202122);
    margin: 0;
  }
  html.vector-feature-custom-font-size-clientpref--excluded,
  .vector-feature-custom-font-size-clientpref--excluded,
  html.vector-feature-custom-font-size-clientpref-0,
  .no-font-mode-scale,
  .mw-body-content .cdx-message {
    --font-size-medium: 1rem;
    --line-height-medium: 1.5714285;
    --line-height-content: 1.5714285;
  }
  .vector-feature-custom-font-size-clientpref--excluded,
  .vector-feature-custom-font-size-clientpref-0,
  .mw-body-content .cdx-message {
    --font-size-medium: 1rem;
    --line-height-medium: 1.6;
  }
  .mw-content-ltr figure[typeof~="mw:File/Thumb"],
  .mw-content-ltr figure[typeof~="mw:File/Frame"],
  .mw-content-ltr figure[typeof~="mw:File"].mw-halign-right {
    background-color: #f8f9fa;
    border: 1px solid #ebebe0;
    border-radius: 6px;
    box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.16);
    color: grey;
    display: block !important;
    margin: 0.5em 0 0.5em 1.4em;
    overflow: hidden;
  }
  .mw-content-ltr figure[typeof~="mw:File/Thumb"] > figcaption,
  .mw-content-ltr figure[typeof~="mw:File/Frame"] > figcaption {
    border: 0px solid #a2a9b1;
    display: block !important;
    font-size: 85%;
    max-width: 334px;
    text-align: center;
  }
  body.skin--responsive .mw-parser-output figure img.mw-file-element {
    width: 340px;
    height: auto;
    max-width: 100%;
  }
}


/*# sourceMappingURL=gyz.css.map */
        dynamicGallery.openGallery();
    } else {
        console.error("LightGallery hiba: Nem sikerült elindítani a globális galériát.");
    }
}, true); // Capturing fázis!

A lap jelenlegi, 2026. június 19., 10:25-kori változata

/**
 * VECTOR 2022 TELEPORT BUGFIX - DRGYZ
 * Létrehozza a hiányzó teleportációs célpontokat, mielőtt a skin JS elhasalna
 */
(function() {
    function injectVectorTargets() {
        var targets = ['p-lang-btn', 'vector-user-links-dropdown', 'vector-toc-landmark'];

        targets.forEach(function(id) {
            if (!document.getElementById(id)) {
                var dummy = document.createElement('div');
                dummy.id = id;
                dummy.className = 'vector-teleport-dummy-target';
                dummy.style.display = 'none';
                document.body.appendChild(dummy);
            }
        });
    }

    injectVectorTargets();

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', injectVectorTargets);
    }
})();

/**
 * ============================================================================
 * LIGHTGALLERY GLOBÁLIS INTEGRÁCIÓ (Egyedi sablon galériák előkészítése)
 * ============================================================================
 */
(function() {
    $(function() {
        if ($('.wiki-dynamic-gallery').length > 0) {
            initWikiDynamicGallery();
        }
        if ($('.egyedi-galeria-container').length > 0) {
            prePrepareEgyediGaleriak();
        }
    });

    // --- RÉGI WIKI DYNAMIC GALLERY LOGIKA ---
    function initWikiDynamicGallery() {
        $('.wiki-dynamic-gallery').each(function() {
            var $container = $(this);
            if ($container.data('initialized')) return;
            $container.data('initialized', true);

            var searchTerm = $container.data('search');
            var limit = $container.data('limit') || 3;
            var targetHeight = 200;

            var apiUrl = "https://commons.wikimedia.org/w/api.php?action=query&format=json&generator=search&gsrsearch=File:" +
                         encodeURIComponent(searchTerm) + "&gsrlimit=" + limit +
                         "&prop=imageinfo&iiprop=url|size&iiurlheight=" + targetHeight + "&origin=*";

            $.getJSON(apiUrl, function(data) {
                if (data && data.query && data.query.pages) {
                    var pages = data.query.pages;
                    var galleryHtml = '';

                    for (var id in pages) {
                        if (!pages[id].imageinfo) continue;
                        var img = pages[id].imageinfo[0];

                        // Szebbé tesszük a címet a felugró ablakhoz
                        var title = pages[id].title.replace('File:', '').replace(/\.[^/.]+$/, "");

                        // LightGallery felugró ablak felirata és az ERDETI NAGY KÉP LINKJE (img.url)
                        var captionHtml = '<div class="lg-egyedi-felirat"><h4>' + title + '</h4>' +
                                          '<br/><span class="galeria-forras-jelzo" style="font-size:0.85em; color:#bbb; display:block; margin-top:4px;">' +
                                          'Forrás: <a href="' + img.url + '" target="_blank" rel="noopener noreferrer" style="color:#66b2ff; text-decoration:underline;">Wikimedia Commons</a> ↗' +
                                          '</span></div>';

                        // ÖSSZEÁLLÍTJUK A JAVÍTOTT KÁRTYA STRUKTÚRÁT
                        galleryHtml += '<div class="galeria-elem">';
                        galleryHtml += '  <div class="kulso-url-doboz" data-src="' + img.url + '" data-elokeszitve="true">';
                        galleryHtml += '    <figure class="mw-default-size col-url-figure" style="position: relative !important; overflow: visible !important;">';

                        // HIBÁTLAN LIGHTGALLERY INTEGRÁCIÓ: a href és data-src attribútumba is a NAGY KÉP (img.url) megy!
                        galleryHtml += '      <a href="' + img.url + '" class="lg-egyedi-kulso-item lg-dinamikus-item" data-src="' + img.url + '" data-sub-html="' + captionHtml.replace(/"/g, '&quot;') + '" style="display: block !important; position: relative !important;">';
                        galleryHtml += '        <img src="' + img.thumburl + '" class="galeria-kep url-kep" alt="' + title + '" />';

                        // A FÖLDGÖMB IKONT KÖZVETLENÜL A KÉPRE (A LINKEN BELÜLRE) POZICIONÁLJUK A BAL FELSŐ SAROKBA
                        galleryHtml += '        <div class="kulso-link-ikon" style="position: absolute !important; top: 6px !important; left: 6px !important; z-index: 10 !important; font-size: 14px !important; background: rgba(255, 255, 255, 0.85) !important; padding: 2px 4px !important; border-radius: 4px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important; line-height: 1 !important; display: block !important;">🌐</div>';
                        galleryHtml += '      </a>';

                        // FIGCAPTION: Kizárólag a galéria feliratot tartalmazza, a forrás szöveg (Wikimedia Commons) KI LETT TÖRÖLVE!
                        galleryHtml += '      <figcaption>';
                        galleryHtml += '        <span class="galeria-felirat">' + title + '</span>';
                        galleryHtml += '      </figcaption>';
                        galleryHtml += '    </figure>';
                        galleryHtml += '  </div>';
                        galleryHtml += '</div>';
                    }
                    // Behelyezzük a kártyákat a konténerbe és megadjuk neki a globális galéria osztályt
                    $container.addClass('egyedi-galeria-container').html(galleryHtml);
                }
            });
        });
    }

    // --- EGYEDI GALÉRIÁK ELŐKÉSZÍTÉSE (Csak a feliratokat és a DOM-ot hozzuk helyre, de nem inicializálunk LG-t) ---
    function prePrepareEgyediGaleriak() {
        $('.egyedi-galeria-container').each(function() {
            var $container = $(this);

            // 1. Külső URL és Commons dobozok formázása (MediaWiki kompatibilis <figure> struktúra)
            $container.find('.kulso-url-doboz').each(function() {
                var $doboz = $(this);
                if ($doboz.data('elokeszitve')) return;
                $doboz.data('elokeszitve', true);

                var eredetiUrl = $doboz.attr('data-src');
                var biztonsagosUrl = eredetiUrl;

                // HTTPS képproxy (weserv.nl) a vegyes tartalom és a hotlink tiltás ellen
                if (eredetiUrl && eredetiUrl.indexOf('http://') === 0) {
                    var tisztaUrl = eredetiUrl.replace('http://', '');
                    biztonsagosUrl = 'https://images.weserv.nl/?url=' + encodeURIComponent(tisztaUrl);
                }

                var forrasNev = $doboz.attr('data-forras-nev') || 'Külső forrás';
                var $feliratElem = $doboz.find('.galeria-felirat');
                var felirat = $feliratElem.text().trim();

                if (!felirat) {
                    var fileTitle = eredetiUrl.substring(eredetiUrl.lastIndexOf('/') + 1).split('.')[0];
                    felirat = decodeURIComponent(fileTitle).replace(/_/g, ' ');
                }

                // LightGallery felugró ablak felirata
                var forrasLinkHtml = '<br/><span class="galeria-forras-jelzo" style="font-size:0.85em; color:#bbb; display:block; margin-top:4px;">' +
                                     'Forrás: <a href="' + eredetiUrl + '" target="_blank" rel="noopener noreferrer" style="color:#66b2ff; text-decoration:underline;">' + forrasNev + '</a> ↗' +
                                     '</span>';
                var captionHtml = '<div class="lg-egyedi-felirat"><h4>' + felirat + '</h4>' + forrasLinkHtml + '</div>';

                // ÖSSZEÁLLÍTJUK A JAVÍTOTT, EGYSÉGES SZABVÁNYOS MEDIAWIKI STRUKTÚRÁT:
                var $figure = $('<figure>', {
                    'class': 'mw-default-size col-url-figure',
                    'style': 'position: relative !important; overflow: visible !important;'
                });

                var $lgItem = $('<a>', {
                    'href': biztonsagosUrl,
                    'class': 'lg-egyedi-kulso-item',
                    'data-src': biztonsagosUrl,
                    'data-sub-html': captionHtml,
                    'style': 'display: block !important; position: relative !important;'
                });

                // A beágyazott előkép
                $('<img>', {
                    'src': biztonsagosUrl,
                    'class': 'galeria-kep url-kep',
                    'alt': felirat
                }).appendTo($lgItem);

                // JAVÍTÁS: A FÖLDGÖMB IKON BEKERÜL A LINKEN BELÜLRE, ABSZOLÚT POZÍCIÓVAL A BAL FELSŐ SAROKBA
                $('<div>', {
                    'class': 'kulso-link-ikon',
                    'style': 'position: absolute !important; top: 6px !important; left: 6px !important; z-index: 10 !important; font-size: 14px !important; background: rgba(255, 255, 255, 0.85) !important; padding: 2px 4px !important; border-radius: 4px !important; box-shadow: 0 1px 3px rgba(0,0,0,0.3) !important; line-height: 1 !important; display: block !important;',
                    'text': '🌐'
                }).appendTo($lgItem);

                // JAVÍTÁS: Szabványos figcaption, amiből a zárójeles forrásszöveg teljesen ki lett hagyva
                var $figcaption = $('<figcaption>').html(
                    '<span class="galeria-felirat">' + felirat + '</span>'
                );

                // Egymás mögé fűzzük őket a dobozon belül
                $lgItem.appendTo($figure);
                $figcaption.appendTo($figure);

                $doboz.empty().append($figure);
            });

            // 2. Belső képek noviewer osztállyal való ellátása
            $container.find('figure a.mw-file-description').addClass('noviewer');
        });
    }
})();

/**
 * ============================================================================
 * KIEGÉSZÍTŐIKONOK ÉS STÍLUSLAPOK BETÖLTÉSE
 * ============================================================================
 */
var link = document.createElement("link");
link.rel = "stylesheet";
link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css";
document.head.appendChild(link);

/**
 * ============================================================================
 * JOGOSULTSÁGKEZELÉS (Fülek elrejtése anonim felhasználóknak)
 * ============================================================================
 */
if (mw.config.get('wgUserName') === null) {
    var hideTabs = function () {
        var el1 = document.querySelector('#ca-history');
        var el2 = document.querySelector('#ca-viewsource');
        if (el1) el1.style.display = 'none';
        if (el2) el2.style.display = 'none';

        if (el1 || el2) clearInterval(observer);
    };
    var observer = setInterval(hideTabs, 100);
}

/**
 * ============================================================================
 * KÜLSŐ LINK VISLEKEDÉS (Új lapon nyíló külső hivatkozások)
 * ============================================================================
 */
$(function () {
    $('a.external').attr('target', '_blank');
});

/**
 * ============================================================================
 * NAVIGÁCIÓS GOMBOK (Tetejére és Vissza gomb logikája)
 * ============================================================================
 */
$(function() {
    var $btn = $('<button/>', {
        html: '<i class="bi bi-arrow-up-square"></i> Tetejére',
        id: 'backToTopBtn',
        title: 'Az oldal tetejére',
        css: {
            position: 'fixed',
            bottom: '20px',
            right: '20px',
            padding: '10px 15px',
            'font-size': '14px',
            'background-color': '#888446ff',
            color: 'white',
            border: 'none',
            'border-radius': '10px',
            cursor: 'pointer',
            display: 'none',
            width: '100px',
            'z-index': 1000
        },
        click: function() {
            window.scrollTo({top: 0, behavior: 'smooth'});
        }
    });

    var $backBtn = $('<button/>', {
        html: '<i class="bi bi-arrow-left-square"></i> Vissza',
        id: 'backBtn',
        title: 'Előző oldal',
        css: {
            position: 'fixed',
            bottom: '60px',
            right: '20px',
            padding: '10px 15px',
            'font-size': '14px',
            'background-color': '#547454ff',
            color: 'white',
            border: 'none',
            'border-radius': '10px',
            cursor: 'pointer',
            display: 'none',
            width: '100px',
            'z-index': 1000
        },
        click: function() {
            window.history.back();
        }
    });

    $('body').append($btn).append($backBtn);

    $(window).scroll(function() {
        if ($(window).scrollTop() > 100) {
            $btn.fadeIn();
            $backBtn.fadeIn();
        } else {
            $btn.fadeOut();
            $backBtn.fadeOut();
        }
    });
});

/**
 * ============================================================================
 * TAXOBOX ÉS RENDSZERTANI LINKEK KEZELÉSE
 * ============================================================================
 */
$(document).ready(function() {
    $('.taxobox-icons a').attr('target', '_blank');
});

/**
 * ============================================================================
 * DATATABLES INTEGRÁCIÓ (Javított táblázatkezelés)
 * ============================================================================
 */
mw.loader.using( ['jquery', 'mediawiki.util'] ).done( function () {
    if ( $( '.datatable-hook' ).length > 0 ) {
        $.getScript( 'https://cdn.datatables.net/2.1.8/js/dataTables.min.js' )
            .done( function() {
                $( '.datatable-hook' ).each( function() {
                    var $table = $(this);
                    var $headerRow = $table.find( 'tr:has(th)' ).first();

                    if ( $headerRow.length > 0 ) {
                        var $thead = $( '<thead></thead>' );
                        $headerRow.detach().appendTo( $thead );
                        $table.prepend( $thead );
                    }

                    $table.DataTable({
                        language: {
                            url: '//cdn.datatables.net/plug-ins/2.1.8/i18n/hu.json'
                        },
                        layout: {
                            topStart: 'pageLength',
                            topEnd: 'search',
                            bottomStart: 'info',
                            bottomEnd: 'paging'
                        },
                        pageLength: 10,
                        columnDefs: [ { targets: '_all', defaultContent: '' } ]
                    });
                });
            })
            .fail( function() {
                console.error( 'Hiba: Nem sikerült betölteni a DataTables szkriptet.' );
            });
    }
});

/**
 * ============================================================================
 * SZUKKULENS NÖVÉNYHATÁROZÓ KULCSOK LOGIKÁJA
 * ============================================================================
 */
mw.hook('wikipage.content').add(function () {
    const aktualisKategoriak = mw.config.get('wgCategories') || [];
    if (!aktualisKategoriak.includes('Szukkulens növényhatározó kulcsok')) {
        return;
    }

    const regexKoztespont = /^Szukkulens határozó:/;
    const bodyContent = document.getElementById('bodyContent');
    if (!bodyContent) return;

    bodyContent.querySelectorAll('a').forEach(a => {
        const teljesNev = a.getAttribute('title') || '';

        if (regexKoztespont.test(teljesNev)) {
            let tisztaGombSzöveg = teljesNev.replace(/\s*\(a lap nem létezik\)$/, '');
            a.innerHTML = '';

            const arrowSpan = document.createElement('span');
            arrowSpan.className = 'arrow-prefix';
            arrowSpan.textContent = '→';

            const spaceNode = document.createTextNode(' ');
            const textNode = document.createTextNode(tisztaGombSzöveg);

            a.appendChild(arrowSpan);
            a.appendChild(spaceNode);
            a.appendChild(textNode);

            a.className = "new hatarozo-koztespont-btn";

            let previousNode = a.previousSibling;
            if (previousNode && previousNode.nodeType === Node.TEXT_NODE) {
                previousNode.textContent = previousNode.textContent.replace(/[→\s\xA0&rarr;]+$/, '');
            }
        }
    });

    bodyContent.querySelectorAll('li').forEach(li => {
        const bendoLinkek = li.querySelectorAll('a[href*="/wiki/"]:not(.external)');

        bendoLinkek.forEach(link => {
            const title = link.getAttribute('title') || '';

            if (regexKoztespont.test(title) || link.classList.contains('hatarozo-koztespont-btn')) {
                return;
            }

            let vizsgaltNode = link.previousSibling;
            if (link.parentElement.tagName.toLowerCase() === 'i') {
                vizsgaltNode = link.parentElement.previousSibling;
            }

            let elotteLevoSzo = "";
            if (vizsgaltNode && vizsgaltNode.nodeType === Node.TEXT_NODE) {
                elotteLevoSzo = vizsgaltNode.textContent;
            }

            if (!elotteLevoSzo.includes('Pl.') && !elotteLevoSzo.includes('(')) {
                if (!link.classList.contains('hatarozo-vegpont-btn')) {
                    const tisztaFajnev = link.textContent.replace(/^[→\s\xA0]+/, '').replace(/[→\s\xA0]+$/, '').trim() || title;

                    link.innerHTML = `<span class="arrow-prefix">→ </span><span class="botanical-name">${tisztaFajnev}</span>`;
                    link.classList.add("hatarozo-vegpont-btn");

                    if (link.parentElement.tagName.toLowerCase() === 'i') {
                        link.parentElement.style.fontStyle = "normal";
                    }
                }

                if (vizsgaltNode && vizsgaltNode.nodeType === Node.TEXT_NODE) {
                    vizsgaltNode.textContent = vizsgaltNode.textContent.replace(/[→\s\xA0&rarr;]+$/, '');
                }
            }
        });
    });
});

/**
 * ============================================================================
 * GLOBÁLIS, ÖSSZEFÜGGŐ DINAMIKUS LIGHTGALLERY (Minden képet egy galériába fűz)
 * ============================================================================
 */
window.addEventListener('click', function(e) {
    // Elkapjuk az összes lehetséges képlinket (Natív MediaWiki, Előkészített egyedi külső, és régi dinamikus galéria)
    var targetLink = e.target.closest('a.mw-file-description, a.image, a.lg-egyedi-kulso-item, a.lg-dinamikus-item');
    if (!targetLink) return;

    // Fájl leíró oldalakon hagyjuk a gyári működést
    if (window.location.pathname.includes('/wiki/F%C3%A1jl:') || window.location.pathname.includes('/wiki/File:')) {
        return;
    }

    // Elfojtjuk a gyári átirányítást és eseményeket
    e.preventDefault();
    e.stopPropagation();
    e.stopImmediatePropagation();

    var dynamicSlides = [];
    var clickedIndex = 0;

    // Szelektáljuk az ÖSSZES képlinket az oldalon a megjelenés sorrendjében
    var $mindenKepA = $('a.mw-file-description, a.image, a.lg-egyedi-kulso-item, a.lg-dinamikus-item');

    $mindenKepA.each(function(index) {
        var $el = $(this);
        var $img = $el.find('img');

        // JAVÍTVA: Ha külső egyedi galéria elemről van szó, nem kötelező az <img> tag jelenléte!
        if ($img.length === 0 && !$el.hasClass('lg-egyedi-kulso-item')) return;

        if ($el.is(targetLink)) {
            clickedIndex = dynamicSlides.length; // Pontos index elmentése a dinamikus tömbben
        }

        var origSrc = '';
        var thumbSrc = $img.attr('src') || '';
        var captionText = '';

        // 1. ESET: Előkészített egyedi külső URL / Commons doboz kép (Nincs kötelező <img> tag!)
        if ($el.hasClass('lg-egyedi-kulso-item')) {
            origSrc = $el.attr('data-src');
            thumbSrc = origSrc; // Indexképként is a külső forrást használjuk, mivel nincs helyi thumb
            captionText = $el.attr('data-sub-html') || '';
        }
        // 2. ESET: Régi dinamikus (Commons search) galéria elem
        else if ($el.hasClass('lg-dinamikus-item')) {
            origSrc = $el.attr('data-src');
            captionText = $el.attr('data-sub-html') || '';
        }
        // 3. ESET: Natív cikkbeli kép (Hagyományos MediaWiki galéria vagy <figure>)
        else {
            // Intelligens URL tisztítás az eredeti képhez
            origSrc = thumbSrc;
            if (origSrc.indexOf('/thumb/') !== -1) {
                origSrc = origSrc.replace('/thumb/', '/');
                if (origSrc.lastIndexOf('/') !== -1) {
                    origSrc = origSrc.substring(0, origSrc.lastIndexOf('/'));
                }
            }

            // Képaláírás kinyerése
            var nativeEl = $el[0];
            if (nativeEl) {
                var figure = nativeEl.closest('figure, .thumb');
                if (figure) {
                    var figcaption = figure.querySelector('figcaption, .thumbcaption');
                    if (figcaption) {
                        captionText = figcaption.textContent.replace(/×/g, '').trim();
                    }
                }
            }
            if (!captionText) {
                captionText = $img.attr('alt') || $img.attr('title') || '';
            }
            if (captionText) {
                captionText = '<h4>' + captionText + '</h4>';
            }
        }

        dynamicSlides.push({
            src: origSrc,
            thumb: thumbSrc,
            subHtml: captionText
        });
    });

    // LightGallery indítása az összesített tömbbel
    if (window.lightGallery && dynamicSlides.length > 0) {
        var container = document.createElement('div');
        var dynamicGallery = lightGallery(container, {
            dynamic: true,
            dynamicEl: dynamicSlides,
            licenseKey: '0000-0000-000-0000',
            thumbnail: true,
            animateThumb: true,
            showThumbByDefault: true,
            index: clickedIndex,
            download: true,
            counter: dynamicSlides.length > 1,
            getCaptionFromTitleOrAlt: false
        });

        dynamicGallery.openGallery();
    } else {
        console.error("LightGallery hiba: Nem sikerült elindítani a globális galériát.");
    }
}, true); // Capturing fázis!