mirror of
https://github.com/v1k45/pastepass.git
synced 2026-01-04 12:14:24 +00:00
Update copy labels for copy buttons in decrypt and paste views
This commit is contained in:
@@ -15,7 +15,7 @@ templ Decrypt(text string) {
|
||||
<div>
|
||||
<pre id="pastedContent" style="padding: 1rem; min-height: 10rem; max-height: 30rem;">{text}</pre>
|
||||
<div>
|
||||
<button onclick="copyText(this, '#pastedContent')" data-tooltip="Click to copy">Copy content</button>
|
||||
<button onclick="copyText(this, '#pastedContent')" data-copy-label="Copy content" data-tooltip="Click to copy">Copy content</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,7 +42,7 @@ func Decrypt(text string) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre><div><button onclick=\"copyText(this, '#pastedContent')\" data-tooltip=\"Click to copy\">Copy content</button></div></div></div>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre><div><button onclick=\"copyText(this, '#pastedContent')\" data-copy-label=\"Copy content\" data-tooltip=\"Click to copy\">Copy content</button></div></div></div>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ templ PasteSuccess(url string) {
|
||||
<div>
|
||||
<pre id="url" style="padding: 1rem; min-height: 3rem;">{url}</pre>
|
||||
<div>
|
||||
<button onclick="copyText(this, '#url')" data-tooltip="Click to copy">Copy content</button>
|
||||
<button onclick="copyText(this, '#url')" data-copy-label="Copy URL" data-tooltip="Click to copy">Copy URL</button>
|
||||
<a href={ templ.SafeURL(url) } style="margin-left: 1rem;">View Paste</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -42,7 +42,7 @@ func PasteSuccess(url string) templ.Component {
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre><div><button onclick=\"copyText(this, '#url')\" data-tooltip=\"Click to copy\">Copy content</button> <a href=\"")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre><div><button onclick=\"copyText(this, '#url')\" data-copy-label=\"Copy URL\" data-tooltip=\"Click to copy\">Copy URL</button> <a href=\"")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ templ copyTextScript() {
|
||||
event.dataset.tooltip = 'Copied!';
|
||||
event.innerText = 'Copied!';
|
||||
setTimeout(function() {
|
||||
event.innerText = 'Copy content';
|
||||
event.innerText = event.dataset.copyLabel;
|
||||
event.dataset.tooltip = 'Click to copy';
|
||||
event.blur();
|
||||
}, 1000);
|
||||
|
||||
@@ -23,7 +23,7 @@ func copyTextScript() templ.Component {
|
||||
templ_7745c5c3_Var1 = templ.NopComponent
|
||||
}
|
||||
ctx = templ.ClearChildren(ctx)
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n function copyText(event, selector) {\n var pastedContent = document.querySelector(selector);\n\n // Create a range and select the text\n var range = document.createRange();\n range.selectNode(pastedContent);\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(range);\n\n // Copy the selected text\n if (navigator.clipboard) {\n navigator.clipboard.writeText(pastedContent.innerText).then(function() {\n event.dataset.tooltip = 'Copied!';\n event.innerText = 'Copied!';\n setTimeout(function() {\n event.innerText = 'Copy content';\n event.dataset.tooltip = 'Click to copy';\n event.blur();\n }, 1000);\n });\n }\n }\n </script>")
|
||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script>\n function copyText(event, selector) {\n var pastedContent = document.querySelector(selector);\n\n // Create a range and select the text\n var range = document.createRange();\n range.selectNode(pastedContent);\n window.getSelection().removeAllRanges();\n window.getSelection().addRange(range);\n\n // Copy the selected text\n if (navigator.clipboard) {\n navigator.clipboard.writeText(pastedContent.innerText).then(function() {\n event.dataset.tooltip = 'Copied!';\n event.innerText = 'Copied!';\n setTimeout(function() {\n event.innerText = event.dataset.copyLabel;\n event.dataset.tooltip = 'Click to copy';\n event.blur();\n }, 1000);\n });\n }\n }\n </script>")
|
||||
if templ_7745c5c3_Err != nil {
|
||||
return templ_7745c5c3_Err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user