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.
// Only run for MinervaNeue
if ( mw.config.get('skin') === 'minerva' ) {
    mw.hook('wikipage.content').add(function($content) {
        // Remove "Category:" prefix from all links inside content
        $content.find('a').each(function() {
            var $link = $(this);
            if ( $link.attr('href') && $link.attr('href').includes('/Category:') ) {
                $link.text($link.text().replace(/^Category:/, ''));
            }
        });
    });

    // Remove prefix from category page headers
    $(document).ready(function() {
        $('.minerva-header .ns-category, .page-heading .ns-category, .mw-page-title-namespace').hide();
    });

    // Observe for dynamically injected content (e.g., forms/templates)
    const observer = new MutationObserver(function(mutations) {
        mutations.forEach(function() {
            $('.minerva-header .ns-category, .page-heading .ns-category, .mw-page-title-namespace').hide();
            $('a').each(function() {
                var $link = $(this);
                if ($link.attr('href') && $link.attr('href').includes('/Category:')) {
                    $link.text($link.text().replace(/^Category:/, ''));
                }
            });
        });
    });
    observer.observe(document.body, { childList: true, subtree: true });
}

mw.hook('wikipage.content').add(function($content) {
    $content.find('a[href*="/Category:"]').each(function() {
        $(this).text($(this).text().replace(/^Category:/, ''));
    });
});