Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(configure): auto generate open urls #3163

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ INPUT = ../README.md \
contributing.md \
../third-party/doxyconfig/docs/source_code.md \
../src

# extra css
HTML_EXTRA_STYLESHEET += doc-styles.css

# extra js
HTML_EXTRA_FILES += configuration.js
37 changes: 37 additions & 0 deletions docs/configuration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* @brief Add a button to open the configuration option for each table
*/
document.addEventListener("DOMContentLoaded", function() {
const tables = document.querySelectorAll("table");
tables.forEach(table => {
if (table.className !== "doxtable") {
return;
}

let previousElement = table.previousElementSibling;
while (previousElement && previousElement.tagName !== "H2") {
previousElement = previousElement.previousElementSibling;
}
if (previousElement && previousElement.textContent) {
const sectionId = previousElement.textContent.trim().toLowerCase();
const newRow = document.createElement("tr");

const newCell = document.createElement("td");
newCell.setAttribute("colspan", "3");

const newCode = document.createElement("code");
newCode.className = "open-button";
newCode.setAttribute("onclick", `window.open('https://${document.getElementById('host-authority').value}/config/#${sectionId}', '_blank')`);
newCode.textContent = "Open";

newCell.appendChild(newCode);
newRow.appendChild(newCell);

// get the table body
const tbody = table.querySelector("tbody");

// Insert at the beginning of the table
tbody.insertBefore(newRow, tbody.firstChild);
}
});
});
Loading
Loading