aboutsummaryrefslogtreecommitdiff
path: root/index.html
blob: b3756317e6ab38c004efe4fab7b32a7fcad9b3ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<textarea rows="5" cols="80" id="input">
</textarea>
<br>
<button value="Go" onclick="scrape()"/>Go</button>
</br>
<hr>
<div id='results'>
</div>

<script>

function write(stuff) {
document.getElementById('results').innerHTML += stuff;
}

function scrape() {
	document.getElementById('results').innerHTML = ""
	data = document.getElementById("input").value
	i=0;
	regex = /#[0-9a-f]{3,6}[^[0-9a-f]/gi, result = []
	while ( (result = regex.exec(data)) ) {
		i++;
		console.log(result[0]);
		write('<div>');
		write(result[0]);
		write('<img src="http://dummyimage.com/40x40/' + result[0].slice(1, result[0].length) +  '&text=+">');
		write('</div>')
	}
	if(i == 0) {
		write('nothing found');
	}

}
</script>