#16 - When displaying an image add a download button

This commit is contained in:
Rémy HUBSCHER 2013-01-19 17:48:04 +01:00
parent 74bfee09c8
commit b5de896ef6
1 changed files with 11 additions and 1 deletions

View File

@ -501,7 +501,6 @@ $('.btn-primary').live("click", function(e){
'Error');
}
}
});
/**
@ -557,11 +556,22 @@ if (content && key) {
$('#paste-content').text(content);
if(content.indexOf('data:image') == 0) {
// Display Image
$('#paste-content').hide();
var img = $('<img/>');
$(img).attr('src', content);
$(img).css('max-width', '742px');
$('#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%');