Implement download button. #633

This commit is contained in:
ccd0 2016-05-07 10:52:03 -07:00
parent dda29feda1
commit 287141d510
2 changed files with 5 additions and 0 deletions

View File

@ -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 &#039;PDF&#039; for PDF files)</div>

View File

@ -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') %>