From a21005323e2842542f2987da79747f88c4a80100 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Thu, 24 Jul 2014 16:34:02 +0000 Subject: [PATCH] Kibozing --- index.html | 18 +++++++++++++----- irc.js | 17 +++++++++++++---- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index df455cb..07489bb 100644 --- a/index.html +++ b/index.html @@ -5,15 +5,18 @@ @@ -37,8 +43,10 @@
+
+
diff --git a/irc.js b/irc.js index 93a9369..a1d3670 100644 --- a/irc.js +++ b/irc.js @@ -1,5 +1,9 @@ var msgRe = /([^ ]+) (<[^>]+>) (.*)/; -var authtok; +var kibozeRe = "neal"; + +function isinView(oObject) { + return (oObject.offsetParent.clientHeight <= oObject.offsetTop); +} function addMessagePart(p, className, text) { var e = document.createElement("span"); @@ -32,13 +36,18 @@ function addMessage(txt) { return; break; case "PRIVMSG": - addMessagePart(p, "sender", sender); addMessagePart(p, "forum", forum); + addMessagePart(p, "sender", sender); addMessagePart(p, "text", msg); + if (-1 != msg.search(kibozeRe)) { + var k = document.getElementById("kiboze"); + var p2 = p.cloneNode(true); + k.insertBefore(p2, k.firstChild); + } break; default: - addMessagePart(p, "sender", sender); addMessagePart(p, "forum", forum); + addMessagePart(p, "sender", sender); addMessagePart(p, "raw", command + " " + args + " " + msg); break; } @@ -71,7 +80,7 @@ function handleCommand(event) { function init() { var authtok = prompt("Auth token", ""); document.getElementById("authtok").value = authtok; - + var source = new EventSource("irc.cgi?auth=" + authtok); source.onmessage = newmsg;