Add dl for text

This commit is contained in:
ksamuel 2020-08-13 19:04:57 +02:00
parent e667e1f947
commit e37ed06a47
1 changed files with 13 additions and 7 deletions

View File

@ -670,6 +670,7 @@ window.zerobin = {
reader.onload = function (event) {
var image = new Image();
image.src = event.target.result;
content.value = event.target.result
image.onload = function () {
var imgWrapper = document.createElement('div');
@ -733,10 +734,6 @@ if (content && key) {
/* When done */
function (content) {
/* Decrypted content goes back to initial container*/
document.querySelector('#paste-content').innerText = content;
app.currentPaste.content = content
if (content.indexOf('data:image') == 0) {
// Display Image
@ -748,21 +745,30 @@ if (content && key) {
imgWrapper.classList.add('paste-wrapper');
var img = document.createElement('img');
img.src = content;
//img.style.maxWidth = '742px';
pasteContent.after(imgWrapper);
imgWrapper.appendChild(img);
// Display Download button
document.querySelectorAll('.btn-clone').forEach((node) => node.style.display = "none")
let extension = /data:image\/([^;]+);base64/.exec(content)[1];
app.downloadLink = {
name: '0bin_' + document.location.pathname.split('/').pop(),
name: '0bin_' + document.location.pathname.split('/').pop() + '.' + extension,
url: content
}
} else {
app.currentPaste.type = "text"
/* Decrypted content goes back to initial container*/
document.querySelector('#paste-content').innerText = content;
app.currentPaste.content = content
app.downloadLink = {
name: '0bin_' + document.location.pathname.split('/').pop() + ".txt",
url: "data:text/html;charset=UTF-8," + content
}
}
bar.set('Code coloration...', '95%');