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 true
'Reformat the file information.' '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': [ 'Thread Expansion': [
true true
'Add buttons to expand threads.' 'Add buttons to expand threads.'

View File

@ -8,14 +8,21 @@ FileInfo =
node: -> node: ->
return if !@file or @isClone return if !@file or @isClone
info = $.el 'span', className: 'file-info'
FileInfo.format Conf['fileInfo'], @, 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.previousSibling.nodeValue = ''
@file.link.hidden = true @file.link.hidden = true
{nextSibling} = @file.link {nextSibling} = @file.link
wrapper = $.el 'span', {hidden: true} wrapper = $.el 'span', {hidden: true}
$.replace nextSibling, wrapper $.replace nextSibling, wrapper
$.add wrapper, nextSibling $.add wrapper, nextSibling
info = $.el 'span', className: 'file-info'
FileInfo.format Conf['fileInfo'], @, info
$.after wrapper, info $.after wrapper, info
format: (formatString, post, outputNode) -> format: (formatString, post, outputNode) ->