From 01573edfeade4fe88fc18dfc63bf7924eed25e08 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Sat, 29 Sep 2018 18:04:29 +0200 Subject: [PATCH] Refactoring --- src/renderer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/renderer.js b/src/renderer.js index c7cd143..8b54e31 100644 --- a/src/renderer.js +++ b/src/renderer.js @@ -245,7 +245,7 @@ function openImageDetails (event) { // Insert new tags tags.forEach(tag => { document.getElementById('TagsParent').insertAdjacentHTML('beforeend', ` -
  • ${tag}
  • +
  • ${tag}
  • `) }) }) @@ -402,9 +402,9 @@ document.getElementById('checkboxTheme').addEventListener('click', () => { } }) -// REFACTOR NEEDED -function handleSidenavTags (tag) { - // Add the tag to the search bar and actualize +// Add tag dynamically via sidenav +document.getElementById('TagsParent').addEventListener('click', (event) => { + let tag = event.target.innerText if (!isTagInSearchBar(tag)) { searchBar.value = `${searchBar.value} ${tag}` document.getElementById(`ADDCLASSTO_${tag}`).classList.add('sidenav-tags-in-searchbar') @@ -417,7 +417,7 @@ function handleSidenavTags (tag) { Refresh() M.toast({ html: `Removed ${tag}` }) } -} +}) // Handle links document.addEventListener('click', (event) => {