MediaWiki:Common.js
Revision as of 12:01, 6 December 2010 by Bvredeling (talk | contribs)
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: 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.
/* Any JavaScript here will be loaded for all users on every page load. */
//
//change default from Go to Search
//
$j(document).ready(
function ()
{
// Classic skin has no IDs on the buttons, just names! And CologneBlue and Classic have
// two search forms.
var $searchBtn = $('#searchform #mw-searchButton, #searchform2 #mw-searchButton, #searchform input[name=fulltext], #searchform2 input[name=fulltext]');
var $goBtn = $('#searchform #searchGoButton, #searchform2 #searchGoButton2, #searchform input[name=go], #searchform2 input[name=go]');
var $textfield = $('#searchform #searchInput, #searchform2 #searchInput2, #searchform input[name=searchInput], #searchform2 input[name=searchInput2]');
$textfield.keydown(function (evt) {
var e = evt || window.event;
var key = (typeof (e.keyCode) != 'undefined' ? e.keyCode : e.which);
if (key == 13) { // Enter
$searchBtn.click ();
return false;
}
});
// Indicate default visually. Changing the style of a button works also in IE. (However,
// Safari seems to ignore this).
$goBtn.css('fontWeight', "normal");
$searchBtn.css('fontWeight', "bold");
// hide go button
$goBtn.css('display', "none");
});