diff --git a/README b/README index 2fa3013..617cba6 100644 --- a/README +++ b/README @@ -26,4 +26,4 @@ Features Todo ----- -I need to make this document suck less. +[Todo list](TODO) diff --git a/TODO b/TODO new file mode 100644 index 0000000..1fe5f39 --- /dev/null +++ b/TODO @@ -0,0 +1,7 @@ +Todo list +========= + +* One server instance for all networks +* One cgi for all networks? +* Make README suck less +* nickname name= attribute set to uhost diff --git a/app/network.js b/app/network.js index 4c78d3f..7c93913 100644 --- a/app/network.js +++ b/app/network.js @@ -80,8 +80,11 @@ function networkConnect(network, baseURL, authtok) { } element.close = function() { + console.log("Closing"); eventSource.close(); element.parentNode.removeChild(element); + roomElement.close(); + // XXX: Close all associated rooms, too! } diff --git a/app/room.js b/app/room.js index 8fd0ba1..24413ed 100644 --- a/app/room.js +++ b/app/room.js @@ -140,6 +140,13 @@ function newRoom(element, network, name, maxSize) { network.send(name, text); } + element.close = function() { + console.log(messages); + console.log(messages.parent); + messages.parent.removeChild(messages); + element.parent.removeChild(element); + } + function clicked() { element.show(); } diff --git a/app/wirc.js b/app/wirc.js index 45d4706..919f72a 100644 --- a/app/wirc.js +++ b/app/wirc.js @@ -45,6 +45,7 @@ function focus(e) { } function handleInput(oEvent) { + console.log(oEvent); var txt = oEvent.target.value; if (txt.startsWith("/connect ")) { // XXX: should allow tokens with spaces @@ -53,7 +54,7 @@ function handleInput(oEvent) { var url = parts[2]; var authtok = parts[3]; - connect(network, url, authtok); + networkConnect(network, url, authtok); storedConnections[network] = [url, authtok]; chrome.storage.sync.set({"connections": storedConnections}); } else { @@ -77,6 +78,9 @@ function hideChannels(oEvent) { function keyPress(oEvent) { document.getElementById("input").focus(); + if (oEvent.keyIdentifier == "Enter") { + handleInput(oEvent); + } } function restore(items) { @@ -91,7 +95,7 @@ function restore(items) { function init() { chrome.storage.sync.get(["connections"], restore); - document.getElementById("input").addEventListener("change", handleInput); + //document.getElementById("input").addEventListener("change", handleInput); document.getElementById("hide-channels").addEventListener("click", hideChannels); window.addEventListener("keypress", keyPress);