User:Alexis Jazz/CurlyTemplateSearch.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
//<nowiki>CurlyTemplateSearch is public domain, irrevocably released as WTFPL Version 2[http://www.wtfpl.net/about/] by its author, Alexis Jazz. When entering {{ in the search box it converts that to Template:. See phab:T185126
//Start script writing date: 2022-08-04 13:07 UTC
//DONE: 2022-08-04 13:21 UTC. Also ate a banana
//only works in Vector Classic, Timeless and Monobook. Not Vector-2022 or Minerva
window.curlySearchClass = '#searchInput:eq(0)';
window.curlySearch = function() {
		var delayCurly = setInterval(function () {
			clearInterval(delayCurly);
			$(window.curlySearchClass)[0].value = $(window.curlySearchClass)[0].value.replace(/^\{\{/,mw.config.get('wgFormattedNamespaces')[10]+':');
		}, 10);
};
$(window.curlySearchClass).on('keydown',function() { window.curlySearch(); } );
$(window.curlySearchClass).on('paste',function() { window.curlySearch(); } );
$(window.curlySearchClass).on('change',function() { window.curlySearch(); } );
//</nowiki>