MediaWiki:Common.js

From ConfIDent

Note: After saving, 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: Go to Menu → Settings (Opera → Preferences on a Mac) and then to Privacy & security → Clear browsing data → Cached images and files.
// Disable search suggestions.
// Do this by overwriting the method responsible for fetching the suggestions.
// As the module mediawiki.searchSuggest is only loaded lazily, load it right now to be able to fix the method.
mw.loader.using('mediawiki.searchSuggest', function replaceRequestByNoop() {
  mw.searchSuggest.request = function () {
    const result = Promise.resolve();
    result.abort = function() {};
    result.done = function() {};
    return result;
  };
});

// Automatically append an asterisk to the search term if it does not contain an asterix or double quotes.
$('#searchInput, #searchText input').each(function(_, input) {
  const $input = $(input);
  $input.closest('form').on('submit', function appendAsterixToSearchInput(event) {
    const value = $input.val();
    const isPowerUser = value.includes('*') || value.includes('"');
    if (!isPowerUser) {
      $input.val(value + '*');
    }
  });
});
Cookies help us deliver our services. By using our services, you agree to our use of cookies.