remove icon and change styles

This commit is contained in:
Hayden 2022-10-22 10:12:15 -08:00
parent c39b778234
commit e8e21d561e

View file

@ -18,9 +18,7 @@
<br> <br>
<div class="code-container"> <div class="code-container">
<button id="copy-button" class="copy-button"> <button id="copy-button" class="copy-button">
<svg id="copy-icon" style="width:24px;height:24px" viewBox="0 0 24 24"> Copy
<path fill="currentColor" d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" />
</svg>
</button> </button>
<div style="clear: both;"> <div style="clear: both;">
{% if args.highlightsyntax %} {% if args.highlightsyntax %}
@ -32,11 +30,15 @@
</div> </div>
<script> <script>
const btn = document.getElementById("copy-icon") const btn = document.getElementById("copy-button")
const content = `{{ pasta.content_escaped() }}` const content = `{{ pasta.content_escaped() }}`
btn.addEventListener("click", () => { btn.addEventListener("click", () => {
navigator.clipboard.writeText(content) navigator.clipboard.writeText(content)
btn.innerHTML = "Copied"
setTimeout(() => {
btn.innerHTML = "Copy"
}, 1000)
}) })
</script> </script>
@ -79,8 +81,8 @@ code-line::before {
background: transparent; background: transparent;
top: 0; top: 0;
right: 0; right: 0;
padding: 8px; padding: 3px;
margin: 5px; margin: 3px;
} }
</style> </style>