summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ws/handler.js2
-rw-r--r--src/ws/node.js5
-rw-r--r--src/ws/proto.js17
-rw-r--r--src/ws/view.js8
4 files changed, 18 insertions, 14 deletions
diff --git a/src/ws/handler.js b/src/ws/handler.js
index 27eb76e..38b3fd5 100644
--- a/src/ws/handler.js
+++ b/src/ws/handler.js
@@ -1,6 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set et sw=2 ts=2: */
-
+'use strict';
document.addEventListener("connectEvent", connectEventHandler, false);
function connectEventHandler(e)
diff --git a/src/ws/node.js b/src/ws/node.js
index dff7056..6346b16 100644
--- a/src/ws/node.js
+++ b/src/ws/node.js
@@ -1,5 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set et sw=2 ts=2: */
+'use strict';
function createId(boardid, nodeid)
{
@@ -86,8 +87,8 @@ Node.prototype.addChild = function(node, insertBeforeId)
node.parent = this;
- inserted = false;
- for(i = 0; i < this.children.length; ++i)
+ var inserted = false;
+ for(var i = 0; i < this.children.length; ++i)
{
if(this.children[i].id == insertBeforeId)
{
diff --git a/src/ws/proto.js b/src/ws/proto.js
index 234410a..d21908e 100644
--- a/src/ws/proto.js
+++ b/src/ws/proto.js
@@ -1,5 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set et sw=2 ts=2: */
+'use strict';
function get_appropriate_ws_url()
{
@@ -38,12 +39,12 @@ try
document.dispatchEvent(connectEvent);
};
- socket_node.onmessage = function got_packet(msg)
+ socket_node.onmessage = function got_packet(packet)
{
var messageEvent = new CustomEvent("messageEvent",
{
detail: {
- message: "recv [" + msg.data + "]",
+ message: "recv [" + packet.data + "]",
time: new Date(),
},
bubbles: true,
@@ -56,24 +57,24 @@ try
msgs[idx] = '';
var c = 0;
var instring = false;
- for(c = 0; c < msg.data.length; c++)
+ for(c = 0; c < packet.data.length; c++)
{
- if(msg.data[c] == '"' && c > 0 && msg.data[c - 1] != '\\')
+ if(packet.data[c] == '"' && c > 0 && packet.data[c - 1] != '\\')
{
instring = !instring;
}
- if(msg.data[c] == ';' && instring == false)
+ if(packet.data[c] == ';' && instring == false)
{
idx++;
msgs[idx] = '';
}
- if(msg.data[c] != ';' || instring == true)
+ if(packet.data[c] != ';' || instring == true)
{
- msgs[idx] += msg.data[c];
+ msgs[idx] += packet.data[c];
}
}
- f = 0;
+ var f = 0;
while (f < msgs.length - 1)
{
var msg = new Array();
diff --git a/src/ws/view.js b/src/ws/view.js
index 986e3f9..26b7c0d 100644
--- a/src/ws/view.js
+++ b/src/ws/view.js
@@ -1,5 +1,6 @@
/* -*- Mode: js2; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set et sw=2 ts=2: */
+'use strict';
/*
function createNode()
@@ -16,8 +17,8 @@ function createNode()
var cookies = null;
function initCookie(cookie, index)
{
- name = cookie.split('=')[0].trim();
- value = cookie.split('=')[1];
+ const name = cookie.split('=')[0].trim();
+ const value = cookie.split('=')[1];
cookies[name] = value;
}
function initCookies()
@@ -89,7 +90,7 @@ function getElementAfter(e)
var element_after = null;
var min_y_diff = 9999999999999;
- for(i = 0; i < e.target.children.length; ++i)
+ for(var i = 0; i < e.target.children.length; ++i)
{
if(e.target.children[i].className != "node") // Only look at node elements
{
@@ -116,6 +117,7 @@ function drag(e)
update(idFromStr(id), "dragged", "true");
}
+var last_over = null;
function dragenter(e)
{
// Only highlight children areas