1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-28 01:10:51 +01:00

download-original.js: format

This commit is contained in:
Zankaria 2024-08-05 19:10:25 +02:00
parent 5550bc4212
commit 44e9a5aa57

View File

@ -15,16 +15,16 @@
* *
*/ */
onready(function(){ onready(function() {
var do_original_filename = function() { let doOriginalFilename = function() {
var filename, truncated; let filename, truncated;
if ($(this).attr('title')) { if ($(this).attr('title')) {
filename = $(this).attr('title'); filename = $(this).attr('title');
truncated = true; truncated = true;
} else { } else {
filename = $(this).text(); filename = $(this).text();
} }
$(this).replaceWith( $(this).replaceWith(
$('<a></a>') $('<a></a>')
.attr('download', filename) .attr('download', filename)
@ -34,9 +34,9 @@ onready(function(){
); );
}; };
$('.postfilename').each(do_original_filename); $('.postfilename').each(doOriginalFilename);
$(document).on('new_post', function(e, post) { $(document).on('new_post', function(e, post) {
$(post).find('.postfilename').each(do_original_filename); $(post).find('.postfilename').each(doOriginalFilename);
}); });
}); });