1
0
mirror of https://github.com/Tygs/0bin.git synced 2023-08-10 21:13:00 +03:00
This commit is contained in:
papee 2020-08-15 10:33:19 +02:00
commit d11081fc54
6 changed files with 56 additions and 17 deletions

File diff suppressed because one or more lines are too long

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({
},
copyBTCAdressToClipboard: 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
@ -722,6 +743,12 @@ window.zerobin = {
content.value = event.target.result
image.onload = function () {
app.messages = []
var previousImage = document.querySelector('.paste-wrapper');
if (previousImage) {
previousImage.remove();
}
var imgWrapper = document.createElement('div');
imgWrapper.classList.add('paste-wrapper');
imgWrapper.appendChild(image)
@ -907,7 +934,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;
}

File diff suppressed because one or more lines are too long

View File

@ -91,7 +91,7 @@
<p :class="'alert alert-' + msg.type" v-for="msg in messages">
<a class="close" data-dismiss="alert" href="#" @click="$event.target.parentNode.remove()">×</a>
<a class="close" data-dismiss="alert" href="#" @click.prevent="$event.target.parentNode.remove()">×</a>
<strong class="title" v-if="msg.title" v-html="msg.title"></strong>
<span class="message" v-html="msg.content"></span>
<a v-if="msg.action.message" href="#"

View File

@ -36,20 +36,24 @@
@keydown.ctrl.enter="encryptAndSendPaste()"></textarea>
<div class="paste-options">
<h6>Paste Options (these options are optionals)</h6>
<h6>Optional fields (those are <em>not</em> encrypted):</h6>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Title</span>
</div>
<input type="text" class="form-control paste-excerpt" name="paste-excerpt"
placeholder="Optional paste title. This part is NOT encrypted: anything you type here will be visible by anyone"
placeholder="Anything you type here will be visible by anyone, including search engines."
v-model="newPaste.title" maxlength="60">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">BTC tip</span>
<span class="input-group-text" id="basic-addon1"><strong><svg xmlns="http://www.w3.org/2000/svg" width="18"
height="18" viewBox="0 0 24 24">
<path
d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm0 18v-1.511h-.5v1.511h-1v-1.511h-2.484l.25-1.489h.539c.442 0 .695-.425.695-.854v-4.444c0-.416-.242-.702-.683-.702h-.817v-1.5h2.5v-1.5h1v1.5h.5v-1.5h1v1.526c2.158.073 3.012.891 3.257 1.812.29 1.09-.429 2.005-1.046 2.228.75.192 1.789.746 1.789 2.026 0 1.742-1.344 2.908-4 2.908v1.5h-1zm-.5-5.503v2.503c1.984 0 3.344-.188 3.344-1.258 0-1.148-1.469-1.245-3.344-1.245zm0-.997c1.105 0 2.789-.078 2.789-1.25 0-1-1.039-1.25-2.789-1.25v2.5z"
fill="#eee" /></svg> tip</strong></span>
</div>
<input type="text" class="form-control paste-btc-tip-address" name="paste-btc-tip-address"
placeholder="Put a BTC address to ask for a tip. Leave it empty to let us use our."

View File

@ -66,12 +66,18 @@
<div class="paste-options-res">
<div class="btn-group">
<span class="input-group-text">Tip it with<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24"><path d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm0 18v-1.511h-.5v1.511h-1v-1.511h-2.484l.25-1.489h.539c.442 0 .695-.425.695-.854v-4.444c0-.416-.242-.702-.683-.702h-.817v-1.5h2.5v-1.5h1v1.5h.5v-1.5h1v1.526c2.158.073 3.012.891 3.257 1.812.29 1.09-.429 2.005-1.046 2.228.75.192 1.789.746 1.789 2.026 0 1.742-1.344 2.908-4 2.908v1.5h-1zm-.5-5.503v2.503c1.984 0 3.344-.188 3.344-1.258 0-1.148-1.469-1.245-3.344-1.245zm0-.997c1.105 0 2.789-.078 2.789-1.25 0-1-1.039-1.25-2.789-1.25v2.5z" fill="#eee"/></svg></span>
<span class="input-group-text">Tip it with<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18"
viewBox="0 0 24 24">
<path
d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm0 18v-1.511h-.5v1.511h-1v-1.511h-2.484l.25-1.489h.539c.442 0 .695-.425.695-.854v-4.444c0-.416-.242-.702-.683-.702h-.817v-1.5h2.5v-1.5h1v1.5h.5v-1.5h1v1.526c2.158.073 3.012.891 3.257 1.812.29 1.09-.429 2.005-1.046 2.228.75.192 1.789.746 1.789 2.026 0 1.742-1.344 2.908-4 2.908v1.5h-1zm-.5-5.503v2.503c1.984 0 3.344-.188 3.344-1.258 0-1.148-1.469-1.245-3.344-1.245zm0-.997c1.105 0 2.789-.078 2.789-1.25 0-1-1.039-1.25-2.789-1.25v2.5z"
fill="#eee" /></svg></span>
<a class="btn btn-primary btc-tip-address"
href="bitcoin:{{ paste.btc_tip_address or settings.DEFAULT_BTC_TIP_ADDRESS }}">
{{ paste.btc_tip_address or settings.DEFAULT_BTC_TIP_ADDRESS}}
href="bitcoin:{{ paste.btc_tip_address or settings.DEFAULT_BTC_TIP_ADDRESS }}">
{{ paste.btc_tip_address or settings.DEFAULT_BTC_TIP_ADDRESS}}
</a>
<button class="btn btn-secondary">copy</button>
<button v-if="support.clipboard" class="btn btn-secondary" @click.prevent="copyBTCAdressToClipboard()">
{% this.btcCopied ? "copied :)" : "copy" %}
</button>
</div>
</div>
@ -132,22 +138,25 @@
<div>
<textarea rows="10" style="width:100%;" class=" form-control" @keydown.ctrl.enter="encryptAndSendPaste()"
id="content" name="content"></textarea>
<div class="paste-options">
<h6>Paste Options (these options are optionals)</h6>
<div class="paste-options">
<h6>Optional fields (those are <em>not</em> encrypted):</h6>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">Title</span>
</div>
<input type="text" class="form-control paste-excerpt" name="paste-excerpt"
placeholder="Optional paste title. This part is NOT encrypted: anything you type here will be visible by anyone"
placeholder="Anything you type here will be visible by anyone, including search engines."
v-model="newPaste.title" maxlength="60">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1">BTC tip</span>
<span class="input-group-text" id="basic-addon1"><strong><svg xmlns="http://www.w3.org/2000/svg" width="18"
height="18" viewBox="0 0 24 24">
<path
d="M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm0 18v-1.511h-.5v1.511h-1v-1.511h-2.484l.25-1.489h.539c.442 0 .695-.425.695-.854v-4.444c0-.416-.242-.702-.683-.702h-.817v-1.5h2.5v-1.5h1v1.5h.5v-1.5h1v1.526c2.158.073 3.012.891 3.257 1.812.29 1.09-.429 2.005-1.046 2.228.75.192 1.789.746 1.789 2.026 0 1.742-1.344 2.908-4 2.908v1.5h-1zm-.5-5.503v2.503c1.984 0 3.344-.188 3.344-1.258 0-1.148-1.469-1.245-3.344-1.245zm0-.997c1.105 0 2.789-.078 2.789-1.25 0-1-1.039-1.25-2.789-1.25v2.5z"
fill="#eee" /></svg> tip</strong></span>
</div>
<input type="text" class="form-control paste-btc-tip-address" name="paste-btc-tip-address"
placeholder="Put a BTC address to ask for a tip. Leave it empty to let us use our."
@ -155,7 +164,6 @@
</div>
</div>
</div>
<div class="d-flex justify-content-between" v-if="displayBottomToolBar">>