diff --git a/docs/logic/main.js b/docs/logic/main.js
index b12bd91..67f130f 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();
@@ -55,12 +55,12 @@ function Main()
console.log('main.load: ' + 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)
@@ -68,7 +68,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 e719e95..220d565 100644
--- a/docs/logic/view.js
+++ b/docs/logic/view.js
@@ -52,7 +52,7 @@ function View()
{
console.log('display ' + db)
- if (window.showAdd != undefined && window.showAdd)
+ if (window.showAdd !== undefined && window.showAdd)
{
main.add.setOverlay(false);
}
@@ -99,12 +99,12 @@ function View()
}
}
- if (SETTINGS.SHOWIMAG)
+ if (
+ SETTINGS.SHOWIMAG
+ && typeof value.TYPE !== 'undefined' && value.TYPE === 'image'
+ )
{
- if (typeof value.TYPE !== 'undefined' && value.TYPE == 'image')
- {
- itemClass += " griditem-image";
- }
+ itemClass += " griditem-image";
}
let entry = ``;
@@ -115,12 +115,9 @@ function View()
if (typeof value.LINK !== 'undefined')
{
var idUrl = "url";
- if (typeof value.SEEN !== 'undefined')
+ if (typeof value.SEEN !== 'undefined' && value.SEEN === "true")
{
- if (value.SEEN == "true")
- {
- idUrl = "urlseen";
- }
+ idUrl = "urlseen";
}
// LINK START
@@ -142,76 +139,34 @@ function View()
}
// LINK END
- if (SETTINGS.SHOWLINK)
+ if (SETTINGS.SHOWLINK && typeof value.LINK !== 'undefined')
{
- if (typeof value.LINK !== 'undefined')
- {
- entry += `
${this.extractRootDomain(value.LINK)}
`;
- }
+ entry += `${this.extractRootDomain(value.LINK)}
`;
}
// TYPE
- if (SETTINGS.SHOWTYPE)
+ if (SETTINGS.SHOWTYPE && typeof value.TYPE !== 'undefined')
{
- if (typeof value.TYPE !== 'undefined')
- {
- entry += ``;
-
- if (value.TYPE == 'article')
- {
- entry += ``;
- }
- else if (value.TYPE == 'podcast')
- {
- entry += ``;
- }
- else if (value.TYPE == 'video')
- {
- entry += ``;
- }
- else if (value.TYPE == 'list')
- {
- entry += ``;
- }
- else if (value.TYPE == 'book')
- {
- entry += ``;
- }
- else if (value.TYPE == 'game')
- {
- entry += ``;
- }
- else if (value.TYPE == 'service')
- {
- entry += ``;
- }
- else if (value.TYPE == 'lecture')
- {
- entry += ``;
- }
- else if (value.TYPE == 'quote')
- {
- entry += ``;
- }
- else if (value.TYPE == 'tool')
- {
- entry += ``;
- }
- else if (value.TYPE == 'music')
- {
- entry += ``;
- }
- else if (value.TYPE == 'image')
- {
- entry += ``;
- }
- else if (value.TYPE == 'encyclopedia')
- {
- entry += ``;
- }
-
- entry += ``;
+ 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 += ``;
+ entry += ``;
+ entry += ``;
}
// UPPER CONTENT END
@@ -224,66 +179,48 @@ function View()
entry += ``;
// AUTHOR
- if (SETTINGS.SHOWAUTH)
+ if (SETTINGS.SHOWAUTH && typeof value.AUTH !== 'undefined')
{
- if (typeof value.AUTH !== 'undefined')
- {
- entry += `
${value.AUTH}
`;
- }
+ entry += `
${value.AUTH}
`;
}
// TAGS
- if (SETTINGS.SHOWTAGS)
+ if (SETTINGS.SHOWTAGS && typeof value.TAGS !== 'undefined')
{
- if (typeof value.TAGS !== 'undefined')
+ entry += `
`;
}
// NOTE
- if (SETTINGS.SHOWNOTE)
+ if (SETTINGS.SHOWNOTE && typeof value.NOTE !== 'undefined')
{
- if (typeof value.NOTE !== 'undefined')
- {
- 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 (typeof value.QOTE !== 'undefined')
- {
- 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)
+ if (SETTINGS.SHOWTERM && typeof value.TERM !== 'undefined')
{
- if (typeof value.TERM !== 'undefined')
- {
- entry += this.buildArrayElement(value.TERM, "griditem-term", "fas fa-ribbon textIcon");
- }
+ entry += this.buildArrayElement(value.TERM, "griditem-term", "fas fa-ribbon textIcon");
}
// PROGRESS
- if (SETTINGS.SHOWPROG)
+ if (SETTINGS.SHOWPROG && typeof value.PROG !== 'undefined')
{
- if (typeof value.PROG !== 'undefined')
- {
- entry += `
${value.PROG}
`;
- }
+ entry += `
${value.PROG}
`;
}
// LOWER CONTENT END
@@ -291,21 +228,19 @@ function View()
}
// IMAGE
- if (SETTINGS.SHOWIMAG)
+ if (
+ SETTINGS.SHOWIMAG
+ && typeof value.TYPE !== 'undefined' && value.TYPE === 'image'
+ && typeof value.FILE !== 'undefined'
+ )
{
- if (typeof value.TYPE !== 'undefined' && value.TYPE == 'image')
+ entry += `
`;
+ if (SETTINGS.SHOWOVERLAY)
{
- if (typeof value.FILE !== 'undefined')
- {
- entry += `
`;
- if (SETTINGS.SHOWOVERLAY)
- {
- entry += `
`;
- }
- entry += `
`;
- entry += `
`;
- }
+ entry += `
`;
}
+ entry += `
`;
+ entry += `
`;
}
entry += `
`;
@@ -316,8 +251,8 @@ function View()
this.stats = function(value)
{
let menuContent = ``;
-
- if (window.showAdd != undefined && window.showAdd)
+
+ if (window.showAdd !== undefined && window.showAdd)
{
// ADD
menuContent += `