Skip to content

Commit 7f4c432

Browse files
committed
Update doxygen-custom-page-injector.js
1 parent cdfbfbb commit 7f4c432

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

doxygen/js/doxygen-custom-page-injector.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Created by basicx-StrgV //
33
// https://github.com/basicx-StrgV/ //
44
//--------------------------------------------------//
5-
// Version: 1.0.1 //
5+
// Version: 1.0.2 //
66
//--------------------------------------------------//
77
document.addEventListener("DOMContentLoaded", () => {
88
// Get the injection wrapper element and nav to value
@@ -16,8 +16,20 @@ document.addEventListener("DOMContentLoaded", () => {
1616
return;
1717
}
1818

19-
// Get url for index page
20-
let url = window.location.origin + "/index.html";
19+
// Get current url
20+
let currentLocation = String(window.location);
21+
// Find the last url separator
22+
let lastUrlSeperator = 0;
23+
for (let i = 0; i < currentLocation.length; i++) {
24+
// Save index of the current url separator
25+
if (currentLocation[i] == "/") {
26+
lastUrlSeperator = i;
27+
}
28+
}
29+
// Extract root url
30+
let rootUrl = currentLocation.slice(0, lastUrlSeperator);
31+
// Set index.html url
32+
let url = rootUrl + "/index.html";
2133

2234
// Request html content from the index page
2335
const htmlReq = new XMLHttpRequest();

0 commit comments

Comments
 (0)