From 9e81fcd4bdb089b8f8a05c6fbb586ec2a2a14924 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 6 Jun 2020 16:04:40 +0200 Subject: Change 'observe' to 'subscribe' (and incidentally 'publish') which is more common lingo. --- task.js | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'task.js') diff --git a/task.js b/task.js index 0367221..64d95ff 100644 --- a/task.js +++ b/task.js @@ -13,21 +13,21 @@ function idFromStr(str) var tasks = new Array(); -function findTask(id, observeid) +function findTask(id, subscribeid) { for(var i = 0; i < tasks.length; i++) { var task = tasks[i]; - var child = task.findTask(id, observeid); + var child = task.findTask(id, subscribeid); if(child != null) return child; } return null; } -function Task(id, observeid) +function Task(id, subscribeid) { this.id = id; - this.observeid = observeid; + this.subscribeid = subscribeid; this.children = new Array(); this.attributes = {}; this.parent = null; @@ -43,21 +43,21 @@ Task.prototype.dump = function() alert(this.id); } -Task.prototype.findTask = function(id, observeid) +Task.prototype.findTask = function(id, subscribeid) { - if(this.observeid != observeid) return null; + if(this.subscribeid != subscribeid) return null; if(this.id == id) return this; for(var i = 0; i < this.children.length; i++) { var task = this.children[i]; - var child = task.findTask(id, observeid); + var child = task.findTask(id, subscribeid); if(child != null) return child; } return null; } - + Task.prototype.addChild = function(task) { if(task.parent != null) task.parent.removeChild(task); @@ -92,26 +92,26 @@ Task.prototype.create = function() // This is a hack to make it possible to identify the taskid and // oberveid from the node id alone. - task.id = createId(this.observeid, this.id); - -/* - var observe_button = document.createElement("div"); - observe_button.name = "observe_button"; - observe_button.setAttribute("onclick", "observeMe(this, event)"); - observe_button.setAttribute("title", this.id); - observe_button.setAttribute("style", "float: left; display: inline-box; width:14px; height: 14px; border: solid green 2px; cursor: pointer;"); + task.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("+"); - observe_button.appendChild(txt_plus); - task.appendChild(observe_button); - - var unobserve_button = document.createElement("div"); - unobserve_button.name = "unobserve_button"; - unobserve_button.setAttribute("onclick", "unobserveMe(this, event)"); - unobserve_button.setAttribute("title", this.id); - unobserve_button.setAttribute("style", "float: left; display: inline-box; width:14px; height: 14px; border: solid red 2px; cursor: pointer;"); + subscribe_button.appendChild(txt_plus); + task.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("-"); - unobserve_button.appendChild(txt_minus); - task.appendChild(unobserve_button); + unsubscribe_button.appendChild(txt_minus); + task.appendChild(unsubscribe_button); */ this.element.appendChild(this.div_id); @@ -126,7 +126,7 @@ Task.prototype.create = function() Task.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); @@ -134,4 +134,4 @@ Task.prototype.setAttribute = function(name, value) var title_txt = document.createTextNode(value); this.div_title.appendChild(title_txt); } -} \ No newline at end of file +} -- cgit v1.2.3