initial commit
This commit is contained in:
commit
79594237bf
10 changed files with 9612 additions and 0 deletions
1109
css/bootstrap-responsive.css
vendored
Normal file
1109
css/bootstrap-responsive.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
css/bootstrap-responsive.min.css
vendored
Normal file
9
css/bootstrap-responsive.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6158
css/bootstrap.css
vendored
Normal file
6158
css/bootstrap.css
vendored
Normal file
File diff suppressed because it is too large
Load diff
9
css/bootstrap.min.css
vendored
Normal file
9
css/bootstrap.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
BIN
img/glyphicons-halflings-white.png
Normal file
BIN
img/glyphicons-halflings-white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
img/glyphicons-halflings.png
Normal file
BIN
img/glyphicons-halflings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
2268
js/bootstrap.js
vendored
Normal file
2268
js/bootstrap.js
vendored
Normal file
File diff suppressed because it is too large
Load diff
6
js/bootstrap.min.js
vendored
Normal file
6
js/bootstrap.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
7
websockets.html
Normal file
7
websockets.html
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script type="text/javascript" src="websockets.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
46
websockets.js
Normal file
46
websockets.js
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
var output;
|
||||||
|
var hostport;
|
||||||
|
var proto;
|
||||||
|
var password;
|
||||||
|
function init() {
|
||||||
|
output = document.getElementById("output");
|
||||||
|
hostport = prompt("Enter hostname:port of WeeChat/relay", "hostname:5000")
|
||||||
|
proto = prompt("Protocol (weechat / irc)", "weechat")
|
||||||
|
password = prompt("Password (for relay)", "")
|
||||||
|
websocket = new WebSocket("ws://" + hostport + "/weechat");
|
||||||
|
websocket.onopen = function(evt) { onOpen(evt) };
|
||||||
|
websocket.onclose = function(evt) { onClose(evt) };
|
||||||
|
websocket.onmessage = function(evt) { onMessage(evt) };
|
||||||
|
websocket.onerror = function(evt) { onError(evt) };
|
||||||
|
}
|
||||||
|
function onOpen(evt) {
|
||||||
|
display("connected", "Connected to " + hostport);
|
||||||
|
if (proto == "weechat") {
|
||||||
|
doSend("init password=" + password + "\ninfo version\ntest\n");
|
||||||
|
} else {
|
||||||
|
doSend("PASS " + password + "\r\nNICK test\r\nUSER test 0 * :test\r\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function onClose(evt) {
|
||||||
|
display("disconnected", "Disconnected");
|
||||||
|
}
|
||||||
|
function onMessage(evt) {
|
||||||
|
display("recv", "⇒ " + evt.data);
|
||||||
|
}
|
||||||
|
function onError(evt) {
|
||||||
|
display("error", "ERROR: " + evt.data);
|
||||||
|
}
|
||||||
|
function doSend(message) {
|
||||||
|
msgs = message.replace(/[\r\n]+$/g, "").split("\n");
|
||||||
|
for (var i = 0; i < msgs.length; i++) {
|
||||||
|
display("sent", "⇐ " + msgs[i]);
|
||||||
|
}
|
||||||
|
websocket.send(message);
|
||||||
|
}
|
||||||
|
function display(class_name, message) {
|
||||||
|
var div = document.createElement("div");
|
||||||
|
div.className = class_name;
|
||||||
|
div.innerHTML = message;
|
||||||
|
output.appendChild(div);
|
||||||
|
}
|
||||||
|
window.addEventListener("load", init, false);
|
Loading…
Reference in a new issue