diff --git a/assets/js/butter-dir-listing.js b/assets/js/butter-dir-listing.js index 819628d..dc5f9f3 100644 --- a/assets/js/butter-dir-listing.js +++ b/assets/js/butter-dir-listing.js @@ -9,12 +9,15 @@ console.log("butter-dir-listing.js loaded!"); const supported_extensions = [".apk"]; +const usbRoot = "/usb-butter/"; +const inferredBaseURL = window.location.pathname.split("/usb-butter/")[0] + "/"; +console.log("Inferred Base URL:", inferredBaseURL); const getFolderDivHTML = (directory_name, number_of_items, href) => { return `
- directory + directory
${directory_name}
@@ -33,7 +36,7 @@ const getFileDivHTML = (file_name, size, date, href) => { return `
- directory + directory
${file_name}
@@ -99,7 +102,6 @@ window.onload = function () { const listDiv = document.querySelector('div.list'); // Header with breadcrumbs - const usbRoot = "/usb-butter/"; const h2Path = document.querySelector('h2').textContent; console.log("H2 Path:", h2Path); const path = h2Path.replace('Index of ', '').replace(usbRoot, ''); @@ -108,8 +110,8 @@ window.onload = function () { const breadcrumbs = document.createElement("div"); breadcrumbs.classList.add('breadcrumbs'); let breadcrumbHTML = ` -
home - Explore + home + Explore `; pathSteps = path.split('/'); let pathToHere = usbRoot; @@ -117,7 +119,7 @@ window.onload = function () { pathToHere += step + '/'; if (step !== "") { breadcrumbHTML += ` - ${step}`; + ${step}`; } }); breadcrumbs.innerHTML = breadcrumbHTML;