4chan-x/src/Menu/DownloadLink.coffee
2013-08-12 00:07:39 -07:00

16 lines
396 B
CoffeeScript
Executable File

DownloadLink =
init: ->
return if g.VIEW is 'catalog' or !Conf['Menu'] or !Conf['Download Link']
a = $.el 'a',
className: 'download-link'
textContent: 'Download file'
$.event 'AddMenuEntry',
type: 'post'
el: a
order: 100
open: ({file}) ->
return false unless file
a.href = file.URL
a.download = file.name
true