Sha256: a6c8a04b5b632cecbcd6a2f396693feb1bff236902cdb1cd25b9669e3a33b9ad
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
<html><head></head><body> <div id="messages"></div> <div> <span id="on_login">My name is:</span> <input id="message_box" type="text"> <button id="button">SEND</button> </div> <script src="/portal.js"></script> <script> window.onload = function(){ var options = { transports:["ws","longpollajax"], reconnect:function(lastDelay,attempts){ if(options.transports.length > 1) options.transports.shift(); return 2 * (lastDelay || 100);}, prepare:function(connect,disconnect,opts){ opts.transports = options.transports;connect();} }; var socket; function openPortal(){ var socket = portal.open("/drunkmonkey",options) .on("message",function(msg){ document.getElementById("messages").innerHTML += "<p>" + msg + "</p>"; }); return socket; }; var socket; function _send_message(){ var message_box = document.getElementById("message_box"); var message = message_box.value; if (message.length > 0) { message_box.value = ""; socket.send("message",message); } } function send_message(){ if (socket == null) { document.getElementById("on_login").innerHTML = ""; socket = openPortal(); _send_message(); } else { _send_message(); } }; document.getElementById("button").onclick = send_message; }; </script> </body><html>
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
drunkmonkey-0.0.3 | sample/public/index.html |
drunkmonkey-0.0.2 | sample/public/index.html |
drunkmonkey-0.0.1 | sample/public/index.html |