diff options
| author | Jano Slota <jano@alokal.eu> | 2014-07-27 16:48:40 +0200 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2014-08-08 21:52:19 +0200 |
| commit | d81a6c49e28133c65d237fc648be7fe323bfd54d (patch) | |
| tree | 49203f6c8e506019da60d7dd49a26a5396efe4ed /js | |
| parent | 8d8f66c701c0d7577e429b182d520fd7f6c329e5 (diff) | |
Use a different way to show the original filename
Conflicts:
templates/post/fileinfo.html
Diffstat (limited to 'js')
| -rw-r--r-- | js/download-original.js | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/js/download-original.js b/js/download-original.js deleted file mode 100644 index cf9635ac..00000000 --- a/js/download-original.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * download-original.js - * https://github.com/savetheinternet/Tinyboard/blob/master/js/download-original.js - * - * Makes image filenames clickable, allowing users to download and save files as their original filename. - * Only works in newer browsers. http://caniuse.com/#feat=download - * - * Released under the MIT license - * Copyright (c) 2012-2013 Michael Save <savetheinternet@tinyboard.org> - * Copyright (c) 2013-2014 Marcin Ćabanowski <marcin@6irc.net> - * - * Usage: - * $config['additional_javascript'][] = 'js/jquery.min.js'; - * $config['additional_javascript'][] = 'js/download-original.js'; - * - */ - -onready(function(){ - var do_original_filename = function() { - var filename, truncated; - if ($(this).attr('title')) { - filename = $(this).attr('title'); - truncated = true; - } else { - filename = $(this).text(); - } - - $(this).replaceWith( - $('<a></a>') - .attr('download', filename) - .append($(this).contents()) - .attr('href', $(this).parent().parent().find('a').attr('href')) - .attr('title', _('Save as original filename') + (truncated ? ' (' + filename + ')' : '')) - ); - }; - - $('.postfilename').each(do_original_filename); - - $(document).on('new_post', function(e, post) { - $(post).find('.postfilename').each(do_original_filename); - }); -}); |
