Skip to content

Commit d16db59

Browse files
committed
first working
Signed-off-by: Keith Wall <[email protected]>
1 parent f5f4cbf commit d16db59

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

_layouts/guide.html

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
layout: 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+

0 commit comments

Comments
 (0)