User:Zackmann08/insert-template.js

jQuery(document).ready(function($) {	if(mw.config.get('wgNamespaceNumber') != -1) {		mw.loader.using(['mediawiki.util']).done( function { var portletlink = mw.util.addPortletLink('p-tb','#','Insert template','t-insert-template'); $(portletlink).click(function(e) {				e.preventDefault;				insertTemplate;			}); });	}	function insertTemplate {		var myContent = document.getElementById('wpTextbox1').value;		var mysummary = "Tagging page for conversion";		var template = prompt("Please the template", "Sidebar");		console.log(template);		template_name = template.charAt(0).toUpperCase + template.slice(1);		console.log(template_name);		console.log(['Sidebar', 'Infobox', 'Navbox', 'WPBannerMeta', 'Wpbannermeta'].includes(template_name));		if(['Sidebar', 'Infobox', 'Navbox', 'WPBannerMeta', 'Wpbannermeta'].includes(template_name)){			document.getElementById('wpTextbox1').value += ` `    		document.getElementById('wpSummary').value  = "Tagging page for conversion";		} else{			alert("Invalid template")		}	} });