mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
Use a different way to show the original filename
Conflicts: templates/post/fileinfo.html
This commit is contained in:
parent
8d8f66c701
commit
d81a6c49e2
@ -743,6 +743,8 @@
|
||||
$config['show_ratio'] = false;
|
||||
// Display the file's original filename.
|
||||
$config['show_filename'] = true;
|
||||
// Download the file with its original filename upon clicking on it. Only works when $config['show_filename'] is true.
|
||||
$config['download_filename'] = false;
|
||||
|
||||
// Display image identification links using ImgOps, regex.info/exif and Google Images.
|
||||
$config['image_identification'] = false;
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
@ -7,7 +7,21 @@
|
||||
{% if file.file == 'deleted' %}
|
||||
<img class="post-image deleted" src="{{ config.image_deleted }}" alt="" />
|
||||
{% else %}
|
||||
<p class="fileinfo">File: <a href="{{ config.uri_img }}{{ file.file }}">{{ file.file }}</a> <span class="unimportant">
|
||||
<p class="fileinfo">{% trans %}File:{% endtrans %} <a href="{{ config.uri_img }}{{ file.file }}"
|
||||
{% if config.show_filename and file.filename %}
|
||||
{% if config.download_filename %}
|
||||
download="{{ file.filename|e|bidi_cleanup }}"
|
||||
{% endif %}
|
||||
{% if file.filename|length > config.max_filename_display %}
|
||||
title="{{ file.filename|e|bidi_cleanup }}"
|
||||
>{{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}
|
||||
{% else %}
|
||||
>{{ file.filename|e|bidi_cleanup }}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
>{{ file.file }}
|
||||
{% endif %}
|
||||
</a> <span class="unimportant">
|
||||
(
|
||||
{% if file.thumb == 'spoiler' %}
|
||||
{% trans %}Spoiler Image{% endtrans %},
|
||||
@ -19,14 +33,6 @@
|
||||
, {{ ratio(file.width, file.height) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if config.show_filename and file.filename %}
|
||||
,
|
||||
{% if file.filename|length > config.max_filename_display %}
|
||||
<span class="postfilename" title="{{ file.filename|e|bidi_cleanup }}">{{ file.filename|truncate_filename(config.max_filename_display)|e|bidi_cleanup }}</span>
|
||||
{% else %}
|
||||
<span class="postfilename">{{ file.filename|e|bidi_cleanup }}</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include "post/image_identification.html" %}
|
||||
)
|
||||
</span> {% include "post/file_controls.html" %}</p>
|
||||
|
Loading…
Reference in New Issue
Block a user