Add support tags with spaces by lcb931023.

This commit is contained in:
kor 2018-08-10 03:38:34 +12:00
parent 00745d35ad
commit 8b0c2cc066
3 changed files with 6 additions and 4 deletions

View File

@ -1709,7 +1709,7 @@ RANGITOTO
FILE : 12018-07-19_wide.jpg FILE : 12018-07-19_wide.jpg
TYPE : image TYPE : image
WIDE : true WIDE : true
TAGS : log TAGS : log, test test
MQTT MQTT
PERS : autophagy PERS : autophagy

View File

@ -231,7 +231,7 @@ function View()
entry += `<div class="tags"><i class="fas fa-tag textIcon"></i>`; entry += `<div class="tags"><i class="fas fa-tag textIcon"></i>`;
for (var i = 0; i < value.TAGS.length; i++) for (var i = 0; i < value.TAGS.length; i++)
{ {
entry += `<a href=#tag-${value.TAGS[i]}>${value.TAGS[i]}</a>`; entry += `<a href="#tag-${value.TAGS[i]}">${value.TAGS[i]}</a>`;
if (i+1 != value.TAGS.length) if (i+1 != value.TAGS.length)
{ {
entry += `, `; entry += `, `;

View File

@ -76,6 +76,7 @@ function Wrap()
if (splitTarget[0] == 'tag') if (splitTarget[0] == 'tag')
{ {
// TAG // TAG
var tagDecoded = decodeURI(splitTarget[1]);
for (i = 0; i < this.keys.length; i++) for (i = 0; i < this.keys.length; i++)
{ {
let value = this.database[this.keys[i]]; let value = this.database[this.keys[i]];
@ -83,7 +84,7 @@ function Wrap()
{ {
for (var t = 0; t < value.TAGS.length; t++) for (var t = 0; t < value.TAGS.length; t++)
{ {
if (value.TAGS[t] == splitTarget[1]) if (value.TAGS[t] == tagDecoded)
{ {
tempDatabase[this.keys[i]] = this.database[this.keys[i]]; tempDatabase[this.keys[i]] = this.database[this.keys[i]];
} }
@ -94,13 +95,14 @@ function Wrap()
else if (splitTarget[0] == 'type') else if (splitTarget[0] == 'type')
{ {
// TYPE // TYPE
var tagDecoded = decodeURI(splitTarget[1]);
var tempDatabase = {} var tempDatabase = {}
for (i = 0; i < this.keys.length; i++) for (i = 0; i < this.keys.length; i++)
{ {
let value = this.database[this.keys[i]]; let value = this.database[this.keys[i]];
if (typeof value.TYPE !== 'undefined') if (typeof value.TYPE !== 'undefined')
{ {
if (value.TYPE == splitTarget[1]) if (value.TYPE == tagDecoded)
{ {
tempDatabase[this.keys[i]] = this.database[this.keys[i]]; tempDatabase[this.keys[i]] = this.database[this.keys[i]];
} }