User:Tyilo/get inv name.js

var toolbar = document.getElementById('toolbar'); if((wgAction == 'edit' || wgAction == 'submit') && toolbar) {	var container = document.createElement('span'); var br = document.createElement('br'); container.appendChild(br); var text = document.createTextNode('Get inventory image name: '); container.appendChild(text); var input = document.createElement('input'); input.setAttribute('type', 'text'); input.addEventListener('keydown', function	{		if(event.keyCode == 13)		{			event.preventDefault;			this.blur;			var request = new XMLHttpRequest;			request.open('GET', 'http://runescape.wikia.com/wiki/' + input.value);			request.addEventListener('load', function {				var match = //.exec(request.responseText); if(match) {					output.style.color = 'black'; output.innerText = ''; }				else {					output.style.color = 'red'; output.innerText = 'No inventory icon found!'; }			});			request.addEventListener('error', function {				output.style.color = 'red'; output.innerText = 'Connection error!'; });			request.send;		}	}); container.appendChild(input); var output = document.createElement('span'); container.appendChild(output); toolbar.appendChild(container); }