-
-
Notifications
You must be signed in to change notification settings - Fork 950
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(configure): auto generate open urls (#3163)
- Loading branch information
1 parent
8098df6
commit c892026
Showing
4 changed files
with
163 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.