Small adjustments in backlinking.
This commit is contained in:
parent
012d3ea332
commit
320cb1269c
@ -665,8 +665,7 @@
|
||||
post: post,
|
||||
info: info,
|
||||
comment: $('.postMessage', post),
|
||||
quotelinks: [],
|
||||
backlinks: info.getElementsByClassName('backlink')
|
||||
quotelinks: []
|
||||
};
|
||||
this.info = {};
|
||||
if (subject = $('.subject', info)) {
|
||||
@ -772,6 +771,7 @@
|
||||
|
||||
function Clone(origin) {
|
||||
var file, index, info, key, nodes, post, quotelink, root, val, _i, _j, _len, _len1, _ref, _ref1, _ref2;
|
||||
this.origin = origin;
|
||||
_ref = ['ID', 'board', 'thread', 'info', 'quotes', 'isReply'];
|
||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||
key = _ref[_i];
|
||||
@ -786,8 +786,7 @@
|
||||
post: post,
|
||||
info: info,
|
||||
comment: $('.postMessage', post),
|
||||
quotelinks: [],
|
||||
backlinks: info.getElementsByClassName('backlinks')
|
||||
quotelinks: []
|
||||
};
|
||||
if (nodes.subject) {
|
||||
this.nodes.subject = $('.subject', info);
|
||||
@ -813,9 +812,6 @@
|
||||
if (nodes.date) {
|
||||
this.nodes.date = $('.dateTime', info);
|
||||
}
|
||||
if (nodes.backlinkContainer) {
|
||||
this.nodes.backlinkContainer = $('.container', info);
|
||||
}
|
||||
_ref1 = $$('.quotelink', this.nodes.comment);
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
quotelink = _ref1[_j];
|
||||
@ -1093,11 +1089,18 @@
|
||||
},
|
||||
secondNode: function() {
|
||||
var container;
|
||||
if (this.isClone || !(Conf['OP Backlinks'] || this.isReply)) {
|
||||
if (this.isClone && this.origin.nodes.backlinkContainer) {
|
||||
container = $('.container', this.nodes.info);
|
||||
this.nodes.backlinkContainer = container;
|
||||
this.nodes.backlinks = container.getElementsByClassName('backlinks');
|
||||
return;
|
||||
}
|
||||
if (!(Conf['OP Backlinks'] || this.isReply)) {
|
||||
return;
|
||||
}
|
||||
container = QuoteBacklink.getContainer("" + this.board + "." + this);
|
||||
this.nodes.backlinkContainer = container;
|
||||
this.nodes.backlinks = container.getElementsByClassName('backlinks');
|
||||
return $.add(this.nodes.info, container);
|
||||
},
|
||||
getContainer: function(id) {
|
||||
|
||||
@ -512,7 +512,6 @@ class Post
|
||||
info: info
|
||||
comment: $ '.postMessage', post
|
||||
quotelinks: []
|
||||
backlinks: info.getElementsByClassName 'backlink'
|
||||
|
||||
@info = {}
|
||||
if subject = $ '.subject', info
|
||||
@ -602,7 +601,7 @@ class Post
|
||||
$.rm clone.nodes.root
|
||||
|
||||
class Clone extends Post
|
||||
constructor: (origin) ->
|
||||
constructor: (@origin) ->
|
||||
for key in ['ID', 'board', 'thread', 'info', 'quotes', 'isReply']
|
||||
# Copy or point to the origin's key value.
|
||||
@[key] = origin[key]
|
||||
@ -617,26 +616,23 @@ class Clone extends Post
|
||||
info: info
|
||||
comment: $ '.postMessage', post
|
||||
quotelinks: []
|
||||
backlinks: info.getElementsByClassName 'backlinks'
|
||||
|
||||
if nodes.subject
|
||||
@nodes.subject = $ '.subject', info
|
||||
@nodes.subject = $ '.subject', info
|
||||
if nodes.name
|
||||
@nodes.name = $ '.name', info
|
||||
@nodes.name = $ '.name', info
|
||||
if nodes.email
|
||||
@nodes.email = $ '.useremail', info
|
||||
@nodes.email = $ '.useremail', info
|
||||
if nodes.tripcode
|
||||
@nodes.tripcode = $ '.postertrip', info
|
||||
@nodes.tripcode = $ '.postertrip', info
|
||||
if nodes.uniqueID
|
||||
@nodes.uniqueID = $ '.posteruid', info
|
||||
@nodes.uniqueID = $ '.posteruid', info
|
||||
if nodes.capcode
|
||||
@nodes.capcode = $ '.capcode', info
|
||||
@nodes.capcode = $ '.capcode', info
|
||||
if nodes.flag
|
||||
@nodes.flag = $ '.countryFlag', info
|
||||
@nodes.flag = $ '.countryFlag', info
|
||||
if nodes.date
|
||||
@nodes.date = $ '.dateTime', info
|
||||
if nodes.backlinkContainer
|
||||
@nodes.backlinkContainer = $ '.container', info
|
||||
@nodes.date = $ '.dateTime', info
|
||||
|
||||
for quotelink in $$ '.quotelink', @nodes.comment
|
||||
# See comments in Post's constructor.
|
||||
@ -916,7 +912,6 @@ QuoteBacklink =
|
||||
# - newly fetched posts.
|
||||
# - in copies.
|
||||
# XXX what about order for fetched posts?
|
||||
# XXX need to work on post copying first before appending inside copies too
|
||||
#
|
||||
# First callback creates backlinks and add them to relevant containers.
|
||||
# Second callback adds relevant containers into posts.
|
||||
@ -956,10 +951,16 @@ QuoteBacklink =
|
||||
$.add container, [$.tn(' '), link]
|
||||
return
|
||||
secondNode: ->
|
||||
if @isClone and @origin.nodes.backlinkContainer
|
||||
container = $ '.container', @nodes.info
|
||||
@nodes.backlinkContainer = container
|
||||
@nodes.backlinks = container.getElementsByClassName 'backlinks'
|
||||
return
|
||||
# Don't backlink the OP.
|
||||
return if @isClone or !(Conf['OP Backlinks'] or @isReply)
|
||||
return unless Conf['OP Backlinks'] or @isReply
|
||||
container = QuoteBacklink.getContainer "#{@board}.#{@}"
|
||||
@nodes.backlinkContainer = container
|
||||
@nodes.backlinks = container.getElementsByClassName 'backlinks'
|
||||
$.add @nodes.info, container
|
||||
getContainer: (id) ->
|
||||
@containers[id] or=
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user