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