User:Qwerfjkl/scripts/search-shortcuts.js

// Fork of 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 {  $( document.getElementsByClassName('cdx-text-input__input cdx-text-input__input--has-value')[0] ).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( "}}", "" ) ); } ); } ); /* */