mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Add copy link confirmation
This commit is contained in:
parent
eb9dc95c58
commit
dcf8783c2e
@ -29,9 +29,9 @@
|
||||
@if (env.OnionUrl != null)
|
||||
{
|
||||
<div class="text-center">
|
||||
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl">
|
||||
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl" style="min-width:117px;">
|
||||
<img src="~/img/icons/onion-purple.svg" height="20" class="mr-2" asp-append-version="true" />
|
||||
Copy Tor URL
|
||||
<span data-clipboard-confirm="Copied URL ✔">Copy Tor URL</span>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
@ -33,9 +33,9 @@
|
||||
@if (env.OnionUrl != null)
|
||||
{
|
||||
<div class="text-center">
|
||||
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl">
|
||||
<a href="@env.OnionUrl" target="_onion" class="btn btn-sm btn-outline-onion d-inline-flex align-items-center text-nowrap p-2" data-clipboard="@env.OnionUrl" style="min-width:117px;">
|
||||
<img src="~/img/icons/onion-purple.svg" height="20" class="mr-2" asp-append-version="true" />
|
||||
Copy Tor URL
|
||||
<span data-clipboard-confirm="Copied URL ✔">Copy Tor URL</span>
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
|
@ -192,8 +192,13 @@
|
||||
document.getElementById("copyLink").addEventListener("click", function (e) {
|
||||
if (navigator.clipboard) {
|
||||
e.preventDefault();
|
||||
navigator.clipboard.writeText(window.location);
|
||||
e.currentTarget.blur();
|
||||
var button = e.currentTarget;
|
||||
if (!button.dataset.initialText) button.dataset.initialText = button.innerText;
|
||||
navigator.clipboard.writeText(window.location).then(function () {
|
||||
button.innerText = 'Copied ✔';
|
||||
setTimeout(function() { button.innerText = button.dataset.initialText; }, 2500);
|
||||
});
|
||||
button.blur();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@ -85,7 +85,17 @@ $(function () {
|
||||
e.preventDefault();
|
||||
var item = e.currentTarget;
|
||||
var text = item.getAttribute('data-clipboard');
|
||||
navigator.clipboard.writeText(text);
|
||||
var confirm = item.querySelector('[data-clipboard-confirm]') || item;
|
||||
var message = confirm.getAttribute('data-clipboard-confirm') || 'Copied ✔';
|
||||
if (!confirm.dataset.clipboardInitialText) {
|
||||
confirm.dataset.clipboardInitialText = confirm.innerText;
|
||||
console.log(confirm.clientWidth)
|
||||
confirm.style.minWidth = confirm.clientWidth + 'px';
|
||||
}
|
||||
navigator.clipboard.writeText(text).then(function () {
|
||||
confirm.innerText = message;
|
||||
setTimeout(function(){ confirm.innerText = confirm.dataset.clipboardInitialText; }, 2500);
|
||||
});
|
||||
item.blur();
|
||||
}
|
||||
});
|
||||
|
@ -87,8 +87,13 @@ addLoadEvent(function (ev) {
|
||||
copyLink: function (e) {
|
||||
if (navigator.clipboard) {
|
||||
e.preventDefault();
|
||||
navigator.clipboard.writeText(window.location);
|
||||
e.currentTarget.blur();
|
||||
var button = e.currentTarget;
|
||||
if (!button.dataset.initialText) button.dataset.initialText = button.innerText;
|
||||
navigator.clipboard.writeText(window.location).then(function () {
|
||||
button.innerText = 'Copied ✔';
|
||||
setTimeout(function() { button.innerText = button.dataset.initialText; }, 2500);
|
||||
});
|
||||
button.blur();
|
||||
}
|
||||
},
|
||||
cancelPayment: function (amount) {
|
||||
|
Loading…
Reference in New Issue
Block a user