FANDOM


Both of these go in the "MediaWiki:Common.js". If you prefer you can add them to a separate page and then import them. Instructions for this are at the bottom of the page.

The first bit of code redirects searches through Monobook, to check if the page name exists and directs you to that page. It takes a few seconds to kick in after landing at the search results.

$(function() {
	if (wgCanonicalSpecialPageName == 'Search') {
		if ((document.location.search.match('go=Go') || document.location.search.match('fulltext=0')) && $('.searchresults > div > strong').length) {
			var pagename = $('.searchresults > div > strong a').attr('href');
console.log(pagename)
		document.location.href = pagename;
		}
	}
})


This next bit of code is based on Konami. Essentially it allows you to create keyboard shortcuts that will then redirect you to the page you desire. It is currently set up for Special:SpecialPages, with the input being "\\\".

/*** BEGIN KONAMI CODE ***/
 
var Konami = function() {
	var konami= {
			addEvent:function ( obj, type, fn, ref_obj )
			{
				if (obj.addEventListener)
					obj.addEventListener( type, fn, false );
				else if (obj.attachEvent)
				{
					// IE
					obj["e"+type+fn] = fn;
					obj[type+fn] = function() { obj["e"+type+fn]( window.event,ref_obj ); }
 
					obj.attachEvent( "on"+type, obj[type+fn] );
				}
			},
	        input:"",
	        pattern:"220220220",
		/*pattern:"220220220",*/
	        load: function(link) {	
 
				this.addEvent(document,"keydown", function(e,ref_obj) {											
					if (ref_obj) konami = ref_obj; // IE
					konami.input+= e ? e.keyCode : event.keyCode;
					if (konami.input.length > konami.pattern.length) konami.input = konami.input.substr((konami.input.length - konami.pattern.length));
					if (konami.input == konami.pattern) {
                    konami.code(link);
					konami.input="";
                   	return;
                    }
            	},this); 
				},
	        code: function(link) { window.location=link},
	}
	return konami;
}
 
        konami = new Konami()
        konami.load("http://merlin.wikia.com/wiki/Special:SpecialPages");
 
/*** END KONAMI CODE ***/


To alter the input keys you edit:

	        pattern:"220220220",
		/*pattern:"220220220",*/


A list of the codes can be seen here. the correct key codes are listed under the "Key code" column. The page that it landed on can be changed by altering:

        konami = new Konami()
        konami.load("http://runescape.wikia.com/wiki/Special:SpecialPages");


To import the code, create a page such as "MediaWiki:Common.js/search.js", the subpage must use lower case as it's starting letter, add the code and then add:

/* Search fixes */
importScript('MediaWiki:Common.js/search.js');


To the Common.js.


Hope this helps, Cqm  01:14, April 27, 2012 (UTC)

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.