parent
b9f0aa47fc
commit
101f593e18
@ -750,12 +750,25 @@
|
|||||||
}
|
}
|
||||||
this.isReply = $.hasClass(post, 'reply');
|
this.isReply = $.hasClass(post, 'reply');
|
||||||
if (that.isArchived) {
|
if (that.isArchived) {
|
||||||
this.isDead = true;
|
this.kill();
|
||||||
}
|
}
|
||||||
this.clones = [];
|
this.clones = [];
|
||||||
g.posts["" + board + "." + this] = thread.posts[this] = board.posts[this] = this;
|
g.posts["" + board + "." + this] = thread.posts[this] = board.posts[this] = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Post.prototype.kill = function(img) {
|
||||||
|
if (this.file && !this.file.isDead) {
|
||||||
|
this.file.isDead = true;
|
||||||
|
$.log('kill image', this.ID);
|
||||||
|
}
|
||||||
|
if (img) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.log('kill post', this.ID);
|
||||||
|
this.isDead = true;
|
||||||
|
return $.addClass(this.nodes.root, 'dead');
|
||||||
|
};
|
||||||
|
|
||||||
Post.prototype.addClone = function(context) {
|
Post.prototype.addClone = function(context) {
|
||||||
return new Clone(this, context);
|
return new Clone(this, context);
|
||||||
};
|
};
|
||||||
@ -1623,6 +1636,8 @@
|
|||||||
textContent: "" + quote + "\u00A0(Dead)",
|
textContent: "" + quote + "\u00A0(Dead)",
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
});
|
});
|
||||||
|
a.setAttribute('data-board', board);
|
||||||
|
a.setAttribute('data-postid', ID);
|
||||||
} else {
|
} else {
|
||||||
a = $.el('a', {
|
a = $.el('a', {
|
||||||
href: "/" + board + "/" + post.thread + "/res/#p" + ID,
|
href: "/" + board + "/" + post.thread + "/res/#p" + ID,
|
||||||
@ -2526,7 +2541,7 @@
|
|||||||
default:
|
default:
|
||||||
this.unsuccessfulFetchCount++;
|
this.unsuccessfulFetchCount++;
|
||||||
this.set('timer', this.getInterval());
|
this.set('timer', this.getInterval());
|
||||||
this.set('status', this.req.statusText);
|
this.set('status', "" + this.req.statusText + " (" + this.req.status + ")");
|
||||||
this.status.className = 'warning';
|
this.status.className = 'warning';
|
||||||
}
|
}
|
||||||
return delete this.req;
|
return delete this.req;
|
||||||
@ -2589,23 +2604,40 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
_Class.prototype.parse = function(postObjects) {
|
_Class.prototype.parse = function(postObjects) {
|
||||||
var count, node, nodes, postObject, posts, scroll, spoilerRange, _i, _len, _ref;
|
var ID, count, i, image, index, node, nodes, num, post, postObject, posts, scroll, _i, _len, _ref;
|
||||||
if (spoilerRange = postObjects[0].custom_spoiler) {
|
Build.spoilerRange[this.thread.board] = postObjects[0].custom_spoiler;
|
||||||
Build.spoilerRange[this.thread.board] = spoilerRange;
|
|
||||||
}
|
|
||||||
nodes = [];
|
nodes = [];
|
||||||
posts = [];
|
posts = [];
|
||||||
|
index = [];
|
||||||
|
image = [];
|
||||||
count = 0;
|
count = 0;
|
||||||
_ref = postObjects.reverse();
|
for (_i = 0, _len = postObjects.length; _i < _len; _i++) {
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
postObject = postObjects[_i];
|
||||||
postObject = _ref[_i];
|
num = postObject.no;
|
||||||
if (postObject.no <= this.lastPost) {
|
index.push(num);
|
||||||
break;
|
if (postObject.ext) {
|
||||||
|
image.push(num);
|
||||||
|
}
|
||||||
|
if (num <= this.lastPost) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
node = Build.postFromObject(postObject, this.thread.board.ID);
|
node = Build.postFromObject(postObject, this.thread.board.ID);
|
||||||
nodes.unshift(node);
|
nodes.push(node);
|
||||||
posts.unshift(new Post(node, this.thread, this.thread.board));
|
posts.push(new Post(node, this.thread, this.thread.board));
|
||||||
|
}
|
||||||
|
_ref = this.thread.posts;
|
||||||
|
for (i in _ref) {
|
||||||
|
post = _ref[i];
|
||||||
|
if (post.isDead) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
ID = post.ID;
|
||||||
|
if (-1 === index.indexOf(ID)) {
|
||||||
|
post.kill();
|
||||||
|
} else if (post.file && !post.file.isDead && -1 === image.indexOf(ID)) {
|
||||||
|
post.kill(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (count) {
|
if (count) {
|
||||||
this.set('status', "+" + count);
|
this.set('status', "+" + count);
|
||||||
|
|||||||
@ -598,10 +598,18 @@ class Post
|
|||||||
@file.dimensions = @file.text.textContent.match(/\d+x\d+/)[0]
|
@file.dimensions = @file.text.textContent.match(/\d+x\d+/)[0]
|
||||||
|
|
||||||
@isReply = $.hasClass post, 'reply'
|
@isReply = $.hasClass post, 'reply'
|
||||||
@isDead = true if that.isArchived
|
@kill() if that.isArchived
|
||||||
@clones = []
|
@clones = []
|
||||||
g.posts["#{board}.#{@}"] = thread.posts[@] = board.posts[@] = @
|
g.posts["#{board}.#{@}"] = thread.posts[@] = board.posts[@] = @
|
||||||
|
|
||||||
|
kill: (img) ->
|
||||||
|
if @file and !@file.isDead
|
||||||
|
@file.isDead = true
|
||||||
|
return if img
|
||||||
|
@isDead = true
|
||||||
|
$.addClass @nodes.root, 'dead'
|
||||||
|
# XXX style dead posts.
|
||||||
|
# XXX update quotelinks/backlinks to this post.
|
||||||
addClone: (context) ->
|
addClone: (context) ->
|
||||||
new Clone @, context
|
new Clone @, context
|
||||||
rmClone: (index) ->
|
rmClone: (index) ->
|
||||||
@ -1577,6 +1585,8 @@ Quotify =
|
|||||||
className: 'quotelink deadlink'
|
className: 'quotelink deadlink'
|
||||||
textContent: "#{quote}\u00A0(Dead)"
|
textContent: "#{quote}\u00A0(Dead)"
|
||||||
target: '_blank'
|
target: '_blank'
|
||||||
|
a.setAttribute 'data-board', board
|
||||||
|
a.setAttribute 'data-postid', ID
|
||||||
else
|
else
|
||||||
# Don't (Dead) when quotifying in an archived post,
|
# Don't (Dead) when quotifying in an archived post,
|
||||||
# and we know the post still exists.
|
# and we know the post still exists.
|
||||||
@ -2246,7 +2256,7 @@ ThreadUpdater =
|
|||||||
else
|
else
|
||||||
@unsuccessfulFetchCount++
|
@unsuccessfulFetchCount++
|
||||||
@set 'timer', @getInterval()
|
@set 'timer', @getInterval()
|
||||||
@set 'status', @req.statusText
|
@set 'status', "#{@req.statusText} (#{@req.status})"
|
||||||
@status.className = 'warning'
|
@status.className = 'warning'
|
||||||
delete @req
|
delete @req
|
||||||
|
|
||||||
@ -2291,18 +2301,33 @@ ThreadUpdater =
|
|||||||
headers: 'If-Modified-Since': @lastModified
|
headers: 'If-Modified-Since': @lastModified
|
||||||
|
|
||||||
parse: (postObjects) ->
|
parse: (postObjects) ->
|
||||||
if spoilerRange = postObjects[0].custom_spoiler
|
Build.spoilerRange[@thread.board] = postObjects[0].custom_spoiler
|
||||||
Build.spoilerRange[@thread.board] = spoilerRange
|
|
||||||
|
|
||||||
nodes = []
|
nodes = [] # post container elements
|
||||||
posts = []
|
posts = [] # post objects
|
||||||
count = 0
|
index = [] # existing posts
|
||||||
for postObject in postObjects.reverse()
|
image = [] # existing images
|
||||||
break if postObject.no <= @lastPost # Make sure to not insert older posts.
|
count = 0 # new posts count
|
||||||
|
# Build the index, create posts.
|
||||||
|
for postObject in postObjects
|
||||||
|
num = postObject.no
|
||||||
|
index.push num
|
||||||
|
image.push num if postObject.ext
|
||||||
|
continue if num <= @lastPost
|
||||||
|
# Insert new posts, not older ones.
|
||||||
count++
|
count++
|
||||||
node = Build.postFromObject postObject, @thread.board.ID
|
node = Build.postFromObject postObject, @thread.board.ID
|
||||||
nodes.unshift node
|
nodes.push node
|
||||||
posts.unshift new Post node, @thread, @thread.board
|
posts.push new Post node, @thread, @thread.board
|
||||||
|
|
||||||
|
# Check for deleted posts and deleted images.
|
||||||
|
for i, post of @thread.posts
|
||||||
|
continue if post.isDead
|
||||||
|
{ID} = post
|
||||||
|
if -1 is index.indexOf ID
|
||||||
|
post.kill()
|
||||||
|
else if post.file and !post.file.isDead and -1 is image.indexOf ID
|
||||||
|
post.kill true
|
||||||
|
|
||||||
if count
|
if count
|
||||||
@set 'status', "+#{count}"
|
@set 'status', "+#{count}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user