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:
ccd0 2015-03-23 18:48:08 -07:00
parent ed83e5bdfb
commit 9bae81cf88
2 changed files with 11 additions and 4 deletions

View File

@ -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],

View File

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