mirror of
https://github.com/Tygs/0bin.git
synced 2023-08-10 21:13:00 +03:00
#16 - When displaying an image add a download button
This commit is contained in:
parent
74bfee09c8
commit
b5de896ef6
@ -501,7 +501,6 @@ $('.btn-primary').live("click", function(e){
|
|||||||
'Error');
|
'Error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -557,11 +556,22 @@ if (content && key) {
|
|||||||
$('#paste-content').text(content);
|
$('#paste-content').text(content);
|
||||||
|
|
||||||
if(content.indexOf('data:image') == 0) {
|
if(content.indexOf('data:image') == 0) {
|
||||||
|
// Display Image
|
||||||
$('#paste-content').hide();
|
$('#paste-content').hide();
|
||||||
var img = $('<img/>');
|
var img = $('<img/>');
|
||||||
$(img).attr('src', content);
|
$(img).attr('src', content);
|
||||||
$(img).css('max-width', '742px');
|
$(img).css('max-width', '742px');
|
||||||
$('#paste-content').after(img);
|
$('#paste-content').after(img);
|
||||||
|
|
||||||
|
// Display Download button
|
||||||
|
$('.btn-clone').hide();
|
||||||
|
|
||||||
|
var button = $('<a/>').attr('href', content);
|
||||||
|
$(button).attr('download', '0bin_'+document.location.pathname.split('/').pop());
|
||||||
|
$(button).addClass('btn');
|
||||||
|
$(button).html('<i class="icon-download"></i> Download');
|
||||||
|
$('.btn-clone').after(button);
|
||||||
|
|
||||||
}
|
}
|
||||||
bar.set('Code coloration...', '95%');
|
bar.set('Code coloration...', '95%');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user