mirror of
https://github.com/suitenumerique/meet.git
synced 2026-11-21 07:16:36 +00:00
d06fddab56
Add a documentation site built with Zensical: getting started, self-hosting with compose and Kubernetes, configuration, user guide, contributing and reference pages, and every environment variable on one page, grouped by feature. Co-authored-by: davd-gzl <60177543+davd-gzl@users.noreply.github.com>
22 lines
748 B
JavaScript
22 lines
748 B
JavaScript
// The copy button of a terminal block copies its commands alone: no $ prompt, no output.
|
|
// The text is built at the click, so a page the preview reloaded copies what it shows.
|
|
function consoleCommands(code) {
|
|
const commands = []
|
|
for (const line of code.textContent.split("\n")) {
|
|
if (line.startsWith("$ ")) commands.push(line.slice(2))
|
|
}
|
|
return commands.join("\n")
|
|
}
|
|
|
|
document.addEventListener(
|
|
"click",
|
|
(event) => {
|
|
const button = event.target.closest("[data-clipboard-target]")
|
|
if (!button) return
|
|
const code = document.querySelector(button.dataset.clipboardTarget)
|
|
const commands = code?.querySelector(".gp") && consoleCommands(code)
|
|
if (commands) code.closest("pre").dataset.copy = commands
|
|
},
|
|
true,
|
|
)
|