MediaWiki:Gadget-search-new-tab.js
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.
/* JSHint-valid */ /* globals $:false */ $(function() { // Special:Search for all skins. $('#powersearch, #search').on('keydown', function(e) { $(this).prop('target', e.ctrlKey || e.metaKey ? '_blank' : ''); }); // CodexTypeaheadSearch header search [only on Vector (2022)]. $('#p-search').on('keydown', '.cdx-typeahead-search #searchform', function(e) { if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) { var URI = $(this).find('.cdx-menu-item--selected a.cdx-menu-item__content').prop('href'); if (URI != undefined) { window.open(URI, '_blank'); return false; } } }); // Header/Side search on other skins [no auto suggest nav on MinervaNeue]. // Search box [auto suggest on Vector legacy (2010), MonoBook, Timeless]. $('div:not(.cdx-typeahead-search) #searchform #searchInput, .searchbox .mw-searchInput').on('keydown', function(e) { if ((e.ctrlKey || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) { if ($(this).data('suggestionsContext') != undefined) { var selectedIndex = $(this).data('suggestionsContext').config.suggestions.indexOf($(this).val()); if (selectedIndex != -1) { var URI = $('.suggestions-results a:nth-child(' + (selectedIndex + 1) + ')').prop('href'); if (URI != undefined) { window.open(URI, '_blank'); $(this).trigger('blur'); } } } } }); });