get rid of unneeded object
This commit is contained in:
parent
43d78f4a19
commit
a74e8aa4dc
@ -10,55 +10,55 @@ FileInfo =
|
|||||||
@file.text.innerHTML = '<span class="file-info"></span>'
|
@file.text.innerHTML = '<span class="file-info"></span>'
|
||||||
FileInfo.format Conf['fileInfo'], @, @file.text.firstElementChild
|
FileInfo.format Conf['fileInfo'], @, @file.text.firstElementChild
|
||||||
format: (formatString, post, outputNode) ->
|
format: (formatString, post, outputNode) ->
|
||||||
output = innerHTML: ''
|
FileInfo.innerHTML = ''
|
||||||
formatString.replace /%(.)|[^%]+/g, (s, c) ->
|
formatString.replace /%(.)|[^%]+/g, (s, c) ->
|
||||||
if c of FileInfo.formatters
|
if c of FileInfo.formatters
|
||||||
FileInfo.formatters[c].call post, output
|
FileInfo.formatters[c].call post
|
||||||
else
|
else
|
||||||
output.innerHTML += E s
|
FileInfo.innerHTML += E s
|
||||||
''
|
''
|
||||||
outputNode.innerHTML = output.innerHTML
|
outputNode.innerHTML = FileInfo.innerHTML
|
||||||
formatters:
|
formatters:
|
||||||
t: (x) ->
|
t: ->
|
||||||
timestamp = @file.URL.match(/\d+\..+$/)[0]
|
timestamp = @file.URL.match(/\d+\..+$/)[0]
|
||||||
x.innerHTML += E timestamp
|
FileInfo.innerHTML += E timestamp
|
||||||
T: (x) ->
|
T: ->
|
||||||
x.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
FileInfo.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
||||||
FileInfo.formatters.t.call @, x
|
FileInfo.formatters.t.call @
|
||||||
x.innerHTML += '</a>'
|
FileInfo.innerHTML += '</a>'
|
||||||
l: (x) ->
|
l: ->
|
||||||
x.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
FileInfo.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
||||||
FileInfo.formatters.n.call @, x
|
FileInfo.formatters.n.call @
|
||||||
x.innerHTML += '</a>'
|
FileInfo.innerHTML += '</a>'
|
||||||
L: (x) ->
|
L: ->
|
||||||
x.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
FileInfo.innerHTML += "<a href='#{E @file.URL}' target='_blank'>"
|
||||||
FileInfo.formatters.N.call @, x
|
FileInfo.formatters.N.call @
|
||||||
x.innerHTML += '</a>'
|
FileInfo.innerHTML += '</a>'
|
||||||
n: (x) ->
|
n: ->
|
||||||
fullname = @file.name
|
fullname = @file.name
|
||||||
shortname = Build.shortFilename @file.name, @isReply
|
shortname = Build.shortFilename @file.name, @isReply
|
||||||
if fullname is shortname
|
if fullname is shortname
|
||||||
x.innerHTML += E fullname
|
FileInfo.innerHTML += E fullname
|
||||||
else
|
else
|
||||||
x.innerHTML += "<span class='fnswitch'><span class='fntrunc'>#{E shortname}</span><span class='fnfull'>#{E fullname}</span></span>"
|
FileInfo.innerHTML += "<span class='fnswitch'><span class='fntrunc'>#{E shortname}</span><span class='fnfull'>#{E fullname}</span></span>"
|
||||||
N: (x) ->
|
N: ->
|
||||||
x.innerHTML += E @file.name
|
FileInfo.innerHTML += E @file.name
|
||||||
p: (x) ->
|
p: ->
|
||||||
if @file.isSpoiler
|
if @file.isSpoiler
|
||||||
x.innerHTML += 'Spoiler, '
|
FileInfo.innerHTML += 'Spoiler, '
|
||||||
s: (x) ->
|
s: ->
|
||||||
x.innerHTML += E @file.size
|
FileInfo.innerHTML += E @file.size
|
||||||
B: (x) ->
|
B: ->
|
||||||
sizeB = Math.round(@file.sizeInBytes)
|
sizeB = Math.round(@file.sizeInBytes)
|
||||||
x.innerHTML += "#{+sizeB} Bytes"
|
FileInfo.innerHTML += "#{+sizeB} Bytes"
|
||||||
K: (x) ->
|
K: ->
|
||||||
sizeKB = Math.round(@file.sizeInBytes/1024)
|
sizeKB = Math.round(@file.sizeInBytes/1024)
|
||||||
x.innerHTML += "#{+sizeKB} KB"
|
FileInfo.innerHTML += "#{+sizeKB} KB"
|
||||||
M: (x) ->
|
M: ->
|
||||||
sizeMB = Math.round(@file.sizeInBytes/1048576*100)/100
|
sizeMB = Math.round(@file.sizeInBytes/1048576*100)/100
|
||||||
x.innerHTML += "#{+sizeMB} MB"
|
FileInfo.innerHTML += "#{+sizeMB} MB"
|
||||||
r: (x) ->
|
r: ->
|
||||||
dim = @file.dimensions or 'PDF'
|
dim = @file.dimensions or 'PDF'
|
||||||
x.innerHTML += E dim
|
FileInfo.innerHTML += E dim
|
||||||
'%': (x) ->
|
'%': ->
|
||||||
x.innerHTML += '%'
|
FileInfo.innerHTML += '%'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user