Created
October 6, 2017 10:03
-
-
Save datafatmunger/abe3ca8786ecfdf28cb05dfbbf5705e0 to your computer and use it in GitHub Desktop.
DW Playback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <style> | |
| * { | |
| margin: 0; | |
| } | |
| @font-face { | |
| font-family: TrojaMon; | |
| src: url(TrojaMon3.ttf); | |
| } | |
| body { | |
| background: #000; | |
| } | |
| h1 { | |
| color: #fff; | |
| font-family: TrojaMon; | |
| font-weight: normal; | |
| text-transform: uppercase; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <h1></h1> | |
| <script> | |
| var redact = function(str) { | |
| var nstr = ""; | |
| for(var i = 0; i < str.length; i++) { | |
| if(Math.floor(Math.random() * 2) + 1 == 1) nstr += str[i]; | |
| else nstr += "▉"; | |
| } | |
| return nstr; | |
| }; | |
| var getData = function(callback) { | |
| var client = new XMLHttpRequest(); | |
| client.open('GET', 'ds.txt'); | |
| client.onreadystatechange = function() { | |
| if (client.readyState == 4 && client.status == "200") { | |
| var data = client.responseText.split('\n'); | |
| callback(data); | |
| } | |
| } | |
| client.send(); | |
| }; | |
| var sleep = function(ms) { | |
| return new Promise(resolve => setTimeout(resolve, ms)); | |
| } | |
| var run = async function(data) { | |
| var h1 = document.querySelector('h1'); | |
| for(var i = 0; i < data.length - 1; i++) { | |
| var a1 = data[i].split(' '); | |
| var d1 = Date.parse(a1[0] + ", " + a1[2] + " " + a1[1] + " " + a1[5] + " " + a1[3]); | |
| var a2 = data[i + 1].split(' '); | |
| var d2 = Date.parse(a2[0] + ", " + a2[2] + " " + a2[1] + " " + a2[5] + " " + a2[3]); | |
| var secs = d2 - d1; | |
| if(a1[6] != 'index') { | |
| if(a1[6].indexOf('search') != -1) { | |
| var q = a1.splice(7, a1.length).join(" "); | |
| h1.innerHTML = redact(q); | |
| } else if(a1[6].indexOf('page')) { | |
| var q = a1.splice(9, a1.length).join(" "); | |
| h1.innerHTML = redact(q); | |
| } | |
| } | |
| var lt = h1.innerHTML.length * 500; | |
| console.log('waiting ' + lt); | |
| await sleep(lt); | |
| h1.innerHTML = ""; | |
| await sleep((secs - lt) / 10); | |
| } | |
| }; | |
| (function() { | |
| getData(run); | |
| })(); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment