www/src/layouts/partials/clipboard-copy.html

75 lines
1.7 KiB
HTML
Raw Normal View History

2022-10-17 19:38:31 +03:00
<hr>
2022-10-18 00:16:50 +03:00
<div class="row button-container">
<input class="one-liner" type="text" value="$ sh <(curl tea.xyz) install&nbsp;{{- .Title -}}" id="myInput" readonly>
2022-10-17 19:38:31 +03:00
2022-10-18 00:16:50 +03:00
<!-- The button used to copy the text -->
2022-10-19 19:12:38 +03:00
<button class="clipboard-copy" onclick="myFunction()" id="copy-icon"><i class="icon-clipboard"></i></button>
2022-10-18 00:16:50 +03:00
</div>
<hr>
2022-10-17 19:38:31 +03:00
2022-10-19 16:42:46 +03:00
2022-10-17 19:38:31 +03:00
<style>
.one-liner{
width: 85%;
2022-10-18 00:37:39 +03:00
padding: 2.455vw 4.185vw;
2022-10-17 19:38:31 +03:00
border-radius: 0px;
border: none;
background-color: #1a1a1a !important;
font-family: "pp-neue-machina";
color:#4d4d4d;
font-size: 2.1vw;
2022-10-18 00:16:50 +03:00
border-left: 2px solid #949494;
border-right: 2px solid #949494;
}
.one-liner:focus{
border:none;
outline: none;
border-left: 2px solid #949494;
border-right: 2px solid #949494;
2022-10-17 19:38:31 +03:00
}
.clipboard-copy{
height: 8.371vw;
width: 14%;
font-family: "pp-neue-machina";
color:#4d4d4d;
font-size: 2.1vw;
float:right;
background-color: #1a1a1a !important;
border: none;
2022-10-18 00:16:50 +03:00
border-right: 2px solid #949494;
transition: 0.2s linear;
2022-10-17 19:38:31 +03:00
}
.clipboard-copy:hover{
background-color: #00ffd0 !important;
color: #1a1a1a !important;
2022-10-18 00:16:50 +03:00
box-shadow: inset 0vw 0vw 0vw 0.558vw #1a1a1a !important;
2022-10-17 19:38:31 +03:00
}
</style>
<script>
2022-10-18 00:37:39 +03:00
2022-10-17 19:38:31 +03:00
function myFunction() {
// Get the text field
var copyText = document.getElementById("myInput");
// Select the text field
copyText.select();
copyText.setSelectionRange(0, 99999); // For mobile devices
// Copy the text inside the text field
navigator.clipboard.writeText(copyText.value);
// Alert the copied text
alert("Copied " + copyText.value + " to clipboard");
2022-10-19 19:12:38 +03:00
// Copy icon
document.getElementById("copy-icon").innerHTML = "copied!";
2022-10-17 19:38:31 +03:00
}
2022-10-18 00:16:50 +03:00
2022-10-17 19:38:31 +03:00
</script>