Backport File Info Formatting changes.
- Original file info always goes after reformatted file info so DownThemAll works. - Reformatted file info goes outside span.fileText on /f/, leaving original as first, so embedding works.
This commit is contained in:
parent
ed83e5bdfb
commit
9bae81cf88
@ -946,6 +946,7 @@ span.hide-announcement {
|
||||
}
|
||||
|
||||
/* File */
|
||||
.original-file-info,
|
||||
.fnswitch:hover > .fntrunc,
|
||||
.fnswitch:not(:hover) > .fnfull,
|
||||
.expanded-image > .post > .file > .fileThumb > video[data-md5],
|
||||
|
||||
@ -5,13 +5,18 @@ FileInfo =
|
||||
Post.callbacks.push
|
||||
name: 'File Info Formatting'
|
||||
cb: @node
|
||||
|
||||
node: ->
|
||||
return if !@file or @isClone
|
||||
@file.link.hidden = true
|
||||
@file.link.previousSibling.nodeValue = @file.link.nextSibling.nodeValue = ''
|
||||
info = $.el 'span', className: 'file-info'
|
||||
$.after @file.link.nextSibling, info
|
||||
|
||||
oldInfo = $.el 'span', {className: 'original-file-info'}
|
||||
$.prepend @file.link.parentNode, oldInfo
|
||||
$.add oldInfo, [@file.link.previousSibling, @file.link, @file.link.nextSibling]
|
||||
|
||||
info = $.el 'span', {className: 'file-info'}
|
||||
FileInfo.format Conf['fileInfo'], @, info
|
||||
$.prepend @file.text, info
|
||||
|
||||
format: (formatString, post, outputNode) ->
|
||||
output = []
|
||||
formatString.replace /%(.)|[^%]+/g, (s, c) ->
|
||||
@ -21,6 +26,7 @@ FileInfo =
|
||||
<%= html('${s}') %>
|
||||
''
|
||||
$.extend outputNode, <%= html('@{output}') %>
|
||||
|
||||
formatters:
|
||||
t: -> <%= html('${this.file.URL.match(/[^\/]*$/)[0]}') %>
|
||||
T: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user