From c16e71aedf2d0441d71d3342d7673e32034c0f1c Mon Sep 17 00:00:00 2001 From: tconfrey Date: Wed, 28 Feb 2024 13:22:49 -0500 Subject: [PATCH] handle edge case where page title has elements, also changed animation speed of save indicator --- app/BTAppNode.js | 7 +++++-- app/BTNode.js | 11 +++++++---- app/bt.js | 2 +- versions/Release-Candidate/app/BTAppNode.js | 7 +++++-- versions/Release-Candidate/app/BTNode.js | 11 +++++++---- versions/Release-Candidate/app/bt.js | 2 +- 6 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/BTAppNode.js b/app/BTAppNode.js index 0c55fc5..a8bfce1 100644 --- a/app/BTAppNode.js +++ b/app/BTAppNode.js @@ -187,7 +187,10 @@ class BTAppNode extends BTNode { // Node title as shown in tree, for url. Compare to BTNode.displayTag = plain tag text let txt = ""; if (this._keyword) txt += `${this._keyword} `; // TODO etc - return txt + BTAppNode._orgTextToHTML(this.title); + + // first escape any html entities + let title = this.title.replace(/&/g, "&").replace(//g, ">"); + return txt + BTAppNode._orgTextToHTML(title); } url() { @@ -512,7 +515,7 @@ class BTAppNode extends BTNode { }); window.postMessage({'function': 'groupAndPositionTabs', 'tabGroupId': this.tabGroupId, 'windowId': this.windowId, 'tabInfo': tabInfo, - 'groupName': BTAppNode.displayTagFromTitle(this.displayTag)}); + 'groupName': BTAppNode.displayNameFromTitle(this.displayTag)}); } putInGroup() { diff --git a/app/BTNode.js b/app/BTNode.js index 06cf582..f8a3f73 100644 --- a/app/BTNode.js +++ b/app/BTNode.js @@ -13,7 +13,7 @@ class BTNode { this._title = title; this._parentId = parentId; this._URL = BTNode.URLFromTitle(title); - this._displayTag = BTNode.displayTagFromTitle(title); + this._displayTag = BTNode.displayNameFromTitle(title); this._childIds = []; this._tagPath = ''; this.generateUniqueTagPath(); @@ -32,7 +32,7 @@ class BTNode { set title(ttl) { this._title = ttl; this._URL = BTNode.URLFromTitle(ttl); // regenerate URL when title is changed - this._displayTag = BTNode.displayTagFromTitle(ttl); + this._displayTag = BTNode.displayNameFromTitle(ttl); } get title() { return this._title; @@ -124,8 +124,11 @@ class BTNode { return hits ? hits[1] : ""; } - static displayTagFromTitle(title) { - // Visible tag for this node. Pull tags out, use url if no tag + static displayNameFromTitle(title) { + // Visible title for this node. Pull displayed title out, use url if none + + // first escape any html entities + title = title.replace(/&/g, "&").replace(//g, ">"); let outputStr = title.replace(/\[\[(.*?)\]\[(.*?)\]\]/gm, (match, $1, $2) => {return $2 || $1;}); return outputStr; diff --git a/app/bt.js b/app/bt.js index 61b9830..161c01f 100644 --- a/app/bt.js +++ b/app/bt.js @@ -207,7 +207,7 @@ function brainZoom(iteration = 0) { return; } $("#brain").attr("src", path); - const interval = 150; //iteration == 4 ? 200 : 100; + const interval = (iteration <= 4 ? 150 : 50); setTimeout(function() {brainZoom(++iteration);}, interval); } diff --git a/versions/Release-Candidate/app/BTAppNode.js b/versions/Release-Candidate/app/BTAppNode.js index 0c55fc5..a8bfce1 100644 --- a/versions/Release-Candidate/app/BTAppNode.js +++ b/versions/Release-Candidate/app/BTAppNode.js @@ -187,7 +187,10 @@ class BTAppNode extends BTNode { // Node title as shown in tree, for url. Compare to BTNode.displayTag = plain tag text let txt = ""; if (this._keyword) txt += `${this._keyword} `; // TODO etc - return txt + BTAppNode._orgTextToHTML(this.title); + + // first escape any html entities + let title = this.title.replace(/&/g, "&").replace(//g, ">"); + return txt + BTAppNode._orgTextToHTML(title); } url() { @@ -512,7 +515,7 @@ class BTAppNode extends BTNode { }); window.postMessage({'function': 'groupAndPositionTabs', 'tabGroupId': this.tabGroupId, 'windowId': this.windowId, 'tabInfo': tabInfo, - 'groupName': BTAppNode.displayTagFromTitle(this.displayTag)}); + 'groupName': BTAppNode.displayNameFromTitle(this.displayTag)}); } putInGroup() { diff --git a/versions/Release-Candidate/app/BTNode.js b/versions/Release-Candidate/app/BTNode.js index 06cf582..f8a3f73 100644 --- a/versions/Release-Candidate/app/BTNode.js +++ b/versions/Release-Candidate/app/BTNode.js @@ -13,7 +13,7 @@ class BTNode { this._title = title; this._parentId = parentId; this._URL = BTNode.URLFromTitle(title); - this._displayTag = BTNode.displayTagFromTitle(title); + this._displayTag = BTNode.displayNameFromTitle(title); this._childIds = []; this._tagPath = ''; this.generateUniqueTagPath(); @@ -32,7 +32,7 @@ class BTNode { set title(ttl) { this._title = ttl; this._URL = BTNode.URLFromTitle(ttl); // regenerate URL when title is changed - this._displayTag = BTNode.displayTagFromTitle(ttl); + this._displayTag = BTNode.displayNameFromTitle(ttl); } get title() { return this._title; @@ -124,8 +124,11 @@ class BTNode { return hits ? hits[1] : ""; } - static displayTagFromTitle(title) { - // Visible tag for this node. Pull tags out, use url if no tag + static displayNameFromTitle(title) { + // Visible title for this node. Pull displayed title out, use url if none + + // first escape any html entities + title = title.replace(/&/g, "&").replace(//g, ">"); let outputStr = title.replace(/\[\[(.*?)\]\[(.*?)\]\]/gm, (match, $1, $2) => {return $2 || $1;}); return outputStr; diff --git a/versions/Release-Candidate/app/bt.js b/versions/Release-Candidate/app/bt.js index 61b9830..161c01f 100644 --- a/versions/Release-Candidate/app/bt.js +++ b/versions/Release-Candidate/app/bt.js @@ -207,7 +207,7 @@ function brainZoom(iteration = 0) { return; } $("#brain").attr("src", path); - const interval = 150; //iteration == 4 ? 200 : 100; + const interval = (iteration <= 4 ? 150 : 50); setTimeout(function() {brainZoom(++iteration);}, interval); }