MediaWiki:Common.js: Difference between revisions

From GrinderScape Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:


$(document).ready(function() {
$(document).ready(function() {
     // Target the row with ID 'wiki-manager'
     // Select the Wiki Manager row and the table
     var wikiManagerRow = $('#wiki-manager');
     var wikiManagerRow = $('#wiki-manager');
    var table = wikiManagerRow.closest('table');
      
      
     // Find the closest table and tbody
     // Check if the header is in the correct position
     var tableBody = wikiManagerRow.closest('table').find('tbody');
     var header = table.find('thead');
    if (header.length && header.parent().children('thead').length > 0) {
        // Ensure header stays at the top
        table.prepend(header);
    }
      
      
     // Check if the header is at the top
     // Move the Wiki Manager row to the top of the tbody
     var tableHeader = wikiManagerRow.closest('table').find('thead');
     var tbody = table.find('tbody');
 
     wikiManagerRow.prependTo(tbody);
     // Ensure the header stays at the top
    if (tableHeader.length && tableHeader.offset().top !== 0) {
        tableHeader.prependTo(tableHeader.closest('table'));
    }
 
    // Move the 'wiki-manager' row to the top of the tbody
    wikiManagerRow.prependTo(tableBody);
});
});

Revision as of 00:04, 22 March 2025

/* Load dependencies */
// mw.loader.load('https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css', 'text/css');

/* Remove unessecary footer text */
$(document).ready(function() {
    var footerInfo = document.getElementById("footer-info-credits");
    if (footerInfo) {
        footerInfo.innerHTML = footerInfo.innerHTML.replace("GrinderScape Wiki user", "");
    }
});

$(document).ready(function() {
    // Select the Wiki Manager row and the table
    var wikiManagerRow = $('#wiki-manager');
    var table = wikiManagerRow.closest('table');
    
    // Check if the header is in the correct position
    var header = table.find('thead');
    if (header.length && header.parent().children('thead').length > 0) {
        // Ensure header stays at the top
        table.prepend(header);
    }
    
    // Move the Wiki Manager row to the top of the tbody
    var tbody = table.find('tbody');
    wikiManagerRow.prependTo(tbody);
});