From 6dba742ed0ade1bf8b5bee5f31cc61b1ba200d72 Mon Sep 17 00:00:00 2001 From: kor Date: Tue, 30 Oct 2018 02:45:34 +1300 Subject: [PATCH] Add handling and display of project field for entries. --- docs/asset/style.css | 4 +++- docs/content/data.ndtl | 3 ++- docs/logic/view.js | 21 ++++++++++++++++++++- docs/logic/wrap.js | 35 +++++++++++++++++++++++++++-------- 4 files changed, 52 insertions(+), 11 deletions(-) diff --git a/docs/asset/style.css b/docs/asset/style.css index 50becfb..f8b8c41 100644 --- a/docs/asset/style.css +++ b/docs/asset/style.css @@ -388,7 +388,7 @@ body { } /* NOTE, QUOTE, TERM, TAGS, AUTH, PROG */ -.griditem-note, .griditem-quote, .griditem-term, .griditem-tags, .griditem-auth, .griditem-prog { +.griditem-note, .griditem-quote, .griditem-term, .griditem-tags, .griditem-proj, .griditem-auth, .griditem-prog { opacity: var(--alpha-idle); padding-top: var(--size-item-elem-padding); color: var(--color-item); @@ -400,6 +400,7 @@ body { .griditem:hover .griditem-quote, .griditem:hover .griditem-term, .griditem:hover .griditem-tags, +.griditem:hover .griditem-proj, .griditem:hover .griditem-auth, .griditem:hover .griditem-prog { opacity: var(--alpha-enabled); @@ -410,6 +411,7 @@ body { .griditem-image .griditem-quote, .griditem-image .griditem-term, .griditem-image .griditem-tags, +.griditem-image .griditem-proj, .griditem-image .griditem-auth, .griditem-image .griditem-prog { color: var(--color-image); diff --git a/docs/content/data.ndtl b/docs/content/data.ndtl index 3dcd01e..e18d934 100644 --- a/docs/content/data.ndtl +++ b/docs/content/data.ndtl @@ -3872,7 +3872,6 @@ WHY WATER BATTERIES SBS 100F DATE : 12018-10-22 - TYPE : list NOTE > Recommended operating temperature range for optimum life and performance is 20°C to 25°C - On constant voltage float charge systems the design life expectancy is 10+ years at 25°C and 15+ years at 20°C @@ -3964,6 +3963,7 @@ LUGS (TERMINALS) TRACER BN COMMS DATE : 12018-10-23 + TYPE : tool LINK > https://github.com/danieloneill/EpsolarServer > https://github.com/jaminNZx/Tracer-RS485-Modbus-Blynk @@ -4010,6 +4010,7 @@ VAN ELECTRICAL GUIDES > https://www.parkedinparadise.com/electrical/ PROJ : Van TAGS : electronics + TYPE : list BATTERY BANK WIRING LINK : http://www.smartgauge.co.uk/batt_con.html diff --git a/docs/logic/view.js b/docs/logic/view.js index d8aed3e..3e5ceb0 100644 --- a/docs/logic/view.js +++ b/docs/logic/view.js @@ -20,6 +20,7 @@ function View() SHOWLINK: true, SHOWLOWER: true, SHOWTAGS: true, + SHOWPROJ: true, SHOWNOTE: true, SHOWQOTE: true, SHOWTERM: true, @@ -213,7 +214,25 @@ function View() for (var i = 0; i < value.TAGS.length; i++) { entry += `${value.TAGS[i]}`; - if (i+1 != value.TAGS.length) + if (i + 1 != value.TAGS.length) + { + entry += `, `; + } + }; + entry += ``; + } + } + + // PROJECT + { + if (SETTINGS.SHOWPROJ) + if (typeof value.PROJ !== 'undefined') + { + entry += `
`; + for (var i = 0; i < value.PROJ.length; i++) + { + entry += `${value.PROJ[i]}`; + if (i + 1 != value.PROJ.length) { entry += `, `; } diff --git a/docs/logic/wrap.js b/docs/logic/wrap.js index 517d10f..1bee90b 100644 --- a/docs/logic/wrap.js +++ b/docs/logic/wrap.js @@ -61,15 +61,34 @@ function Wrap() if (splitTarget[0] == 'tag') { // TAG - var tagDecoded = decodeURI(splitTarget[1]); - for (i = 0; i < this.keys.length; i++) + let tagRequest = decodeURI(splitTarget[1]); + for (let i = 0; i < this.keys.length; i++) { let value = this.database[this.keys[i]]; if (typeof value.TAGS !== 'undefined') { - for (var t = 0; t < value.TAGS.length; t++) + for (let t = 0; t < value.TAGS.length; t++) { - if (value.TAGS[t] == tagDecoded) + if (value.TAGS[t] == tagRequest) + { + tempDatabase[this.keys[i]] = this.database[this.keys[i]]; + } + } + } + } + } + if (splitTarget[0] == 'proj') + { + // PROJECT + let projectRequest = decodeURI(splitTarget[1]); + for (let i = 0; i < this.keys.length; i++) + { + let value = this.database[this.keys[i]]; + if (typeof value.PROJ !== 'undefined') + { + for (let p = 0; p < value.PROJ.length; p++) + { + if (value.PROJ[p] == projectRequest) { tempDatabase[this.keys[i]] = this.database[this.keys[i]]; } @@ -80,8 +99,8 @@ function Wrap() else if (splitTarget[0] == 'type') { // TYPE - var typeRequest = decodeURI(splitTarget[1]); - for (i = 0; i < this.keys.length; i++) + let typeRequest = decodeURI(splitTarget[1]); + for (let i = 0; i < this.keys.length; i++) { let value = this.database[this.keys[i]]; if (typeof value.TYPE !== 'undefined') @@ -111,8 +130,8 @@ function Wrap() else if (splitTarget[0] == 'done') { // DONE - var doneValue = decodeURI(splitTarget[1]); - for (i = 0; i < this.keys.length; i++) + let doneValue = decodeURI(splitTarget[1]); + for (let i = 0; i < this.keys.length; i++) { let value = this.database[this.keys[i]]; if (doneValue == 'true')