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() {
     // Select the Wiki Manager row and the table
     // Get the top row (header) and store it
    var headerRow = $('table tr:first');
   
    // Target the Wiki Manager row
     var wikiManagerRow = $('#wiki-manager');
     var wikiManagerRow = $('#wiki-manager');
    var table = wikiManagerRow.closest('table');
      
      
     // Move the Wiki Manager row to the top of the tbody
     // Move Wiki Manager row to the top of the table body
     var tbody = table.find('tbody');
     var tableBody = wikiManagerRow.closest('table').find('tbody');
     wikiManagerRow.prependTo(tbody);
     wikiManagerRow.prependTo(tableBody);
      
      
     // Check if the header is in the correct position
     // Move the saved header row back to the top
     var header = table.find('thead');
     headerRow.prependTo(tableBody.closest('table').find('thead'));
    if (header.length && header.parent().children('thead').length > 0) {
        // Ensure header stays at the top
        table.prepend(header);
    }
});
});

Revision as of 00:06, 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() {
    // Get the top row (header) and store it
    var headerRow = $('table tr:first');
    
    // Target the Wiki Manager row
    var wikiManagerRow = $('#wiki-manager');
    
    // Move Wiki Manager row to the top of the table body
    var tableBody = wikiManagerRow.closest('table').find('tbody');
    wikiManagerRow.prependTo(tableBody);
    
    // Move the saved header row back to the top
    headerRow.prependTo(tableBody.closest('table').find('thead'));
});