From 0296f38dd329cd04904d059023d802b558c3ee59 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Mon, 27 Oct 2014 13:36:42 -0600 Subject: [PATCH] Preparing to support multiple networks --- Makefile | 3 ++ app/server.js | 16 +++++++--- chat.svg | 81 ++++++++++++++++++++++++++++++++++++++++++--------- 3 files changed, 83 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 5e502b1..545bb59 100644 --- a/Makefile +++ b/Makefile @@ -13,3 +13,6 @@ icons: $(ICONS) app/icon-%.png: chat.svg inkscape --export-png=$@ --export-width=$* $< + +package: icons + cd app && zip -ru ../package.zip . diff --git a/app/server.js b/app/server.js index 912893d..bf2c081 100644 --- a/app/server.js +++ b/app/server.js @@ -3,6 +3,17 @@ var maxScrollback = 500; function Server(network, baseURL, authtok, messageHandler) { + function init() { + var pullURL = baseURL + "?network=" + encodeURIComponent(network) + "&auth=" + encodeURIComponent(authtok); + this.eventSource = new EventSource(pullURL); + this.eventSource.addEventListener("message", handleEventSourceMessage); + this.eventSource.addEventListener("error", handleEventSourceError); + } + + function close() { + this.eventSource.close(); + } + function handleEventSourceLine(line) { var lhs = line.split(" :", 1)[0] var parts = lhs.split(' ') @@ -52,8 +63,5 @@ function Server(network, baseURL, authtok, messageHandler) { this.send = send; - var pullURL = baseURL + "?network=" + encodeURIComponent(network) + "&auth=" + encodeURIComponent(authtok); - var eventSource = new EventSource(pullURL); - eventSource.addEventListener("message", handleEventSourceMessage); - eventSource.addEventListener("error", handleEventSourceError); + init(); } diff --git a/chat.svg b/chat.svg index d774235..05732e8 100644 --- a/chat.svg +++ b/chat.svg @@ -27,10 +27,10 @@ id="base" inkscape:window-x="0" inkscape:window-y="0" - inkscape:zoom="1.26" + inkscape:zoom="0.89095454" inkscape:current-layer="g3182" - inkscape:cx="258.38604" - inkscape:cy="174.57475" + inkscape:cx="-30.955534" + inkscape:cy="263.18068" inkscape:window-width="1280" showgrid="false" inkscape:window-height="751" @@ -38,16 +38,71 @@ - - + + + + + + + +