mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-20 01:09:35 +05:30
(refactor): added explination comments on flotingbar-config
This commit is contained in:
@@ -130,6 +130,7 @@ function perform_search(searchInput, searchDef, searchRes) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to display default search results
|
||||||
function fallback_search(searchDef, searchRes) {
|
function fallback_search(searchDef, searchRes) {
|
||||||
searchDef.classList.remove("hidden");
|
searchDef.classList.remove("hidden");
|
||||||
searchDef.classList.add("flex");
|
searchDef.classList.add("flex");
|
||||||
@@ -137,6 +138,7 @@ function fallback_search(searchDef, searchRes) {
|
|||||||
searchRes.classList.add("hidden");
|
searchRes.classList.add("hidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to inject proper search results with category based styling
|
||||||
function inject_search_results (results, keyword) {
|
function inject_search_results (results, keyword) {
|
||||||
searchRes.innerHTML = `<p class="text-sm text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS for '${keyword.toUpperCase()}'</p>`;
|
searchRes.innerHTML = `<p class="text-sm text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS for '${keyword.toUpperCase()}'</p>`;
|
||||||
|
|
||||||
@@ -278,11 +280,13 @@ function inject_search_results (results, keyword) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add an extra bottom spacer item for better appearance
|
||||||
const bottomSpacer = document.createElement("div");
|
const bottomSpacer = document.createElement("div");
|
||||||
bottomSpacer.className = "bottomspacer w-full h-[10px]";
|
bottomSpacer.className = "bottomspacer w-full h-[10px]";
|
||||||
searchRes.appendChild(bottomSpacer);
|
searchRes.appendChild(bottomSpacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to display NO RESULTS FOUND as result
|
||||||
function inject_no_results(results, keyword) {
|
function inject_no_results(results, keyword) {
|
||||||
searchRes.innerHTML = `
|
searchRes.innerHTML = `
|
||||||
<p class="text-sm text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS for '${keyword.toUpperCase()}'</p>
|
<p class="text-sm text-accent_three mt-3 mb-2 mx-1">SEARCH RESULTS for '${keyword.toUpperCase()}'</p>
|
||||||
@@ -304,6 +308,7 @@ searchInput.addEventListener('input', function() {
|
|||||||
|
|
||||||
//---share window config starts here
|
//---share window config starts here
|
||||||
|
|
||||||
|
// function to open the share window
|
||||||
function activate_share() {
|
function activate_share() {
|
||||||
//create qrcode of the current page link
|
//create qrcode of the current page link
|
||||||
qrCode.src = "https://api.qrserver.com/v1/create-qr-code/?data=" + window.location.href + "&color=38BDF8&bgcolor=0F172A";
|
qrCode.src = "https://api.qrserver.com/v1/create-qr-code/?data=" + window.location.href + "&color=38BDF8&bgcolor=0F172A";
|
||||||
@@ -319,6 +324,7 @@ function activate_share() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to close the share window
|
||||||
function close_share() {
|
function close_share() {
|
||||||
windowWrapper.classList.remove("flotingbar-window-wrapper-show");
|
windowWrapper.classList.remove("flotingbar-window-wrapper-show");
|
||||||
windowWrapper.classList.add("hidden");
|
windowWrapper.classList.add("hidden");
|
||||||
@@ -335,6 +341,7 @@ shareCloseBtn.addEventListener("click", function () {
|
|||||||
close_share();
|
close_share();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// function to share with webShareAPI (Native OS Share)
|
||||||
function call_webshare_api() {
|
function call_webshare_api() {
|
||||||
if(navigator.share) {
|
if(navigator.share) {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
@@ -355,6 +362,7 @@ function call_webshare_api() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// function to copy text based content to device clipboard
|
||||||
function copy_to_clipboard(textContent, copyContext) {
|
function copy_to_clipboard(textContent, copyContext) {
|
||||||
if(navigator.clipboard) {
|
if(navigator.clipboard) {
|
||||||
navigator.clipboard.writeText(textContent).then(function() {
|
navigator.clipboard.writeText(textContent).then(function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user