bugfix: work with truncated filenames

This commit is contained in:
Michael Foster 2013-08-31 19:59:26 +10:00
parent 3287e57421
commit c567131ca7

View File

@ -16,12 +16,20 @@
onready(function(){ onready(function(){
$('.postfilename').each(function() { $('.postfilename').each(function() {
var filename, truncated;
if ($(this).attr('title')) {
filename = $(this).attr('title');
truncated = true;
} else {
filename = $(this).text();
}
$(this).replaceWith( $(this).replaceWith(
$('<a></a>') $('<a></a>')
.attr('download', $(this).text()) .attr('download', filename)
.append($(this).contents()) .append($(this).contents())
.attr('href', $(this).parent().parent().find('a').attr('href')) .attr('href', $(this).parent().parent().find('a').attr('href'))
.attr('title', _('Save as original filename')) .attr('title', _('Save as original filename') + (truncated ? ' (' + filename + ')' : ''))
); );
}); });
}); });