From 0328bae8f469650d2af4e0e5255b75b213c51d73 Mon Sep 17 00:00:00 2001 From: Subhamoy Biswas Date: Wed, 29 Nov 2023 22:32:10 +0530 Subject: [PATCH] (refactor): added some comments and formatting in floatingbar-config --- htdocs/assets/js/floatingbar-config.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/assets/js/floatingbar-config.js b/htdocs/assets/js/floatingbar-config.js index f7bf570..aa3731e 100644 --- a/htdocs/assets/js/floatingbar-config.js +++ b/htdocs/assets/js/floatingbar-config.js @@ -161,6 +161,7 @@ function fallback_search(searchDef, searchRes) { function inject_search_results (results, keyword) { searchRes.innerHTML = `

SEARCH RESULTS for '${keyword.toUpperCase()}'

`; + // search result category: projects if(typeof(results.project) !== 'undefined') { let projectDivTitle = document.createElement("p"); projectDivTitle.className = "text-xs text-accent_three mt-3 mb-2 mx-1"; @@ -190,6 +191,7 @@ function inject_search_results (results, keyword) { }); } + // search result category: socials if(typeof(results.social) !== 'undefined') { let socialDivTitle = document.createElement("p"); socialDivTitle.className = "text-xs text-accent_three mt-3 mb-2 mx-1"; @@ -216,6 +218,7 @@ function inject_search_results (results, keyword) { }); } + // search result category: site pages if(typeof(results.page) !== 'undefined') { let pageDivTitle = document.createElement("p"); pageDivTitle.className = "text-xs text-accent_three mt-3 mb-2 mx-1"; @@ -242,6 +245,7 @@ function inject_search_results (results, keyword) { }); } + // search result category: quick actions if(typeof(results.action) !== 'undefined') { let actionDivTitle = document.createElement("p"); actionDivTitle.className = "text-xs text-accent_three mt-3 mb-2 mx-1"; @@ -268,6 +272,7 @@ function inject_search_results (results, keyword) { }); } + // search result category: my profiles if(typeof(results.profile) !== 'undefined') { let profileDivTitle = document.createElement("p"); profileDivTitle.className = "text-xs text-accent_three mt-3 mb-2 mx-1"; @@ -315,6 +320,7 @@ function inject_no_results(results, keyword) { `; } +// when any charecter is inputed into the search bar searchInput.addEventListener('input', function() { if (searchInput.value != "") { perform_search(searchInput, searchDef, searchRes); @@ -355,6 +361,7 @@ function close_share() { isShareActive = false; } +// when Share Button is clicked shareBtn.addEventListener("click", function () { if(!isSearchActive) { activate_share(); @@ -365,6 +372,7 @@ shareBtn.addEventListener("click", function () { } }); +// when Close Share button is pressed shareCloseBtn.addEventListener("click", function () { close_share(); });