mirror of
https://github.com/sigmasternchen/drnk.me
synced 2025-03-15 09:48:54 +00:00
feat: Add copy feature
This commit is contained in:
parent
6a77e6636c
commit
6188e3e063
3 changed files with 8 additions and 0 deletions
6
html/static/js/copy.js
Normal file
6
html/static/js/copy.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
function copy(selector) {
|
||||||
|
let element = document.querySelector(selector);
|
||||||
|
navigator.clipboard.writeText(element.innerHTML);
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
|
@ -1,2 +1,3 @@
|
||||||
|
<script src="/static/js/copy.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<div class="result">
|
<div class="result">
|
||||||
<a href="<?php echo $data["url"] ?? ""; ?>" target="_blank"><?php echo $data["url"] ?? ""; ?></a>
|
<a href="<?php echo $data["url"] ?? ""; ?>" target="_blank"><?php echo $data["url"] ?? ""; ?></a>
|
||||||
|
<a href="javascript:copy('.result a')">copy</a>
|
||||||
</div>
|
</div>
|
||||||
<!-- <?php echo $data["accessKey"] ?? ""; ?> -->
|
<!-- <?php echo $data["accessKey"] ?? ""; ?> -->
|
||||||
Click <a hx-get="/?formonly" hx-swap="innerHTML" hx-target=".center-panel" href="/">here</a> to create a new link.
|
Click <a hx-get="/?formonly" hx-swap="innerHTML" hx-target=".center-panel" href="/">here</a> to create a new link.
|
||||||
|
|
Loading…
Reference in a new issue