fix: use execCommand clipboard fallback for Android/HTTP
This commit is contained in:
+3
-1
@@ -269,6 +269,8 @@ UI_HTML = r"""<!DOCTYPE html>
|
||||
.toolbar a:hover:not(.active) { background: #555; }
|
||||
}
|
||||
</style>
|
||||
<script>function copyText(t){var ta=document.createElement("textarea");ta.value=t;ta.style.position="fixed";ta.style.opacity="0";document.body.appendChild(ta);ta.select();try{document.execCommand("copy")}catch(e){prompt("Copy:",t)}document.body.removeChild(ta)}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>nash memory <span class="count">$COUNT entries</span></h1>
|
||||
@@ -309,7 +311,7 @@ def ui_index():
|
||||
short_id = e["id"][:8]
|
||||
card = (
|
||||
f'<div class="entry-header"><span class="entry-id">{_html.escape(short_id)}</span>'
|
||||
'<button class="copy-btn" type="button" onclick="navigator.clipboard.writeText(\'{_html.escape(e["id"])}\')">copy id</button>'
|
||||
'<button class="copy-btn" type="button" onclick="return copyText(\'{_html.escape(e["id"])}\')">copy id</button>'
|
||||
f'<form method="post" action="/-/delete/{_html.escape(e["id"])}" style="margin:0" onsubmit="return confirm(\'Delete this entry?\')">'
|
||||
'<button class="del-btn" type="submit">delete</button></form></div>'
|
||||
f'<div class="entry-text">{rendered}</div>'
|
||||
|
||||
Reference in New Issue
Block a user