mirror of
https://github.com/TangentFoxy/memex.git
synced 2024-11-22 04:54:23 +00:00
Improve quote and note rendering.
This commit is contained in:
parent
1a7f864492
commit
90021ad3cc
@ -1575,13 +1575,11 @@ OVEN
|
||||
NOTE
|
||||
> Oven close to bed, then bench with sink can be cut diagonal
|
||||
& Build right to edge (including counter lip)
|
||||
&
|
||||
& ENO
|
||||
> ENO
|
||||
& Height (400 - 470)
|
||||
& Width (504 - 517)
|
||||
& Depth (410 - 418)
|
||||
&
|
||||
& GAS
|
||||
> GAS
|
||||
& Height (470)
|
||||
& Width (530)
|
||||
& Depth (310)
|
||||
|
@ -246,7 +246,7 @@ function View()
|
||||
{
|
||||
if (typeof value.NOTE !== 'undefined')
|
||||
{
|
||||
entry += `<div class="note"><i class="fas fa-sticky-note textIcon"></i>${value.NOTE}</div>`;
|
||||
entry += this.buildArrayElement(value.NOTE, "note", "fas fa-sticky-note textIcon");
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ function View()
|
||||
{
|
||||
if (typeof value.QOTE !== 'undefined')
|
||||
{
|
||||
entry += `<div class="quote"><i class="fas fa-comment textIcon"></i>${value.QOTE}</div>`;
|
||||
entry += this.buildArrayElement(value.QOTE, "quote", "fas fa-comment textIcon");
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,6 +488,42 @@ function View()
|
||||
this.menu.innerHTML += menuContent;
|
||||
}
|
||||
|
||||
this.buildArrayElement = function(data, className, iconName)
|
||||
{
|
||||
let result = '';
|
||||
if (Array.isArray(data))
|
||||
{
|
||||
for (var i in data)
|
||||
{
|
||||
if (data[i] == "& ")
|
||||
{
|
||||
// blank line, do nothing
|
||||
}
|
||||
else if (data[i].substring(0, 2) == "> ")
|
||||
{
|
||||
// New item
|
||||
result += `<div class="${className}"><i class="${iconName}"></i>${data[i].substring(2)}</div>`;
|
||||
}
|
||||
else if (data[i].substring(0, 2) == "& ")
|
||||
{
|
||||
// New line in current item
|
||||
result += `<div class="${className}">${data[i].substring(2)}</div>`;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle unformatted
|
||||
result += `<div class="${className}"><i class="${iconName}"></i>${data[i]}</div>`;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Handle not array
|
||||
result += `<div class="${className}"><i class="${iconName}"></i>${data}</div>`;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// HELPER
|
||||
String.prototype.to_properCase = function()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user