From: Scott Worley Date: Mon, 30 Jul 2012 06:28:38 +0000 (-0700) Subject: More "var" in variable declarations. X-Git-Url: http://git.scottworley.com/reliable-chat/commitdiff_plain/d77f9ec931d3e3eb76066765ac247158791b70ba?ds=sidebyside More "var" in variable declarations. --- diff --git a/webclient/rc.js b/webclient/rc.js index 3231f4c..29b762e 100644 --- a/webclient/rc.js +++ b/webclient/rc.js @@ -27,7 +27,7 @@ function rcserverbase(server) { function rcchangeserverstatus(server, new_status) { var statusbar = document.getElementById("status"); var spans = statusbar.getElementsByTagName("span"); - for (i in spans) { + for (var i in spans) { if (spans[i].firstChild && 'data' in spans[i].firstChild && spans[i].firstChild.data == server) { spans[i].setAttribute("class", new_status); } @@ -52,7 +52,7 @@ function receiveMessage(server, time, id, text) { if (!(seen_key in seen)) { seen[seen_key] = true; rcaddmessagetohistory(text); - for (i in servers) { + for (var i in servers) { rcchangeserverstatus(servers[i], "sad"); } } @@ -61,10 +61,10 @@ function receiveMessage(server, time, id, text) { function receiveMessageEvent(event) { - for (i in servers) { + for (var i in servers) { if (event.origin === rcserverbase(servers[i])) { messages = JSON.parse(event.data); - for (j in messages) { + for (var j in messages) { if ('Time' in messages[j] && 'ID' in messages[j] && 'Text' in messages[j]) { @@ -77,7 +77,7 @@ function receiveMessageEvent(event) function rcconnect() { window.addEventListener("message", receiveMessageEvent, false); - for (i in servers) { + for (var i in servers) { // Create a hidden iframe for same-origin workaround var iframe = document.createElement("iframe"); iframe.setAttribute("src", rcserverbase(servers[i]) + "/frame"); @@ -99,7 +99,7 @@ function rcsend(d, message) { var path = "/speak" + "?id=" + encodeURIComponent(id) + "&text=" + encodeURIComponent(message); - for (i in servers) { + for (var i in servers) { var uri = rcserverbase(servers[i]) + path; var img = document.createElement("img"); img.setAttribute("src", uri);