Implement 'Remove Original Link' option. #364

This commit is contained in:
ccd0 2015-03-22 23:39:53 -07:00
parent f0be015897
commit 7c5a4708dc
2 changed files with 19 additions and 7 deletions

View File

@ -64,6 +64,11 @@ Config =
true
'Reformat the file information.'
]
'Remove Original Link': [
false
'Remove the original file link rather than hiding it. May cause incompatibilities with other scripts.'
1
]
'Thread Expansion': [
true
'Add buttons to expand threads.'

View File

@ -8,15 +8,22 @@ FileInfo =
node: ->
return if !@file or @isClone
@file.link.previousSibling.nodeValue = ''
@file.link.hidden = true
{nextSibling} = @file.link
wrapper = $.el 'span', {hidden: true}
$.replace nextSibling, wrapper
$.add wrapper, nextSibling
info = $.el 'span', className: 'file-info'
FileInfo.format Conf['fileInfo'], @, info
$.after wrapper, info
if Conf['Remove Original Link'] and not (@board.ID is 'f' and Conf['Enable Native Flash Embedding'])
{parentNode} = @file.link
$.rmAll parentNode
$.add parentNode, info
else
@file.link.previousSibling.nodeValue = ''
@file.link.hidden = true
{nextSibling} = @file.link
wrapper = $.el 'span', {hidden: true}
$.replace nextSibling, wrapper
$.add wrapper, nextSibling
$.after wrapper, info
format: (formatString, post, outputNode) ->
output = []