diff --git a/docs/logic/main.js b/docs/logic/main.js
index e599692..a7180f9 100644
--- a/docs/logic/main.js
+++ b/docs/logic/main.js
@@ -29,7 +29,7 @@ function Main()
this.view = new View();
this.view.install();
- if (window.showAdd != undefined && window.showAdd)
+ if (window.showAdd !== undefined && window.showAdd)
{
this.add = new Add();
this.add.install();
@@ -53,12 +53,12 @@ function Main()
this.load = function(target)
{
document.activeElement.blur();
- if (this.queryCur != 'add')
+ if (this.queryCur !== 'add')
{
this.queryPrev = this.queryCur;
}
-
- target = target.substr(0,1) == "#" ? target.substr(1,target.length-1) : target;
+
+ target = target.substr(0,1) === "#" ? target.substr(1,target.length-1) : target;
this.queryCur = target.trim();
if (window.location.hash != this.queryCur)
@@ -66,7 +66,7 @@ function Main()
window.location.hash = this.queryCur;
}
- if (this.queryCur == 'add')
+ if (this.queryCur === 'add')
{
if (window.showAdd != undefined && window.showAdd)
{
diff --git a/docs/logic/view.js b/docs/logic/view.js
index 391f743..9862d97 100644
--- a/docs/logic/view.js
+++ b/docs/logic/view.js
@@ -52,7 +52,7 @@ function View()
this.display = function(db)
{
- if (window.showAdd != undefined && window.showAdd)
+ if (window.showAdd !== undefined && window.showAdd)
{
main.add.setOverlay(false);
}
@@ -104,12 +104,12 @@ function View()
}
}
- if (SETTINGS.SHOWIMAG)
+ if (
+ SETTINGS.SHOWIMAG
+ && typeof value.TYPE !== 'undefined' && value.TYPE === 'image'
+ )
{
- if (this.isDefined(value.TYPE) && value.TYPE == 'image')
- {
- itemClass += " griditem-image";
- }
+ itemClass += " griditem-image";
}
let entry = ``;
@@ -119,12 +119,9 @@ function View()
if (this.isDefined(value.LINK))
{
var idUrl = "url";
- if (this.isDefined(value.SEEN))
+ if (typeof value.SEEN !== 'undefined' && value.SEEN === "true")
{
- if (value.SEEN == "true")
- {
- idUrl = "urlseen";
- }
+ idUrl = "urlseen";
}
// LINK START
@@ -150,46 +147,34 @@ function View()
}
// LINK END
- if (SETTINGS.SHOWLINK)
+ if (SETTINGS.SHOWLINK && typeof value.LINK !== 'undefined')
{
- if (this.isDefined(value.LINK))
- {
- if (typeof value.LINK == 'object')
- {
- for (let l = 0; l < value.LINK.length; l++)
- {
- entry += ``;
- entry += `${this.extractRootDomain(value.LINK[l])}
`;
- }
- }
- else
- {
- entry += `
${this.extractRootDomain(value.LINK)}
`;
- }
- }
+ entry += `${this.extractRootDomain(value.LINK)}
`;
}
// TYPE
- if (SETTINGS.SHOWTYPE)
+ if (SETTINGS.SHOWTYPE && typeof value.TYPE !== 'undefined')
{
- entry += ``;
- if (this.isDefined(value.TYPE))
- {
- if (typeof value.TYPE == 'object')
- {
- // This entry has an array of types
- for (var i = 0; i < value.TYPE.length; i++)
- {
- entry += this.doTypeIcon(value.TYPE[i]);
- }
- }
- else
- {
- // This entry has a single type
- entry += this.doTypeIcon(value.TYPE[i]);
- }
+ let icon = '';
+ switch (value.TYPE) {
+ case 'article': icon = 'far fa-newspaper'; break;
+ case 'podcast': icon = 'fas fa-podcast'; break;
+ case 'video': icon = 'fas fa-tv'; break;
+ case 'list': icon = 'fas fa-file-alt'; break;
+ case 'book': icon = 'fas fa-book-open'; break;
+ case 'game': icon = 'fas fa-gamepad'; break;
+ case 'service': icon = 'fas fa-server'; break;
+ case 'lecture': icon = 'fas fa-chalkboard-teacher'; break;
+ case 'quote': icon = 'fas fa-comment'; break;
+ case 'tool': icon = 'fas fa-wrench'; break;
+ case 'music': icon = 'fas fa-music'; break;
+ case 'image': icon = 'fas fa-image'; break;
+ case 'encyclopedia': icon = 'fas fa-globe'; break;
}
- entry += `
`; //griditem-typecontainer
+
+ entry += ``;
+ entry += ``;
+ entry += ``;
}
// UPPER CONTENT END
@@ -202,30 +187,24 @@ function View()
entry += ``;
// AUTHOR
- if (SETTINGS.SHOWAUTH)
+ if (SETTINGS.SHOWAUTH && typeof value.AUTH !== 'undefined')
{
- if (this.isDefined(value.AUTH))
- {
- entry += `
${value.AUTH}
`;
- }
+ entry += `
${value.AUTH}
`;
}
// TAGS
- if (SETTINGS.SHOWTAGS)
+ if (SETTINGS.SHOWTAGS && typeof value.TAGS !== 'undefined')
{
- if (this.isDefined(value.TAGS))
+ entry += `
`;
}
// PROJECT
@@ -256,30 +235,27 @@ function View()
}
// NOTE
- if (SETTINGS.SHOWNOTE)
+ if (SETTINGS.SHOWNOTE && typeof value.NOTE !== 'undefined')
{
- if (this.isDefined(value.NOTE))
- {
- entry += this.buildArrayElement(value.NOTE, "griditem-note", "fas fa-sticky-note textIcon");
- }
+ entry += this.buildArrayElement(value.NOTE, "griditem-note", "fas fa-sticky-note textIcon");
}
// QUOTE
- if (SETTINGS.SHOWQOTE)
+ if (SETTINGS.SHOWQOTE && typeof value.QOTE !== 'undefined')
{
- if (this.isDefined(value.QOTE))
- {
- entry += this.buildArrayElement(value.QOTE, "griditem-quote", "fas fa-comment textIcon");
- }
+ entry += this.buildArrayElement(value.QOTE, "griditem-quote", "fas fa-comment textIcon");
+ }
+
+ // TERM
+ if (SETTINGS.SHOWTERM && typeof value.TERM !== 'undefined')
+ {
+ entry += this.buildArrayElement(value.TERM, "griditem-term", "fas fa-ribbon textIcon");
}
// PROGRESS
- if (SETTINGS.SHOWPROG)
+ if (SETTINGS.SHOWPROG && typeof value.PROG !== 'undefined')
{
- if (this.isDefined(value.PROG))
- {
- entry += `
${value.PROG}
`;
- }
+ entry += `
${value.PROG}
`;
}
// FILE
@@ -307,21 +283,19 @@ function View()
}
// IMAGE
- if (SETTINGS.SHOWIMAG)
+ if (
+ SETTINGS.SHOWIMAG
+ && typeof value.TYPE !== 'undefined' && value.TYPE === 'image'
+ && typeof value.FILE !== 'undefined'
+ )
{
- if (this.isDefined(value.TYPE) && value.TYPE == 'image')
+ entry += `
`;
+ if (SETTINGS.SHOWOVERLAY)
{
- if (this.isDefined(value.FILE))
- {
- entry += `
`;
- if (SETTINGS.SHOWOVERLAY)
- {
- entry += `
`;
- }
- entry += `
`;
- entry += `
`;
- }
+ entry += `
`;
}
+ entry += `
`;
+ entry += `
`;
}
entry += `
`;
@@ -380,8 +354,8 @@ function View()
this.stats = function(value)
{
let menuContent = ``;
-
- if (window.showAdd != undefined && window.showAdd)
+
+ if (window.showAdd !== undefined && window.showAdd)
{
// ADD
menuContent += `