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/)

View File

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

View File

@ -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,9 +124,13 @@ function View()
// LINK START
if (SETTINGS.SHOWLINK)
{
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}">`;
}
}
}
// UPPER CONTENT START
if (SETTINGS.SHOWUPPER)
@ -145,10 +147,21 @@ function View()
if (SETTINGS.SHOWLINK)
{
if (typeof value.LINK !== 'undefined')
{
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>`;
}
}
}
// TYPE
if (SETTINGS.SHOWTYPE)

View File

@ -16,17 +16,20 @@ function Wrap()
{
let value = this.database[this.keys[i]];
// TAGS
if (typeof value.TAGS !== 'undefined')
{
var tags = value.TAGS.split(",");
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);
for (var t = 0; t < tags.length; t++)
// LINK
if (typeof value.LINK == 'object')
{
tags[t] = tags[t].trim().toLowerCase();
for (let l = 0; l < value.LINK.length; l++)
{
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;
}
}