Implement 'Open Threads in New Tab'. #149

This commit is contained in:
ccd0 2015-10-30 23:21:33 -07:00
parent 5eb577ac56
commit 7403698720
3 changed files with 25 additions and 0 deletions

View File

@ -15,6 +15,10 @@ Config =
'Show a notice at the top of the page when the index is refreshed.'
1
]
'Open Threads in New Tab': [
false
'Make links to threads in the index / <%= meta.name %> catalog open in a new tab.'
]
'External Catalog': [
false
'Link to external catalog instead of the internal one.'

View File

@ -379,6 +379,7 @@ Main =
['Color User IDs', IDColor]
['Highlight by User ID', IDHighlight]
['Custom CSS', CustomCSS]
['Thread Links', ThreadLinks]
['Linkify', Linkify]
['Reveal Spoilers', RemoveSpoilers]
['Resurrect Quotes', Quotify]

View File

@ -0,0 +1,20 @@
ThreadLinks =
init: ->
return unless g.VIEW is 'index' and Conf['Open Threads in New Tab']
Post.callbacks.push
name: 'Thread Links'
cb: @node
CatalogThread.callbacks.push
name: 'Thread Links'
cb: @catalogNode
node: ->
return if @isReply or @isClone
ThreadLinks.process $('.replylink', @nodes.info)
catalogNode: ->
ThreadLinks.process @nodes.thumb.parentNode
process: (link) ->
link.target = '_blank'