diff --git a/htdocs/assets/js/floatingbar-config.js b/htdocs/assets/js/floatingbar-config.js index 24bd5c9..c80cdf2 100644 --- a/htdocs/assets/js/floatingbar-config.js +++ b/htdocs/assets/js/floatingbar-config.js @@ -111,8 +111,8 @@ function perform_search(searchInput, searchDef, searchRes) { resultTags.forEach(tag => { result[tag] = response.filter(item => item.tag === tag); }); - console.log(result); - inject_search_results(result.project); + + inject_search_results(result); } }, error: function(error) { @@ -134,27 +134,50 @@ function fallback_search(searchDef, searchRes) { function inject_search_results (results) { searchRes.innerHTML = `

SEARCH RESULTS

`; - results.forEach(function(result) { - let projectsDiv = document.createElement("div"); - projectsDiv.className = "group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg"; - projectsDiv.setAttribute("onclick", "location.href='" + result.link + "'"); - - projectsDiv.innerHTML = ` - - ${result.name.charAt(0).toUpperCase()} - -
${result.name}
-

${result.description.slice(0, 35) + '...'}

+ if(typeof(results.project) !== 'undefined') { + results.project.forEach(function(result) { + let projectDiv = document.createElement("div"); + projectDiv.className = "group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg"; + projectDiv.setAttribute("onclick", "location.href='" + result.link + "'"); + + projectDiv.innerHTML = ` + + ${result.name.charAt(0).toUpperCase()} + +
${result.name}
+

${result.description.slice(0, 35) + '...'}

+
+ + ${'#' + result.tag} + + + `; + + searchRes.appendChild(projectDiv); + }); + } + + if(typeof(results.social) !== 'undefined') { + results.social.forEach(function(result) { + let socialDiv = document.createElement("div"); + socialDiv.className = "group resultitem w-full flex justify-between items-center my-1 p-1 cursor-pointer hover:bg-bg_third transition transform duration-200 rounded-lg"; + socialDiv.setAttribute("onclick", "window.open('" + result.link + "', '_blank')"); + + socialDiv.innerHTML = ` + + +

${result.platform}

${'#' + result.tag} - `; - - searchRes.appendChild(projectsDiv); - }); + `; + + searchRes.appendChild(socialDiv); + }); + } } function inject_no_results(results) { diff --git a/htdocs/assets/style.css b/htdocs/assets/style.css index 38f0147..5e45f4b 100644 --- a/htdocs/assets/style.css +++ b/htdocs/assets/style.css @@ -635,6 +635,14 @@ video { z-index: 50; } +.m-1 { + margin: 0.25rem; +} + +.m-2 { + margin: 0.5rem; +} + .mx-1 { margin-left: 0.25rem; margin-right: 0.25rem;