Implement download button. #633
This commit is contained in:
parent
dda29feda1
commit
287141d510
@ -69,6 +69,7 @@
|
||||
<div><input name="fileInfo" class="field" spellcheck="false">: <span class="file-info file-info-preview"></span></div>
|
||||
<div>Link: <code>%l</code> (truncated), <code>%L</code> (untruncated), <code>%T</code> (4chan filename)</div>
|
||||
<div>Filename: <code>%n</code> (truncated), <code>%N</code> (untruncated), <code>%t</code> (4chan filename)</div>
|
||||
<div>Download button: <code>%d</code></div>
|
||||
<div>Spoiler indicator: <code>%p</code></div>
|
||||
<div>Size: <code>%B</code> (Bytes), <code>%K</code> (KB), <code>%M</code> (MB), <code>%s</code> (4chan default)</div>
|
||||
<div>Resolution: <code>%r</code> (Displays 'PDF' for PDF files)</div>
|
||||
|
||||
@ -26,6 +26,9 @@ FileInfo =
|
||||
<%= html('${s}') %>
|
||||
''
|
||||
$.extend outputNode, <%= html('@{output}') %>
|
||||
for a in $$ '.download-button', outputNode
|
||||
$.on a, 'click', ImageCommon.download
|
||||
return
|
||||
|
||||
formatters:
|
||||
t: -> <%= html('${this.file.url.match(/[^\/]*$/)[0]}') %>
|
||||
@ -40,6 +43,7 @@ FileInfo =
|
||||
else
|
||||
<%= html('<span class="fnswitch"><span class="fntrunc">${shortname}</span><span class="fnfull">${fullname}</span></span>') %>
|
||||
N: -> <%= html('${this.file.name}') %>
|
||||
d: -> <%= html('<a href="${this.file.url}" download="${this.file.name}" class="fa fa-download download-button"></a>') %>
|
||||
p: -> <%= html('?{this.file.isSpoiler}{Spoiler, }') %>
|
||||
s: -> <%= html('${this.file.size}') %>
|
||||
B: -> <%= html('${Math.round(this.file.sizeInBytes)} Bytes') %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user