MediaWiki:Common.js

MediaWiki interface page
Revision as of 23:32, 1 June 2024 by Software2 (talk | contribs) (Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: $(document).ready(function() { if (mw.config.get('wgPageName') === 'Main_Page') { var title = $('#firstHeading').detach(); var editLink = $('#ca-edit').detach(); var otherLinks = $('#p-cactions').detach(); // Append elements to the content bottom $('#bodyContent').append('<div class="mainpage-elements"></div>'); $('.mainpage-elements').a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
  • Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */
$(document).ready(function() {
    if (mw.config.get('wgPageName') === 'Main_Page') {
        var title = $('#firstHeading').detach();
        var editLink = $('#ca-edit').detach();
        var otherLinks = $('#p-cactions').detach();
        
        // Append elements to the content bottom
        $('#bodyContent').append('<div class="mainpage-elements"></div>');
        $('.mainpage-elements').append(title).append(editLink).append(otherLinks);

        // Additional styling if needed
        $('.mainpage-elements').css({
            'margin-top': '20px',
            'text-align': 'center' // or any other styling you prefer
        });
    }
});