„MediaWiki:Common.js” változatai közötti eltérés
Innen: Sanctum2 Wikipédia
Ugrás a navigációhozUgrás a kereséshez
(Új oldal, tartalma: „// MediaWiki:Common.js $(document).ready(function() { // Add search box $('table.wikitable').before('<input type="text" id="tableSearch" placeholder="Keresés név alapján" style="margin-bottom:10px;">'); $('#tableSearch').on('keyup', function() { var value = $(this).val().toLowerCase(); $('table.wikitable tr').filter(function() { $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); }); }); //…”) |
Nincs szerkesztési összefoglaló |
||
1. sor: | 1. sor: | ||
// | // Keresőmező hozzáadása | ||
$(document).ready(function() { | $(document).ready(function() { | ||
var searchBox = $('<div style="position: sticky; top: 10px; background: #333; padding: 10px; border-radius: 5px; z-index: 1000;">' + | |||
'<label for="searchInput" style="color: #fff; font-size: 1.2em; margin-right: 10px;">Keresés tárgynév alapján:</label>' + | |||
'<input type="text" id="searchInput" placeholder="Írd be a tárgy nevét..." style="padding: 5px; border-radius: 5px; border: 1px solid #72716F;">' + | |||
'</div>'); | |||
$('# | $('body').prepend(searchBox); | ||
var | |||
$('table.wikitable tr'). | $('#searchInput').on('input', function() { | ||
$(this). | var searchTerm = $(this).val().toLowerCase(); | ||
$('table.wikitable tr').each(function() { | |||
var itemName = $(this).find('td:nth-child(2)').text().toLowerCase(); | |||
if (itemName.includes(searchTerm)) { | |||
$(this).show(); | |||
} else { | |||
$(this).hide(); | |||
} | |||
}); | }); | ||
}); | }); | ||
}); | }); |
A lap 2024. június 24., 09:25-kori változata
// Keresőmező hozzáadása $(document).ready(function() { var searchBox = $('<div style="position: sticky; top: 10px; background: #333; padding: 10px; border-radius: 5px; z-index: 1000;">' + '<label for="searchInput" style="color: #fff; font-size: 1.2em; margin-right: 10px;">Keresés tárgynév alapján:</label>' + '<input type="text" id="searchInput" placeholder="Írd be a tárgy nevét..." style="padding: 5px; border-radius: 5px; border: 1px solid #72716F;">' + '</div>'); $('body').prepend(searchBox); $('#searchInput').on('input', function() { var searchTerm = $(this).val().toLowerCase(); $('table.wikitable tr').each(function() { var itemName = $(this).find('td:nth-child(2)').text().toLowerCase(); if (itemName.includes(searchTerm)) { $(this).show(); } else { $(this).hide(); } }); }); });