Skip to content

Commit a68967d

Browse files
committed
bring back extra.js
1 parent c5ea4ff commit a68967d

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

docs/javascript/extra.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
function copyToClipboard(e) {
2+
e.preventDefault();
3+
navigator.clipboard.writeText(e.target.textContent);
4+
alert$.next('Copied to clipboard');
5+
}
6+
7+
function enableClipboardElements() {
8+
const copyElements = document.querySelectorAll('.copyMe');
9+
copyElements.forEach((element) => {
10+
element.addEventListener('click', copyToClipboard);
11+
});
12+
}
13+
14+
const attachListeners = () => {
15+
enableSearchOnBlurElement();
16+
enableClipboardElements();
17+
};
18+
19+
const init = () => {
20+
attachListeners();
21+
};
22+
23+
init();

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ plugins:
140140
extra_css:
141141
- stylesheets/extra.css
142142
extra_javascript:
143+
- javascript/extra.js
143144
- https://docs.powertools.aws.dev/shared/mermaid.min.js
144145
- https://docs.aws.amazon.com/assets/js/awsdocs-boot.js
145146

0 commit comments

Comments
 (0)