File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 22layout: default
33---
44<!-- _layouts/guide.html -->
5+
6+
7+ <!-- TODO don't rely on jquery -->
8+ < script src ="https://code.jquery.com/jquery-3.2.1.min.js "> </ script >
9+ <!-- TODO don't rely resource available from site -->
10+ < script src ="https://cdn.jsdelivr.net/npm/clipboard@1/dist/clipboard.min.js "> </ script >
11+
12+
513{%- if page.version != site.data.kroxylicious.latestRelease -%}
614< div class ="admonitionblock note alert alert-info mb-0 " role ="alert ">
715 < i class ="bi bi-info-circle-fill krx-docs-note ms-2 me-4 fs-5 " title ="Note "> </ i >
@@ -35,5 +43,31 @@ <h1 class="card-title fs-3">
3543 </ div >
3644 </ div >
3745</ div >
46+
47+ < script >
48+ <!-- clipboard.js code -->
49+
50+ var allCodeBlocksElements = $ ( "code" ) ;
51+
52+ allCodeBlocksElements . each ( function ( i ) {
53+
54+ if ( $ ( this ) . parents ( '.listingblock' ) . length ) {
55+
56+ var currentId = "codeblock" + ( i + 1 ) ;
57+ $ ( this ) . attr ( 'id' , currentId ) ;
58+ //trigger
59+ var clipButton = '<button class="btn" data-clipboard-target="#' + currentId + '"><img src="https://clipboardjs.com/assets/images/clippy.svg" width="13" alt="Copy to clipboard"></button>' ;
60+ $ ( this ) . after ( clipButton ) ;
61+ }
62+ }
63+ ) ;
64+
65+ new Clipboard ( '.btn' ) ;
66+
67+ </ script >
68+
69+
3870{% include asciidoctor-scripts/icons.html %}
3971{% include asciidoctor-scripts/sectanchors.html %}
72+
73+
You can’t perform that action at this time.
0 commit comments