MediaWiki:Common.js

Revision as of 22:30, 7 April 2025 by TheRoman (talk | contribs)

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.
/* Any JavaScript here will be loaded for all users on every page load. */
mw.loader.load( 'ext.cite.styles' );

$(document).ready(function() {
  $('.dismissible-notice .dismiss-button').click(function() {
    $(this).closest('.dismissible-notice').hide();
  });
});


$(function() {
  if (mw.config.get('wgCanonicalSpecialPageName') === 'Editcount') {
    var $editCountForm = $('form[name="editcount"]'); // Adjust selector if needed

    $editCountForm.on('submit', function(e) {
      e.preventDefault(); // Prevent the default form submission
      var username = $(this).find('input[name="wpUsername"]').val();
      if (username) {
        window.location.href = mw.config.get('wgScriptPath') + '/index.php?title=Special:EditCount/' + encodeURIComponent(username);
      }
    });
  }
});