Skip to content
This repository
tree: 0ad6837236
Fetching contributors…

Cannot retrieve contributors at this time

file 32 lines (32 sloc) 0.743 kb
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
<html>
  <head>
    <title>Live console</title>
    <script src="/socket.io/socket.io.js"></script>
    <script>
var hostSet=0;
var socket = io.connect('http://'+location.host);
socket.on('message', function (data) {
clearInterval(hostSet);
document.body.innerHTML += data;
});
function setHost () {
host = location.hash.substring(location.hash.indexOf("//")+2);
document.title = "Live console for "+host;
// even sending this once the connect event fired, worked maybe 10% of the time
clearInterval(hostSet);
hostSet = setInterval(function () {
socket.send(host);
}, 500);
}
var lastHash;
setInterval(function () {
if(lastHash!=location.hash) {
setHost();
lastHash=location.hash;
}
}, 200);
    </script>
  </head>
  <body>
  </body>
</html>
Something went wrong with that request. Please try again.