MediaWiki:Common.js: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
Line 93: Line 93:
      
      
     function updateBorder() {
     function updateBorder() {
    // Count the number of visible items
        console.log("Running updateBorder function");
    var visibleItems = $('#list-list div.filtered-list-item').filter(function() {
 
        return $(this).css('display') !== 'none';
        // Remove the border from all items first
    });
        $('#list-list div.filtered-list-item').css('border-bottom', 'none');
        console.log("Removed bottom border from all items");
    // If there's only one visible item, add the border
 
    if (visibleItems.length === 1) {
        // Count the number of visible items
        visibleItems.css('border-bottom', '1px solid black');
        var visibleItems = $('#list-list div.filtered-list-item').filter(function() {
    }
            return $(this).css('display') !== 'none';
}
        });
        console.log("Number of visible items:", visibleItems.length);
 
        // If there's only one visible item, add the border
        if (visibleItems.length === 1) {
            visibleItems.css('border-bottom', '1px solid black');
            console.log("Added bottom border to the single visible item");
        } else {
            console.log("More than one item visible, no bottom border added");
        }
    }


// Run the function on page load
// Run the function on page load

Navigation menu