Skip to content

Commit

Permalink
Add copy button
Browse files Browse the repository at this point in the history
  • Loading branch information
humrochagf committed Nov 22, 2022
1 parent 702ec1d commit 6467aab
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 0 deletions.
36 changes: 36 additions & 0 deletions assets/sass/_code.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,39 @@ code > span > span {
}
}
}

.clipboard-button {
position: absolute;
right: 0;
margin: 5px;
font-size: 0.8em;
z-index: 1;

opacity: 0.3;
transition: 0.1s;
}

.clipboard-button svg {
fill: #c1c1c1;
}

.clipboard-button:hover {
cursor: pointer;
}

.clipboard-button:hover svg {
fill: #ffffff;
}

.clipboard-button:focus {
outline: 0;
}

.highlight {
position: relative;
}

.highlight:hover .clipboard-button {
opacity: 1;
transition: 0.2s;
}
4 changes: 4 additions & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,9 @@

{{ block "footerJS" . }}
{{ end }}

{{ if (findRE "<pre" .Content 1) }}
<script src="/copy/copy.js"></script>
{{ end }}
</body>
</html>
Loading

0 comments on commit 6467aab

Please sign in to comment.