„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
Nincs szerkesztési összefoglaló
Nincs szerkesztési összefoglaló
12. sor: 12. sor:
             $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
             $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
         });
         });
    });
    // Fix search box position
    var searchBox = $('#searchBox');
    $(window).scroll(function() {
        var offset = searchBox.offset().top - $(window).scrollTop();
        if (offset < 0) {
            searchBox.css({
                'position': 'fixed',
                'top': '0',
                'left': '0',
                'background-color': '#000',
                'color': '#fff',
                'z-index': '1000',
                'width': '100%',
                'padding': '10px',
                'border-radius': '0'
            });
        } else {
            searchBox.css({
                'position': 'static',
                'width': 'auto',
                'padding': '10px',
                'border-radius': '5px'
            });
        }
     });
     });
});
});

A lap 2024. június 24., 09:27-kori változata

// MediaWiki:Common.js
$(document).ready(function() {
    // Add search box with styled input
    $('table.wikitable').before('<div id="searchBox" style="margin-bottom: 10px; padding: 10px; background-color: #333; border-radius: 5px;">' +
                                '<label for="tableSearch" style="color: #fff; font-size: 1.2em; margin-right: 10px;">Keresés név alapján:</label>' +
                                '<input type="text" id="tableSearch" placeholder="Írd be a tárgy nevét..." style="padding: 5px; border-radius: 5px; border: 1px solid #72716F; color: #333;">' +
                                '</div>');

    $('#tableSearch').on('keyup', function() {
        var value = $(this).val().toLowerCase();
        $('table.wikitable tr').filter(function() {
            $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
        });
    });
});