Add handling off multiple links per entry.

This commit is contained in:
kor 2018-10-29 14:47:13 +13:00
parent 8af5d24ba6
commit c420202250
4 changed files with 45 additions and 15 deletions

View File

@ -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/) [Live web version here](https://kormyen.github.io/memex/)

View File

@ -52,8 +52,6 @@ function Main()
this.load = function(target) this.load = function(target)
{ {
console.log('main.load: ' + target)
document.activeElement.blur(); document.activeElement.blur();
if (this.queryCur != 'add') if (this.queryCur != 'add')
{ {

View File

@ -50,8 +50,6 @@ function View()
this.display = function(db) this.display = function(db)
{ {
console.log('display ' + db)
if (window.showAdd != undefined && window.showAdd) if (window.showAdd != undefined && window.showAdd)
{ {
main.add.setOverlay(false); main.add.setOverlay(false);
@ -126,7 +124,11 @@ function View()
// LINK START // LINK START
if (SETTINGS.SHOWLINK) if (SETTINGS.SHOWLINK)
{ {
entry += `<a class="griditem-link" href="${String(value.LINK)}" id="${idUrl}">`; if (typeof value.LINK != 'object')
{
// If this item has only one link then make the whole title the link
entry += `<a class="griditem-link" href="${String(value.LINK)}" id="${idUrl}">`;
}
} }
} }
@ -146,7 +148,18 @@ function View()
{ {
if (typeof value.LINK !== 'undefined') if (typeof value.LINK !== 'undefined')
{ {
entry += `<div class="griditem-linkcontainer"><i class="griditem-linkicon fas fa-link"></i><div class="griditem-linktitle">${this.extractRootDomain(value.LINK)}</div></div></a>`; if (typeof value.LINK == 'object')
{
for (let l = 0; l < value.LINK.length; l++)
{
entry += `<a class="griditem-link" href="${String(value.LINK[l])}" id="${idUrl}">`;
entry += `<div class="griditem-linkcontainer"><i class="griditem-linkicon fas fa-link"></i><div class="griditem-linktitle">${this.extractRootDomain(value.LINK[l])}</div></div></a>`;
}
}
else
{
entry += `<div class="griditem-linkcontainer"><i class="griditem-linkicon fas fa-link"></i><div class="griditem-linktitle">${this.extractRootDomain(value.LINK)}</div></div></a>`;
}
} }
} }

View File

@ -16,17 +16,20 @@ function Wrap()
{ {
let value = this.database[this.keys[i]]; let value = this.database[this.keys[i]];
// TAGS this.database[this.keys[i]].TAGS = this.commaSplit(value.TAGS);
if (typeof value.TAGS !== 'undefined') 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 (let l = 0; l < value.LINK.length; l++)
for (var t = 0; t < tags.length; t++)
{ {
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; this.database[this.keys[i]].DIID = i;
@ -222,4 +225,18 @@ function Wrap()
return stats; 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;
}
} }