diff --git a/zerobin/static/js/behavior.js b/zerobin/static/js/behavior.js index 7a71981..4d0a249 100644 --- a/zerobin/static/js/behavior.js +++ b/zerobin/static/js/behavior.js @@ -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; } diff --git a/zerobin/views/home.tpl b/zerobin/views/home.tpl index a890d25..9782eab 100644 --- a/zerobin/views/home.tpl +++ b/zerobin/views/home.tpl @@ -36,20 +36,24 @@ @keydown.ctrl.enter="encryptAndSendPaste()">