1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00

Add copy btc to clipboard

This commit is contained in:
ksamuel
2020-08-15 10:02:57 +02:00
parent 3a40ea6694
commit eb22cd90b2
3 changed files with 59 additions and 18 deletions

View File

@@ -27,6 +27,7 @@ var app = new Vue({
openPreviousPastesMenu: false,
readerMode: false,
isUploading: false,
btcCopied: false,
currentPaste: {
ownerKey: '',
id: '',
@@ -205,6 +206,26 @@ var app = new Vue({
},
copyBTCToClipboard: function () {
var promise = navigator.clipboard.writeText(this.currentPaste.btcTipAddress);
app.btcCopied = true;
promise.then(function () {
if (app.btcCopied) {
clearTimeout(app.btcCopied);
}
app.btcCopied = setTimeout(function () {
app.btcCopied = false;
}, 3000)
}, function (err) {
zerobin.message('danger', 'The BTC addresse could not be copied', '', true);
});
},
/**
On the create paste page:
On click on the send button, compress and encrypt data before
@@ -907,7 +928,7 @@ window.onload = function () {
app.currentPaste.title = title.innerText;
}
var btcTipAddress = document.querySelector('.btc-tip-address a');
var btcTipAddress = document.querySelector('.btc-tip-address');
if (btcTipAddress) {
app.currentPaste.btcTipAddress = btcTipAddress.innerText;
}