Clean links from spoiler and code tags.

This commit is contained in:
Mayhem 2013-08-20 00:33:56 +02:00
parent abfbd734aa
commit 4196ce2600
2 changed files with 7 additions and 4 deletions

View File

@ -29,7 +29,7 @@ Config =
'Reveal Spoilers': [false, 'Reveal spoiler thumbnails.']
'Linkification':
'Linkify': [true, 'Convert text links into hyperlinks.']
'Clean Links': [true, 'Remove spoiler texts commonly used to bypass banned links.']
'Clean Links': [true, 'Remove spoiler and code tags commonly used to bypass blocked links.']
'Menu':
'Menu': [true, 'Add a drop-down menu to posts.']
'Report Link': [true, 'Add a report link to the menu.']

View File

@ -23,7 +23,7 @@ Linkify =
# Replace already-linkified links,
# f.e.: https://boards.4chan.org/b/%
$.replace parent, anchor
Linkify.cleanLink anchor if Conf['Clean Links']
Linkify.cleanLink anchor, link if Conf['Clean Links']
walker.currentNode = anchor.lastChild
else
walker.currentNode = boundaries.endNode
@ -97,5 +97,8 @@ Linkify =
boundaries.endNode = parent
boundaries.endOffset = [parent.childNodes...].indexOf(parentNode) + 1
cleanLink: (anchor) ->
# TODO
cleanLink: (anchor, link) ->
{length} = link
for node in $$ 's, .prettyprint', anchor
$.replace node, [node.childNodes...] if length > node.textContent.length
return