From c420202250b993d3670bb91d909a2235cdd84bee Mon Sep 17 00:00:00 2001 From: kor Date: Mon, 29 Oct 2018 14:47:13 +1300 Subject: [PATCH] Add handling off multiple links per entry. --- README.md | 4 +++- docs/logic/main.js | 2 -- docs/logic/view.js | 21 +++++++++++++++++---- docs/logic/wrap.js | 33 +++++++++++++++++++++++++-------- 4 files changed, 45 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index d7fff11..ac795e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -**Memex** is a bookmarks and notes application to help with storage and overview +**Memex** is a [personal knowledge base](https://scholar.colorado.edu/csci_techreports/931/). + +A bookmarks and notes application to help with storage and overview. [Live web version here](https://kormyen.github.io/memex/) diff --git a/docs/logic/main.js b/docs/logic/main.js index b12bd91..e599692 100644 --- a/docs/logic/main.js +++ b/docs/logic/main.js @@ -52,8 +52,6 @@ function Main() this.load = function(target) { - console.log('main.load: ' + target) - document.activeElement.blur(); if (this.queryCur != 'add') { diff --git a/docs/logic/view.js b/docs/logic/view.js index e719e95..d46155f 100644 --- a/docs/logic/view.js +++ b/docs/logic/view.js @@ -50,8 +50,6 @@ function View() this.display = function(db) { - console.log('display ' + db) - if (window.showAdd != undefined && window.showAdd) { main.add.setOverlay(false); @@ -126,7 +124,11 @@ function View() // LINK START if (SETTINGS.SHOWLINK) { - entry += ``; + if (typeof value.LINK != 'object') + { + // If this item has only one link then make the whole title the link + entry += ``; + } } } @@ -146,7 +148,18 @@ function View() { if (typeof value.LINK !== 'undefined') { - entry += ``; + if (typeof value.LINK == 'object') + { + for (let l = 0; l < value.LINK.length; l++) + { + entry += ``; + entry += ``; + } + } + else + { + entry += ``; + } } } diff --git a/docs/logic/wrap.js b/docs/logic/wrap.js index fa5a338..e0d5674 100644 --- a/docs/logic/wrap.js +++ b/docs/logic/wrap.js @@ -16,17 +16,20 @@ function Wrap() { let value = this.database[this.keys[i]]; - // TAGS - if (typeof value.TAGS !== 'undefined') + this.database[this.keys[i]].TAGS = this.commaSplit(value.TAGS); + this.database[this.keys[i]].TYPE = this.commaSplit(value.TYPE); + this.database[this.keys[i]].PROJ = this.commaSplit(value.PROJ); + + // LINK + if (typeof value.LINK == 'object') { - var tags = value.TAGS.split(","); - - for (var t = 0; t < tags.length; t++) + for (let l = 0; l < value.LINK.length; l++) { - tags[t] = tags[t].trim().toLowerCase(); + if (value.LINK[l].substr(0,2) == '> ') + { + value.LINK[l] = value.LINK[l].substr(2,value.LINK[l].length-1); + } } - - this.database[this.keys[i]].TAGS = tags; } this.database[this.keys[i]].DIID = i; @@ -222,4 +225,18 @@ function Wrap() return stats; } + + this.commaSplit = function(data) + { + if (data !== undefined) + { + var result = data.split(","); + for (var t = 0; t < result.length; t++) + { + result[t] = result[t].trim().toLowerCase(); + } + return result; + } + return data; + } } \ No newline at end of file