„MediaWiki:Common.js” változatai közötti eltérés
Megjelenés
Nincs szerkesztési összefoglaló |
Nincs szerkesztési összefoglaló |
||
| 1. sor: | 1. sor: | ||
/* | /** | ||
* ============================================================================ | |||
* LIGHTGALLERY GLOBÁLIS INTEGRÁCIÓ (Régi dynamic és új vegyes galéria) | |||
* ============================================================================ | |||
*/ | |||
(function() { | (function() { | ||
// | // 1. LÉPÉS: Ellenőrizzük, hogy BÁRMELYIK galéria típus létezik-e az oldalon. Ha egyik sincs, csak akkor állunk le. | ||
if ($('.wiki-dynamic-gallery').length === 0) return; | if ($('.wiki-dynamic-gallery').length === 0 && $('.egyedi-galeria-container').length === 0) return; | ||
// Erőforrások betöltése mw.loader-rel | // Erőforrások betöltése mw.loader-rel (Csak egyszer fut le az oldalon) | ||
mw.loader.addStyleTag('@import "https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/css/lightgallery-bundle.min.css";'); | mw.loader.addStyleTag('@import "https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/css/lightgallery-bundle.min.css";'); | ||
// LightGallery mag betöltése | |||
$.getScript('https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/lightgallery.umd.min.js') | $.getScript('https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/lightgallery.umd.min.js') | ||
.done(function() { | .done(function() { | ||
console.log('LightGallery 2.4.0 | console.log('LightGallery 2.4.0 sikeresen betöltve.'); | ||
initWikiDynamicGallery(); | |||
// Ha a régi típusú galéria van az oldalon, elindítjuk | |||
if ($('.wiki-dynamic-gallery').length > 0) { | |||
initWikiDynamicGallery(); | |||
} | |||
// Ha az új típusú vegyes galéria van az oldalon, elindítjuk | |||
if ($('.egyedi-galeria-container').length > 0) { | |||
initMindenGaleriaElem(); | |||
} | |||
}); | }); | ||
// --- RÉGI WIKI DYNAMIC GALLERY LOGIKA --- | |||
function initWikiDynamicGallery() { | function initWikiDynamicGallery() { | ||
$('.wiki-dynamic-gallery').each(function() { | $('.wiki-dynamic-gallery').each(function() { | ||
| 50. sor: | 65. sor: | ||
} | } | ||
} | } | ||
}); | |||
}); | |||
} | |||
// --- ÚJ VEGYES GALÉRIA LOGIKA --- | |||
function initMindenGaleriaElem() { | |||
$('.egyedi-galeria-container').each(function() { | |||
var $container = $(this); | |||
if ($container.data('vegyes-initialized')) return; | |||
$container.data('vegyes-initialized', true); | |||
// A külső URL és Commons képek dinamikus injektálása | |||
$container.find('.kulso-url-doboz').each(function() { | |||
var $doboz = $(this); | |||
var imgUrl = $doboz.attr('data-src'); | |||
var felirat = $doboz.find('.galeria-felirat').text() || ''; | |||
var $lgItem = $('<a>', { | |||
'href': imgUrl, | |||
'class': 'lg-vegyes-item', | |||
'data-src': imgUrl, | |||
'data-sub-html': '<h4>' + felirat + '</h4>' | |||
}); | |||
$('<img>', { | |||
'src': imgUrl, | |||
'class': 'galeria-kep url-kep', | |||
'alt': felirat | |||
}).appendTo($lgItem); | |||
$doboz.prepend($lgItem); | |||
$doboz.find('.url-link-szoveg').remove(); | |||
}); | |||
// A helyi MediaWiki képek (Lithops-ok) előkészítése | |||
$container.find('.thumbimage').each(function() { | |||
var $img = $(this); | |||
var imgSrc = $img.attr('src'); | |||
// Visszafejtjük az eredeti nagy kép URL-jét a thumbból | |||
var origSrc = imgSrc; | |||
if (imgSrc.indexOf('/thumb/') !== -1) { | |||
origSrc = imgSrc.replace('/thumb/', '/').substring(0, imgSrc.replace('/thumb/', '/').lastIndexOf('/')); | |||
} | |||
var $a = $img.closest('a'); | |||
var $caption = $a.closest('.thumbinner').find('.thumbcaption'); | |||
var captionHtml = $caption.length ? '<h4>' + $caption.text().trim() + '</h4>' : ''; | |||
// Átalakítjuk a gyári linket LightGallery kompatibilissé | |||
$a.addClass('lg-vegyes-item') | |||
.attr('data-src', origSrc) | |||
.attr('data-sub-html', captionHtml) | |||
.on('click', function(e) { | |||
e.preventDefault(); // Ne navigáljon el a MediaWiki leírólapra | |||
}); | |||
}); | |||
// EGYETLEN inicializálás az ÖSSZES előkészített elemre (1-7 kép egyben) | |||
lightGallery($container[0], { | |||
selector: '.lg-vegyes-item', | |||
licenseKey: '0000-0000-000-0000', | |||
thumbnail: true, | |||
animateThumb: true, | |||
showThumbByDefault: true | |||
}); | }); | ||
}); | }); | ||
| 55. sor: | 135. sor: | ||
})(); | })(); | ||
/** | |||
/ | * ============================================================================ | ||
* KIEGÉSZÍTŐIKONOK ÉS STÍLUSLAPOK BETÖLTÉSE | |||
* ============================================================================ | |||
*/ | |||
var link = document.createElement("link"); | var link = document.createElement("link"); | ||
link.rel = "stylesheet"; | link.rel = "stylesheet"; | ||
link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css"; | link.href = "https://cdn.jsdelivr.net/npm/bootstrap-icons@1.13.1/font/bootstrap-icons.min.css"; | ||
document.head.appendChild(link); | document.head.appendChild(link); | ||
/* | /** | ||
* ============================================================================ | |||
* JOGOSULTSÁGKEZELÉS (Fülek elrejtése anonim felhasználóknak) | |||
* ============================================================================ | |||
*/ | |||
if (mw.config.get('wgUserName') === null) { | if (mw.config.get('wgUserName') === null) { | ||
var hideTabs = function () { | var hideTabs = function () { | ||
| 72. sor: | 157. sor: | ||
if (el2) el2.style.display = 'none'; | if (el2) el2.style.display = 'none'; | ||
if (el1 || el2) clearInterval(observer); | if (el1 || el2) clearInterval(observer); | ||
}; | }; | ||
var observer = setInterval(hideTabs, 100); | var observer = setInterval(hideTabs, 100); | ||
} | } | ||
/* | /** | ||
* ============================================================================ | |||
* KÜLSŐ LINK VISLEKEDÉS (Új lapon nyíló külső hivatkozások) | |||
* ============================================================================ | |||
*/ | |||
$(function () { | $(function () { | ||
$('a.external').attr('target', '_blank'); | |||
}); | }); | ||
/ | /** | ||
* ============================================================================ | |||
* NAVIGÁCIÓS GOMBOK (Tetejére és Vissza gomb logikája) | |||
* ============================================================================ | |||
*/ | |||
$(function() { | $(function() { | ||
// | // Tetejére gomb létrehozása | ||
var $btn = $('<button/>', { | var $btn = $('<button/>', { | ||
html: '<i class="bi bi-arrow-up-square"></i> Tetejére', | html: '<i class="bi bi-arrow-up-square"></i> Tetejére', | ||
id: 'backToTopBtn', | id: 'backToTopBtn', | ||
| 105. sor: | 193. sor: | ||
'border-radius': '10px', | 'border-radius': '10px', | ||
cursor: 'pointer', | cursor: 'pointer', | ||
display: 'none', | display: 'none', | ||
width: '100px', | width: '100px', | ||
'z-index': 1000 | 'z-index': 1000 | ||
| 114. sor: | 202. sor: | ||
}); | }); | ||
// Vissza gomb létrehozása | // Vissza gomb létrehozása | ||
var $backBtn = $('<button/>', { | var $backBtn = $('<button/>', { | ||
html: '<i class="bi bi-arrow-left-square"></i> Vissza', | html: '<i class="bi bi-arrow-left-square"></i> Vissza', | ||
id: 'backBtn', | id: 'backBtn', | ||
| 137. sor: | 209. sor: | ||
css: { | css: { | ||
position: 'fixed', | position: 'fixed', | ||
bottom: '60px', | bottom: '60px', | ||
right: '20px', | right: '20px', | ||
padding: '10px 15px', | padding: '10px 15px', | ||
| 155. sor: | 227. sor: | ||
}); | }); | ||
$('body').append($btn).append($backBtn); | |||
$('body').append($backBtn); | |||
// | // Gombok láthatóságának kezelése görgetéskor | ||
$(window).scroll(function() { | $(window).scroll(function() { | ||
if ($(window).scrollTop() > 100) { | if ($(window).scrollTop() > 100) { | ||
$btn.fadeIn(); | |||
$backBtn.fadeIn(); | $backBtn.fadeIn(); | ||
} else { | } else { | ||
$btn.fadeOut(); | |||
$backBtn.fadeOut(); | $backBtn.fadeOut(); | ||
} | } | ||
| 168. sor: | 241. sor: | ||
}); | }); | ||
/* | /** | ||
* ============================================================================ | |||
* TAXOBOX ÉS RENDSZERTANI LINKEK KEZELÉSE | |||
* ============================================================================ | |||
*/ | |||
$(document).ready(function() { | $(document).ready(function() { | ||
$('.taxobox-icons a').attr('target', '_blank'); | $('.taxobox-icons a').attr('target', '_blank'); | ||
| 174. sor: | 251. sor: | ||
/** | /** | ||
* | * ============================================================================ | ||
* DATATABLES INTEGRÁCIÓ (Javított táblázatkezelés) | |||
* ============================================================================ | |||
*/ | */ | ||
mw.loader.using( ['jquery', 'mediawiki.util'] ).done( function () { | mw.loader.using( ['jquery', 'mediawiki.util'] ).done( function () { | ||
if ( $( '.datatable-hook' ).length > 0 ) { | if ( $( '.datatable-hook' ).length > 0 ) { | ||
$.getScript( 'https://cdn.datatables.net/2.1.8/js/dataTables.min.js' ) | $.getScript( 'https://cdn.datatables.net/2.1.8/js/dataTables.min.js' ) | ||
.done( function() { | .done( function() { | ||
$( '.datatable-hook' ).each( function() { | $( '.datatable-hook' ).each( function() { | ||
var $table = $(this); | var $table = $(this); | ||
var $headerRow = $table.find( 'tr:has(th)' ).first(); | var $headerRow = $table.find( 'tr:has(th)' ).first(); | ||
if ( $headerRow.length > 0 ) { | if ( $headerRow.length > 0 ) { | ||
var $thead = $( '<thead></thead>' ); | var $thead = $( '<thead></thead>' ); | ||
$headerRow.detach().appendTo( $thead ); | $headerRow.detach().appendTo( $thead ); | ||
| 198. sor: | 269. sor: | ||
} | } | ||
$table.DataTable({ | $table.DataTable({ | ||
language: { | language: { | ||
| 210. sor: | 280. sor: | ||
}, | }, | ||
pageLength: 10, | pageLength: 10, | ||
columnDefs: [ { targets: '_all', defaultContent: '' } ] | columnDefs: [ { targets: '_all', defaultContent: '' } ] | ||
}); | }); | ||
}); | }); | ||
}) | }) | ||
.fail( function() { | .fail( function() { | ||
| 222. sor: | 290. sor: | ||
}); | }); | ||
/** | |||
* ============================================================================ | |||
* SZUKKULENS NÖVÉNYHATÁROZÓ KULCSOK LOGIKÁJA | |||
* ============================================================================ | |||
*/ | |||
mw.hook('wikipage.content').add(function () { | mw.hook('wikipage.content').add(function () { | ||
const aktualisKategoriak = mw.config.get('wgCategories') || []; | const aktualisKategoriak = mw.config.get('wgCategories') || []; | ||
if (!aktualisKategoriak.includes('Szukkulens növényhatározó kulcsok')) { | if (!aktualisKategoriak.includes('Szukkulens növényhatározó kulcsok')) { | ||
| 232. sor: | 302. sor: | ||
const regexKoztespont = /^Szukkulens határozó:/; | const regexKoztespont = /^Szukkulens határozó:/; | ||
const bodyContent = document.getElementById('bodyContent'); | const bodyContent = document.getElementById('bodyContent'); | ||
if (!bodyContent) return; | if (!bodyContent) return; | ||
// | // Köztes határozó oldalak linkjei | ||
bodyContent.querySelectorAll('a').forEach(a => { | bodyContent.querySelectorAll('a').forEach(a => { | ||
const teljesNev = a.getAttribute('title') || ''; | const teljesNev = a.getAttribute('title') || ''; | ||
if (regexKoztespont.test(teljesNev)) { | if (regexKoztespont.test(teljesNev)) { | ||
let tisztaGombSzöveg = teljesNev.replace(/\s*\(a lap nem létezik\)$/, ''); | let tisztaGombSzöveg = teljesNev.replace(/\s*\(a lap nem létezik\)$/, ''); | ||
a.innerHTML = ''; | |||
a.innerHTML = ''; | |||
const arrowSpan = document.createElement('span'); | const arrowSpan = document.createElement('span'); | ||
| 253. sor: | 317. sor: | ||
arrowSpan.textContent = '→'; | arrowSpan.textContent = '→'; | ||
const spaceNode = document.createTextNode(' '); | const spaceNode = document.createTextNode(' '); | ||
const textNode = document.createTextNode(tisztaGombSzöveg); | const textNode = document.createTextNode(tisztaGombSzöveg); | ||
| 270. sor: | 333. sor: | ||
}); | }); | ||
// | // Határozó kulcs valódi végpontjai | ||
bodyContent.querySelectorAll('li').forEach(li => { | bodyContent.querySelectorAll('li').forEach(li => { | ||
const bendoLinkek = li.querySelectorAll('a[href*="/wiki/"]:not(.external)'); | const bendoLinkek = li.querySelectorAll('a[href*="/wiki/"]:not(.external)'); | ||
| 277. sor: | 340. sor: | ||
const title = link.getAttribute('title') || ''; | const title = link.getAttribute('title') || ''; | ||
if (regexKoztespont.test(title) || link.classList.contains('hatarozo-koztespont-btn')) { | if (regexKoztespont.test(title) || link.classList.contains('hatarozo-koztespont-btn')) { | ||
return; | return; | ||
} | } | ||
let vizsgaltNode = link.previousSibling; | let vizsgaltNode = link.previousSibling; | ||
if (link.parentElement.tagName.toLowerCase() === 'i') { | if (link.parentElement.tagName.toLowerCase() === 'i') { | ||
| 293. sor: | 354. sor: | ||
} | } | ||
if (!elotteLevoSzo.includes('Pl.') && !elotteLevoSzo.includes('(')) { | if (!elotteLevoSzo.includes('Pl.') && !elotteLevoSzo.includes('(')) { | ||
if (!link.classList.contains('hatarozo-vegpont-btn')) { | if (!link.classList.contains('hatarozo-vegpont-btn')) { | ||
const tisztaFajnev = link.textContent.replace(/^[→\s\xA0]+/, '').replace(/[→\s\xA0]+$/, '').trim() || title; | const tisztaFajnev = link.textContent.replace(/^[→\s\xA0]+/, '').replace(/[→\s\xA0]+$/, '').trim() || title; | ||
| 315. sor: | 373. sor: | ||
}); | }); | ||
}); | }); | ||
A lap 2026. június 14., 23:07-kori változata
/**
* ============================================================================
* LIGHTGALLERY GLOBÁLIS INTEGRÁCIÓ (Régi dynamic és új vegyes galéria)
* ============================================================================
*/
(function() {
// 1. LÉPÉS: Ellenőrizzük, hogy BÁRMELYIK galéria típus létezik-e az oldalon. Ha egyik sincs, csak akkor állunk le.
if ($('.wiki-dynamic-gallery').length === 0 && $('.egyedi-galeria-container').length === 0) return;
// Erőforrások betöltése mw.loader-rel (Csak egyszer fut le az oldalon)
mw.loader.addStyleTag('@import "https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/css/lightgallery-bundle.min.css";');
// LightGallery mag betöltése
$.getScript('https://cdn.jsdelivr.net/npm/lightgallery@2.4.0/lightgallery.umd.min.js')
.done(function() {
console.log('LightGallery 2.4.0 sikeresen betöltve.');
// Ha a régi típusú galéria van az oldalon, elindítjuk
if ($('.wiki-dynamic-gallery').length > 0) {
initWikiDynamicGallery();
}
// Ha az új típusú vegyes galéria van az oldalon, elindítjuk
if ($('.egyedi-galeria-container').length > 0) {
initMindenGaleriaElem();
}
});
// --- 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];
var title = pages[id].title.replace('File:', '');
galleryHtml += '<a href="' + img.url + '" class="lg-item" data-src="' + img.url + '" data-sub-html="<h4>' + title + '</h4>">';
galleryHtml += ' <img src="' + img.thumburl + '" style="height:' + targetHeight + 'px; width:auto; margin:5px; border-radius:6px; cursor:pointer;" alt="' + title + '" />';
galleryHtml += '</a>';
}
$container.html(galleryHtml);
if (window.lightGallery) {
lightGallery($container[0], {
selector: '.lg-item',
licenseKey: '0000-0000-000-0000'
});
}
}
});
});
}
// --- ÚJ VEGYES GALÉRIA LOGIKA ---
function initMindenGaleriaElem() {
$('.egyedi-galeria-container').each(function() {
var $container = $(this);
if ($container.data('vegyes-initialized')) return;
$container.data('vegyes-initialized', true);
// A külső URL és Commons képek dinamikus injektálása
$container.find('.kulso-url-doboz').each(function() {
var $doboz = $(this);
var imgUrl = $doboz.attr('data-src');
var felirat = $doboz.find('.galeria-felirat').text() || '';
var $lgItem = $('<a>', {
'href': imgUrl,
'class': 'lg-vegyes-item',
'data-src': imgUrl,
'data-sub-html': '<h4>' + felirat + '</h4>'
});
$('<img>', {
'src': imgUrl,
'class': 'galeria-kep url-kep',
'alt': felirat
}).appendTo($lgItem);
$doboz.prepend($lgItem);
$doboz.find('.url-link-szoveg').remove();
});
// A helyi MediaWiki képek (Lithops-ok) előkészítése
$container.find('.thumbimage').each(function() {
var $img = $(this);
var imgSrc = $img.attr('src');
// Visszafejtjük az eredeti nagy kép URL-jét a thumbból
var origSrc = imgSrc;
if (imgSrc.indexOf('/thumb/') !== -1) {
origSrc = imgSrc.replace('/thumb/', '/').substring(0, imgSrc.replace('/thumb/', '/').lastIndexOf('/'));
}
var $a = $img.closest('a');
var $caption = $a.closest('.thumbinner').find('.thumbcaption');
var captionHtml = $caption.length ? '<h4>' + $caption.text().trim() + '</h4>' : '';
// Átalakítjuk a gyári linket LightGallery kompatibilissé
$a.addClass('lg-vegyes-item')
.attr('data-src', origSrc)
.attr('data-sub-html', captionHtml)
.on('click', function(e) {
e.preventDefault(); // Ne navigáljon el a MediaWiki leírólapra
});
});
// EGYETLEN inicializálás az ÖSSZES előkészített elemre (1-7 kép egyben)
lightGallery($container[0], {
selector: '.lg-vegyes-item',
licenseKey: '0000-0000-000-0000',
thumbnail: true,
animateThumb: true,
showThumbByDefault: true
});
});
}
})();
/**
* ============================================================================
* 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() {
// Tetejére gomb létrehozása
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'});
}
});
// Vissza gomb létrehozása
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);
// Gombok láthatóságának kezelése görgetéskor
$(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;
// Köztes határozó oldalak linkjei
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→]+$/, '');
}
}
});
// Határozó kulcs valódi végpontjai
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→]+$/, '');
}
}
});
});
});