summaryrefslogtreecommitdiff
path: root/node.js
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-06-07 10:05:32 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-06-07 10:05:32 +0200
commitdd19910ec18ec60633bf5b4fcda5bab220d0565f (patch)
treec42c60a7daa15d99d772d670d53c29caf45d821b /node.js
parent5f95718e7ebe4dec017055500793b928d8946d8e (diff)
Relocate all webservice files to src/ws and make sure they can be found by the service after install.
Diffstat (limited to 'node.js')
-rw-r--r--node.js137
1 files changed, 0 insertions, 137 deletions
diff --git a/node.js b/node.js
deleted file mode 100644
index 3cb325c..0000000
--- a/node.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set et sw=2 ts=2: */
-
-function createId(boardid, nodeid)
-{
- return "b" + boardid + "_t" + nodeid;
-}
-
-function idFromStr(str)
-{
- return str.substring(str.search('t') + 1, str.length);
-}
-
-var nodes = new Array();
-
-function findNode(id, subscribeid)
-{
- for(var i = 0; i < nodes.length; i++) {
- var node = nodes[i];
- var child = node.findNode(id, subscribeid);
- if(child != null) return child;
- }
-
- return null;
-}
-
-function Node(id, subscribeid)
-{
- this.id = id;
- this.subscribeid = subscribeid;
- this.children = new Array();
- this.attributes = {};
- this.parent = null;
-
- // Elements:
- this.element = document.createElement("div");
- this.div_id = document.createElement("span");
- this.div_title = document.createElement("span");
-}
-
-Node.prototype.dump = function()
-{
- alert(this.id);
-}
-
-Node.prototype.findNode = function(id, subscribeid)
-{
- if(this.subscribeid != subscribeid) return null;
-
- if(this.id == id) return this;
-
- for(var i = 0; i < this.children.length; i++) {
- var node = this.children[i];
- var child = node.findNode(id, subscribeid);
- if(child != null) return child;
- }
-
- return null;
-}
-
-Node.prototype.addChild = function(node)
-{
- if(node.parent != null) node.parent.removeChild(node);
- this.children.push(node);
- node.parent = this;
- this.element.appendChild(node.element);
-}
-
-Node.prototype.removeChild = function(node)
-{
- this.children = this.children.filter(
- function(e) {
- return e.id != node.id;
- });
- node.parent = null;
- this.element.removeChild(node.element);
-}
-
-Node.prototype.create = function()
-{
- var node = this.element;
-
- node.name = "node";
- node.setAttribute("class", "node");
- node.setAttribute("ondblclick", "editTitle(this, event)");
- //node.setAttribute("onclick", "showHideChildren(this, event)");
- node.setAttribute("ondrop", "drop(this, event)");
- node.setAttribute("ondragover", "return false");
- node.setAttribute("draggable", true);
- node.setAttribute("ondragstart", "drag(this, event)");
- node.setAttribute("title", this.id);
-
- // This is a hack to make it possible to identify the nodeid and
- // oberveid from the node id alone.
- node.id = createId(this.subscribeid, this.id);
-
-/*
- var subscribe_button = document.createElement("div");
- subscribe_button.name = "subscribe_button";
- subscribe_button.setAttribute("onclick", "subscribeMe(this, event)");
- subscribe_button.setAttribute("title", this.id);
- subscribe_button.setAttribute("style", "float: left; display: inline-box; width:14px; height: 14px; border: solid green 2px; cursor: pointer;");
- var txt_plus = document.createTextNode("+");
- subscribe_button.appendChild(txt_plus);
- node.appendChild(subscribe_button);
-
- var unsubscribe_button = document.createElement("div");
- unsubscribe_button.name = "unsubscribe_button";
- unsubscribe_button.setAttribute("onclick", "unsubscribeMe(this, event)");
- unsubscribe_button.setAttribute("title", this.id);
- unsubscribe_button.setAttribute("style", "float: left; display: inline-box; width:14px; height: 14px; border: solid red 2px; cursor: pointer;");
- var txt_minus = document.createTextNode("-");
- unsubscribe_button.appendChild(txt_minus);
- node.appendChild(unsubscribe_button);
-*/
-
- this.element.appendChild(this.div_id);
- var id_txt = document.createTextNode(this.id);
- this.div_id.appendChild(id_txt);
-
- this.element.appendChild(this.div_title);
-
- this.setAttribute("title", "(missing title)");
-}
-
-Node.prototype.setAttribute = function(name, value)
-{
- this.attributes[name] = value;
-
- if(name == "title") {
- if(this.div_title.firstChild != null) {
- this.div_title.removeChild(this.div_title.firstChild);
- }
- var title_txt = document.createTextNode(value);
- this.div_title.appendChild(title_txt);
- }
-}