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 */
|
/* File */
|
||||||
|
.original-file-info,
|
||||||
.fnswitch:hover > .fntrunc,
|
.fnswitch:hover > .fntrunc,
|
||||||
.fnswitch:not(:hover) > .fnfull,
|
.fnswitch:not(:hover) > .fnfull,
|
||||||
.expanded-image > .post > .file > .fileThumb > video[data-md5],
|
.expanded-image > .post > .file > .fileThumb > video[data-md5],
|
||||||
|
|||||||
@ -5,13 +5,18 @@ FileInfo =
|
|||||||
Post.callbacks.push
|
Post.callbacks.push
|
||||||
name: 'File Info Formatting'
|
name: 'File Info Formatting'
|
||||||
cb: @node
|
cb: @node
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return if !@file or @isClone
|
return if !@file or @isClone
|
||||||
@file.link.hidden = true
|
|
||||||
@file.link.previousSibling.nodeValue = @file.link.nextSibling.nodeValue = ''
|
oldInfo = $.el 'span', {className: 'original-file-info'}
|
||||||
info = $.el 'span', className: 'file-info'
|
$.prepend @file.link.parentNode, oldInfo
|
||||||
$.after @file.link.nextSibling, info
|
$.add oldInfo, [@file.link.previousSibling, @file.link, @file.link.nextSibling]
|
||||||
|
|
||||||
|
info = $.el 'span', {className: 'file-info'}
|
||||||
FileInfo.format Conf['fileInfo'], @, info
|
FileInfo.format Conf['fileInfo'], @, info
|
||||||
|
$.prepend @file.text, info
|
||||||
|
|
||||||
format: (formatString, post, outputNode) ->
|
format: (formatString, post, outputNode) ->
|
||||||
output = []
|
output = []
|
||||||
formatString.replace /%(.)|[^%]+/g, (s, c) ->
|
formatString.replace /%(.)|[^%]+/g, (s, c) ->
|
||||||
@ -21,6 +26,7 @@ FileInfo =
|
|||||||
<%= html('${s}') %>
|
<%= html('${s}') %>
|
||||||
''
|
''
|
||||||
$.extend outputNode, <%= html('@{output}') %>
|
$.extend outputNode, <%= html('@{output}') %>
|
||||||
|
|
||||||
formatters:
|
formatters:
|
||||||
t: -> <%= html('${this.file.URL.match(/[^\/]*$/)[0]}') %>
|
t: -> <%= html('${this.file.URL.match(/[^\/]*$/)[0]}') %>
|
||||||
T: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>
|
T: -> <%= html('<a href="${this.file.URL}" target="_blank">&{FileInfo.formatters.t.call(this)}</a>') %>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user