Skip to content

Commit 4697af5

Browse files
committed
Updated the custom page injector
1 parent ed12246 commit 4697af5

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

docs/doxygen-custom-page-injector.js

Lines changed: 16 additions & 10 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.2 //
5+
// Version: 1.0.3 //
66
//--------------------------------------------------//
77
document.addEventListener("DOMContentLoaded", () => {
88
// Get the injection wrapper element and nav to value
@@ -40,15 +40,21 @@ document.addEventListener("DOMContentLoaded", () => {
4040

4141
// Proceed if the new document is loaded
4242
document.addEventListener("DOMContentLoaded", () => {
43-
// Check if a value for nav to is provided
44-
/*if (navToValue !== null && navTo !== null) {
45-
// Wrap the original navTo function from doxygen into custom function
46-
let originalNavToFunc = navTo;
47-
navTo = (o, root, hash, relpath) => {
48-
// Ignore the root value and parse or nav to value instead
49-
originalNavToFunc(o, navToValue, hash, relpath);
50-
};
51-
}*/
43+
try {
44+
// Check if a value for nav to is provided
45+
if (navToValue !== null && navTo !== null) {
46+
// Wrap the original navTo function from doxygen into custom function
47+
let originalNavToFunc = navTo;
48+
navTo = (o, root, hash, relpath) => {
49+
// Ignore the root value and parse or nav to value instead
50+
originalNavToFunc(o, navToValue, hash, relpath);
51+
};
52+
}
53+
} catch {
54+
console.log(
55+
"[doxygen-custom-page-injector.js] Setting the correct nav item does not work with doxygen 1.10.0 or higher"
56+
);
57+
}
5258

5359
// Get the div that contains the content
5460
let contentContainer = document.getElementById("doc-content");

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

Lines changed: 16 additions & 10 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.2 //
5+
// Version: 1.0.3 //
66
//--------------------------------------------------//
77
document.addEventListener("DOMContentLoaded", () => {
88
// Get the injection wrapper element and nav to value
@@ -40,15 +40,21 @@ document.addEventListener("DOMContentLoaded", () => {
4040

4141
// Proceed if the new document is loaded
4242
document.addEventListener("DOMContentLoaded", () => {
43-
// Check if a value for nav to is provided
44-
/*if (navToValue !== null && navTo !== null) {
45-
// Wrap the original navTo function from doxygen into custom function
46-
let originalNavToFunc = navTo;
47-
navTo = (o, root, hash, relpath) => {
48-
// Ignore the root value and parse or nav to value instead
49-
originalNavToFunc(o, navToValue, hash, relpath);
50-
};
51-
}*/
43+
try {
44+
// Check if a value for nav to is provided
45+
if (navToValue !== null && navTo !== null) {
46+
// Wrap the original navTo function from doxygen into custom function
47+
let originalNavToFunc = navTo;
48+
navTo = (o, root, hash, relpath) => {
49+
// Ignore the root value and parse or nav to value instead
50+
originalNavToFunc(o, navToValue, hash, relpath);
51+
};
52+
}
53+
} catch {
54+
console.log(
55+
"[doxygen-custom-page-injector.js] Setting the correct nav item does not work with doxygen 1.10.0 or higher"
56+
);
57+
}
5258

5359
// Get the div that contains the content
5460
let contentContainer = document.getElementById("doc-content");

0 commit comments

Comments
 (0)