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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user