Difference between revisions of "MediaWiki:Common.js"

From 2value wiki 2
Jump to navigation Jump to search
 
Line 3: Line 3:
 
//change default from Go to Search
 
//change default from Go to Search
 
//
 
//
+
/* this won't work if jquery isn't loaded so I've disabled it for the time being [[User:Bvredeling|Bas]] 13:15, 6 December 2010 (CET)
 
$(document).ready(
 
$(document).ready(
 
   function ()
 
   function ()
Line 30: Line 30:
 
       $goBtn.css('display', "none");
 
       $goBtn.css('display', "none");
 
   });
 
   });
 +
*/

Latest revision as of 13:15, 6 December 2010

/* Any JavaScript here will be loaded for all users on every page load. */
//
//change default from Go to Search
//
/* this won't work if jquery isn't loaded so I've disabled it for the time being [[User:Bvredeling|Bas]] 13:15, 6 December 2010 (CET) 
$(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");
  });
*/