User:Guarapiranga/search-shortcuts.js

// Fork of User:Enterprisey/search-shortcuts.js that can be customised by declaring the shortcuts where it's imported

/* */ var expansions; $( document ).ready( function {   $( "#searchInput" ).on( "keydown", function( event ) { if( event.key === "/" || event.key === ":" ) { var val = $( this ).val.toLowerCase; if( expansions[val] ) $( this ).val( expansions[val] ); } else if( $( this ).val.trim.indexOf( "{{" ) === 0 ) if( $( this ).val.trim.indexOf( "{{#" ) === 0 ) if( $( this ).val.trim.indexOf( "{{#invoke:" ) === 0 ) $( this ).val( $( this ).val.replace( "{{#invoke:", "Module:" ).replace( /\s*\|.*/, "" ).replace( "}}", "" ) ); else $( this ).val( $( this ).val.replace( "{{#", "H:MW#" ).replace( /\s*\|.*/, "" ).replace( "}}", "" ) ); else $( this ).val( $( this ).val.replace( "{{", "Template:" ).replace( /\s*\|.*/, "" ).replace( "}}", "" ) ); } ); } ); /* */