Move CSS class addition to init; remember value of setting so we stay consistent if setting changed.

This commit is contained in:
ccd0 2017-10-22 21:56:04 -07:00
parent 5a5dd2a0c3
commit 6570faff7a

View File

@ -14,6 +14,11 @@ QuoteBacklink =
init: -> init: ->
return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Backlinks'] return if g.VIEW not in ['index', 'thread'] or !Conf['Quote Backlinks']
# Add a class to differentiate when backlinks are at
# the top (default) or bottom of a post
if (@bottomBacklinks = Conf['Bottom Backlinks'])
$.addClass doc, 'bottom-backlinks'
Callbacks.Post.push Callbacks.Post.push
name: 'Quote Backlinking Part 1' name: 'Quote Backlinking Part 1'
cb: @firstNode cb: @firstNode
@ -48,10 +53,6 @@ QuoteBacklink =
$.add container, nodes $.add container, nodes
return return
secondNode: -> secondNode: ->
# Add a class to differentiate when backlinks are at
# the top (default) or bottom of a post
if Conf['Bottom Backlinks']
$.addClass doc, 'bottom-backlinks'
if @isClone and (@origin.isReply or Conf['OP Backlinks']) if @isClone and (@origin.isReply or Conf['OP Backlinks'])
@nodes.backlinkContainer = $ '.container', @nodes.info @nodes.backlinkContainer = $ '.container', @nodes.info
return return
@ -59,7 +60,7 @@ QuoteBacklink =
return unless @isReply or Conf['OP Backlinks'] return unless @isReply or Conf['OP Backlinks']
container = QuoteBacklink.getContainer @fullID container = QuoteBacklink.getContainer @fullID
@nodes.backlinkContainer = container @nodes.backlinkContainer = container
if Conf['Bottom Backlinks'] if QuoteBacklink.bottomBacklinks
$.add @nodes.post, container $.add @nodes.post, container
else else
$.add @nodes.info, container $.add @nodes.info, container