mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-12-06 09:59:28 +00:00
contrib/html: support click on code block to copy to clipboard
This commit is contained in:
parent
638258000b
commit
903a3f44a0
3 changed files with 7 additions and 0 deletions
|
|
@ -10,12 +10,14 @@ sed \
|
||||||
-e "s|__LOGO__|$(realpath --relative-to="${RELTO}" logo.png)|" \
|
-e "s|__LOGO__|$(realpath --relative-to="${RELTO}" logo.png)|" \
|
||||||
-e "s|__EWORM__|$(realpath --relative-to="${RELTO}" general/eworm-meadow.avif)|" \
|
-e "s|__EWORM__|$(realpath --relative-to="${RELTO}" general/eworm-meadow.avif)|" \
|
||||||
-e "s|__QR_CODE__|$(realpath --relative-to="${RELTO}" general/qr-code.png)|" \
|
-e "s|__QR_CODE__|$(realpath --relative-to="${RELTO}" general/qr-code.png)|" \
|
||||||
|
-e "s|__CLIPBOARD__|$(realpath --relative-to="${RELTO}" general/clipboard.js)|" \
|
||||||
< "${0}.d/head.html"
|
< "${0}.d/head.html"
|
||||||
|
|
||||||
markdown -f toc,idanchor "${1}" | sed \
|
markdown -f toc,idanchor "${1}" | sed \
|
||||||
-e 's/href="\([-_\./[:alnum:]]*\)\.md\(#[-[:alnum:]]*\)\?"/href="\1.html\2"/g' \
|
-e 's/href="\([-_\./[:alnum:]]*\)\.md\(#[-[:alnum:]]*\)\?"/href="\1.html\2"/g' \
|
||||||
-e '/<h[1234] /s| id="\(.*\)">| id="\L\1">|' \
|
-e '/<h[1234] /s| id="\(.*\)">| id="\L\1">|' \
|
||||||
-e '/<h[1234] /s|-2[1789cd]-||g' -e '/<h[1234] /s|--26-amp-3b-||g' \
|
-e '/<h[1234] /s|-2[1789cd]-||g' -e '/<h[1234] /s|--26-amp-3b-||g' \
|
||||||
|
-e '/^<pre>/s|pre|pre onclick="CopyToClipboard(this)"|g' \
|
||||||
-e '/The above link may be broken on code hosting sites/s|blockquote|blockquote style="display: none;"|'
|
-e '/The above link may be broken on code hosting sites/s|blockquote|blockquote style="display: none;"|'
|
||||||
|
|
||||||
sed \
|
sed \
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
<title>RouterOS Scripts :: __TITLE__</title>
|
<title>RouterOS Scripts :: __TITLE__</title>
|
||||||
<link rel="stylesheet" type="text/css" href="__STYLE__">
|
<link rel="stylesheet" type="text/css" href="__STYLE__">
|
||||||
<link rel="icon" type="image/png" href="__LOGO__">
|
<link rel="icon" type="image/png" href="__LOGO__">
|
||||||
|
<script type="text/javascript" src="__CLIPBOARD__"></script>
|
||||||
</head><body>
|
</head><body>
|
||||||
|
|
||||||
<table><tr>
|
<table><tr>
|
||||||
|
|
|
||||||
4
general/clipboard.js
Normal file
4
general/clipboard.js
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
/* copy code to clipboard */
|
||||||
|
function CopyToClipboard(element) {
|
||||||
|
navigator.clipboard.writeText(element.firstElementChild.innerHTML);
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue