1
1
mirror of https://github.com/neosubhamoy/neosubhamoy-portfolio.git synced 2025-12-20 01:09:35 +05:30

(fixed): search result pages not navigating properly by giving access to basePath

This commit is contained in:
2023-11-19 00:03:25 +05:30
parent 57e54e9ee0
commit fcec83f1e7
2 changed files with 3 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
<div id="floatingwindowwrapper" class="floatingwindowwrapper fixed top-0 left-0 w-screen h-screen z-30 bg-[rgba(0,_0,_0,_0.4)] hidden"></div>
<div id="phpHostBasePath" class="hidden" data-base-path="<?php echo htmlspecialchars($basePath);?>"></div>
<div id="searchwindow" class="searchwindow w-[90vw] md:w-[44vw] mx-auto h-[60vh] fixed inset-x-0 top-[30vh] z-40 flex-col items-center bg-bg_secondary rounded-xl overflow-y-scroll no-scrollbar hidden">
<div id="defresults" class="defresults w-full flex flex-col justify-start px-2 mt-1">
<p class="text-xs text-accent_three mt-3 mb-2 mx-1">PAGE SHOTCUTS</p>

View File

@@ -9,6 +9,7 @@ const windowWrapper = document.getElementById("floatingwindowwrapper");
const searchWin = document.getElementById("searchwindow");
const searchDef = document.getElementById("defresults");
const searchRes = document.getElementById("searchresults");
const basePath = document.getElementById('phpHostBasePath').dataset.basePath;
let lastScrollTop = 0;
window.addEventListener("scroll", function () {
@@ -183,7 +184,7 @@ function inject_search_results (results) {
results.page.forEach(function(result) {
let pageDiv = document.createElement("div");
pageDiv.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";
pageDiv.setAttribute("onclick", "location.href='" + result.link + "'");
pageDiv.setAttribute("onclick", "location.href='" + basePath + result.link + "'");
pageDiv.innerHTML = `
<span class="flex items-center">