User:Writ Keeper/Scripts/SearchNamespaceMono.js

function NSSearch {	var prefixList = document.createElement("select"); prefixList.id = "searchNSSelect"; prefixList.innerHTML = " Article: \n Article talk: \n Wikipedia: \n Wikipedia talk: \n User: \n User talk: \n WikiProject: \n WikiProject talk: \n Category: \n Category talk: \n Template: \n Template talk: \n Book: \n Book talk: \n Help: \n Special: "; var hiddenInput = document.createElement("input"); hiddenInput.type = "hidden"; hiddenInput.name = "search"; hiddenInput.id = "hiddenNSInput"; var searchInput = $("#searchInput"); searchInput.before(hiddenInput); searchInput.before(prefixList); searchInput.removeAttr("name"); prefixList.tabIndex = searchInput[0].tabIndex; $("#searchform").submit(function	{		var prefixValue = $("#searchNSSelect").prop("value");		switch(prefixValue)		{			case "Article:":				$("#hiddenNSInput").prop("value", $("#searchInput").prop("value"));				break;			case "Article talk:":				$("#hiddenNSInput").prop("value", "Talk:" + $("#searchInput").prop("value"));				break;			case "WikiProject:":				$("#hiddenNSInput").prop("value", "Wikipedia:WikiProject " + $("#searchInput").prop("value"));				break;			case "WikiProject talk:":				$("#hiddenNSInput").prop("value", "Wikipedia talk:WikiProject " + $("#searchInput").prop("value"));				break;			default:				$("#hiddenNSInput").prop("value", prefixValue + $("#searchInput").prop("value"));				break;		}	}); } $(document).ready(NSSearch);