diff options
author | Calvin Morrison <mutantturkey@gmail.com> | 2014-04-29 20:34:34 -0400 |
---|---|---|
committer | Calvin Morrison <mutantturkey@gmail.com> | 2014-04-29 20:34:34 -0400 |
commit | 6be9134a83fea97f3e18e7dfc7ac8c5c19419932 (patch) | |
tree | 4d2a333b4f5a61e328e696f2fa80c97897d15328 | |
parent | cfc5a8f52fca9423171d023ba91796a52911fd84 (diff) |
more changez
-rw-r--r-- | index.html | 53 |
1 files changed, 45 insertions, 8 deletions
@@ -1,34 +1,71 @@ -<textarea rows="5" cols="80" id="input"> +<title> + HexScraper: scrape hex colors from text +</title> + +<h1> + HexScraper: scrape hex colors from text +</h1> +<body style="font-family:sans;"> +<textarea rows="20" cols="80" id="input"> </textarea> <br> <button value="Go" onclick="scrape()"/>Go</button> +<input id="labels" type="checkbox" name="labels" checked=True>Labels?</input> +<input id="space" type="checkbox" name="spaces" checked=True>Spacing?</input> +<input id="big" type="checkbox" name="big" checked=True>Big Blocks?</input> </br> <hr> <div id='results'> </div> +</body> <script> +body = "" + function write(stuff) { -document.getElementById('results').innerHTML += stuff; +body += stuff; +} + +function reset() { + body = "" +} + +function flush() { +document.getElementById('results').innerHTML = body; } function scrape() { - document.getElementById('results').innerHTML = "" + reset(); + flush(); + data = document.getElementById("input").value i=0; regex = /#[0-9a-f]{3,6}[^[0-9a-f]/gi, result = [] + size="70x70"; + if(document.getElementById("big").checked) { + size="180x180"; + } 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(document.getElementById("space").checked) { + write('<div style="float:left; padding: 1em; display:inline;">'); + } + else { + write('<div style="float:left;">') + } + if(document.getElementById("labels").checked) { + write(result[0]); + write("<br>"); + } + write('<img title=' + result[0] + 'src="http://dummyimage.com/' + size + '/' + result[0].slice(1, result[0].length) + '&text=+" style="border: 2px black solid;">'); + write('</div>'); } if(i == 0) { write('nothing found'); } + flush(); + } </script> |