MediaWiki:Common.js

From Artifacts of Capitalism
Revision as of 20:27, 14 July 2025 by Abrano (talk | contribs) (Created page with "mw.loader.using('mediawiki.util', function () { $(function () { // Only proceed if user is logged in if (!mw.config.get('wgUserName')) return; // Target the dropdown container (the blue guy menu) const personalToolsList = $('.cmln-personal-tools ul'); if (personalToolsList.length) { // Define custom links const links = [ { href: '/index.php?title=Special:Upload', label: 'Upload a File' }, {...")
(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)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
mw.loader.using('mediawiki.util', function () {
  $(function () {
    // Only proceed if user is logged in
    if (!mw.config.get('wgUserName')) return;

    // Target the dropdown container (the blue guy menu)
    const personalToolsList = $('.cmln-personal-tools ul');

    if (personalToolsList.length) {
      // Define custom links
      const links = [
        {
          href: '/index.php?title=Special:Upload',
          label: 'Upload a File'
        },
        {
          href: '/index.php?title=Special:ListFiles',
          label: 'All Files'
        },
        {
          href: '/index.php?title=Help:Contents',
          label: 'Help'
        },
        {
          href: '/index.php?title=Special:SpecialPages',
          label: 'Special pages'
        }
      ];

      // Inject each link into the dropdown
      links.forEach(link => {
        const li = $('<li>')
          .addClass('mw-list-item')
          .append(
            $('<a>')
              .attr('href', link.href)
              .text(link.label)
          );
        personalToolsList.append(li);
      });
    }
  });
});