summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Foster <savetheinternet@tinyboard.org>2013-08-31 19:59:26 +1000
committerMichael Foster <savetheinternet@tinyboard.org>2013-08-31 19:59:26 +1000
commitc567131ca703a8bda0c3b1ca83fa2cae5af863a4 (patch)
treeefbddc038af862fcabe19a0c8dc1f3dbbc61e9bc
parent3287e574210fa8531d1ab2d9f658c8dc2cd949e0 (diff)
bugfix: work with truncated filenames
-rw-r--r--js/download-original.js12
1 files changed, 10 insertions, 2 deletions
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(
$('<a></a>')
- .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 + ')' : ''))
);
});
});