D:
This commit is contained in:
parent
4f8e304ee8
commit
5a080e7f60
@ -1480,21 +1480,19 @@
|
|||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
next = root.next;
|
next = root.next;
|
||||||
root.next = next.prev = item;
|
root.next = item;
|
||||||
|
item.prev = root;
|
||||||
item.next = next;
|
item.next = next;
|
||||||
return item.prev = root;
|
return next.prev = item;
|
||||||
};
|
};
|
||||||
|
|
||||||
RandomAccessList.prototype.prepend = function(item) {
|
RandomAccessList.prototype.prepend = function(item) {
|
||||||
var ID, first;
|
var first;
|
||||||
ID = item.ID;
|
|
||||||
if (!this[ID]) {
|
|
||||||
this.push(item);
|
|
||||||
}
|
|
||||||
first = this.first;
|
first = this.first;
|
||||||
if (item === first) {
|
if (item === first || !this[item.ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.rmi(item);
|
||||||
item.next = first;
|
item.next = first;
|
||||||
first.prev = item;
|
first.prev = item;
|
||||||
this.first = item;
|
this.first = item;
|
||||||
@ -1505,22 +1503,6 @@
|
|||||||
return this.rm(this.first.ID);
|
return this.rm(this.first.ID);
|
||||||
};
|
};
|
||||||
|
|
||||||
RandomAccessList.prototype.splice = function(start, end) {
|
|
||||||
var cur, next;
|
|
||||||
if (!this[end]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cur = start === 0 ? this.first : this[start];
|
|
||||||
while (cur) {
|
|
||||||
next = cur.next;
|
|
||||||
this.rm(cur.ID);
|
|
||||||
if (!next || cur.ID === end) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cur = next;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RandomAccessList.prototype.rm = function(ID) {
|
RandomAccessList.prototype.rm = function(ID) {
|
||||||
var item;
|
var item;
|
||||||
item = this[ID];
|
item = this[ID];
|
||||||
@ -1554,7 +1536,7 @@
|
|||||||
item = this.first;
|
item = this.first;
|
||||||
while (item) {
|
while (item) {
|
||||||
if (item.ID > ID) {
|
if (item.ID > ID) {
|
||||||
prev = item.prev.prev;
|
prev = item.prev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
item = item.next;
|
item = item.next;
|
||||||
@ -4979,12 +4961,21 @@
|
|||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var ID, fullID, keys, len, post, posts, quote, quotes, _i, _len;
|
var ID, fullID, keys, len, post, posts, quote, quotes, _i, _len;
|
||||||
if (this.isClone || !QuoteThreading.enabled || this.thread.OP === this) {
|
if (this.isClone || !QuoteThreading.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.thread.OP === this) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
|
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
|
||||||
posts = g.posts;
|
posts = g.posts;
|
||||||
if (!(post = posts[fullID]) || post.isHidden) {
|
if (!(post = posts[fullID]) || post.isHidden) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keys = [];
|
keys = [];
|
||||||
@ -4998,6 +4989,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys.length !== 1) {
|
if (keys.length !== 1) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.threaded = keys[0];
|
this.threaded = keys[0];
|
||||||
@ -5008,12 +5002,18 @@
|
|||||||
post = g.posts[this.threaded];
|
post = g.posts[this.threaded];
|
||||||
posts = Unread.posts;
|
posts = Unread.posts;
|
||||||
if (this.thread.OP === post) {
|
if (this.thread.OP === post) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
posts.push(this);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (QuoteThreading.hasRun) {
|
if (QuoteThreading.hasRun) {
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
||||||
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
|
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
posts.push(this);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5026,9 +5026,11 @@
|
|||||||
$.after(root, threadContainer);
|
$.after(root, threadContainer);
|
||||||
} else {
|
} else {
|
||||||
threadContainer = root.nextSibling;
|
threadContainer = root.nextSibling;
|
||||||
|
post = Get.postFromRoot($.x('child::div[contains(@class,"postContainer")][last()]', threadContainer));
|
||||||
}
|
}
|
||||||
$.add(threadContainer, this.nodes.root);
|
$.add(threadContainer, this.nodes.root);
|
||||||
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
|
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
|
||||||
|
this.prev = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!posts[this.ID]) {
|
if (!posts[this.ID]) {
|
||||||
@ -5037,7 +5039,7 @@
|
|||||||
if (posts[post.ID]) {
|
if (posts[post.ID]) {
|
||||||
posts.after(post, this);
|
posts.after(post, this);
|
||||||
} else {
|
} else {
|
||||||
if ((ID = posts.closest(ID)) !== -1) {
|
if ((ID = posts.closest(post.ID)) !== -1) {
|
||||||
posts.after(posts[ID], this);
|
posts.after(posts[ID], this);
|
||||||
} else {
|
} else {
|
||||||
posts.prepend(this);
|
posts.prepend(this);
|
||||||
@ -9699,11 +9701,11 @@
|
|||||||
if (!Unread.posts[ID]) {
|
if (!Unread.posts[ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.posts.rm(ID);
|
|
||||||
if (post === Unread.posts.first) {
|
if (post === Unread.posts.first) {
|
||||||
Unread.lastReadPost = ID;
|
Unread.lastReadPost = ID;
|
||||||
Unread.saveLastReadPost();
|
Unread.saveLastReadPost();
|
||||||
}
|
}
|
||||||
|
Unread.posts.rm(ID);
|
||||||
if ((i = Unread.postsQuotingYou.indexOf(post)) !== -1) {
|
if ((i = Unread.postsQuotingYou.indexOf(post)) !== -1) {
|
||||||
Unread.postsQuotingYou.splice(i, 1);
|
Unread.postsQuotingYou.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1486,21 +1486,19 @@
|
|||||||
}
|
}
|
||||||
this.rmi(item);
|
this.rmi(item);
|
||||||
next = root.next;
|
next = root.next;
|
||||||
root.next = next.prev = item;
|
root.next = item;
|
||||||
|
item.prev = root;
|
||||||
item.next = next;
|
item.next = next;
|
||||||
return item.prev = root;
|
return next.prev = item;
|
||||||
};
|
};
|
||||||
|
|
||||||
RandomAccessList.prototype.prepend = function(item) {
|
RandomAccessList.prototype.prepend = function(item) {
|
||||||
var ID, first;
|
var first;
|
||||||
ID = item.ID;
|
|
||||||
if (!this[ID]) {
|
|
||||||
this.push(item);
|
|
||||||
}
|
|
||||||
first = this.first;
|
first = this.first;
|
||||||
if (item === first) {
|
if (item === first || !this[item.ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.rmi(item);
|
||||||
item.next = first;
|
item.next = first;
|
||||||
first.prev = item;
|
first.prev = item;
|
||||||
this.first = item;
|
this.first = item;
|
||||||
@ -1511,22 +1509,6 @@
|
|||||||
return this.rm(this.first.ID);
|
return this.rm(this.first.ID);
|
||||||
};
|
};
|
||||||
|
|
||||||
RandomAccessList.prototype.splice = function(start, end) {
|
|
||||||
var cur, next;
|
|
||||||
if (!this[end]) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cur = start === 0 ? this.first : this[start];
|
|
||||||
while (cur) {
|
|
||||||
next = cur.next;
|
|
||||||
this.rm(cur.ID);
|
|
||||||
if (!next || cur.ID === end) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
cur = next;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
RandomAccessList.prototype.rm = function(ID) {
|
RandomAccessList.prototype.rm = function(ID) {
|
||||||
var item;
|
var item;
|
||||||
item = this[ID];
|
item = this[ID];
|
||||||
@ -1560,7 +1542,7 @@
|
|||||||
item = this.first;
|
item = this.first;
|
||||||
while (item) {
|
while (item) {
|
||||||
if (item.ID > ID) {
|
if (item.ID > ID) {
|
||||||
prev = item.prev.prev;
|
prev = item.prev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
item = item.next;
|
item = item.next;
|
||||||
@ -4982,12 +4964,21 @@
|
|||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var ID, fullID, keys, len, post, posts, quote, quotes, _i, _len;
|
var ID, fullID, keys, len, post, posts, quote, quotes, _i, _len;
|
||||||
if (this.isClone || !QuoteThreading.enabled || this.thread.OP === this) {
|
if (this.isClone || !QuoteThreading.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.thread.OP === this) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
|
quotes = this.quotes, ID = this.ID, fullID = this.fullID;
|
||||||
posts = g.posts;
|
posts = g.posts;
|
||||||
if (!(post = posts[fullID]) || post.isHidden) {
|
if (!(post = posts[fullID]) || post.isHidden) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
keys = [];
|
keys = [];
|
||||||
@ -5001,6 +4992,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (keys.length !== 1) {
|
if (keys.length !== 1) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
Unread.posts.push(this);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.threaded = keys[0];
|
this.threaded = keys[0];
|
||||||
@ -5011,12 +5005,18 @@
|
|||||||
post = g.posts[this.threaded];
|
post = g.posts[this.threaded];
|
||||||
posts = Unread.posts;
|
posts = Unread.posts;
|
||||||
if (this.thread.OP === post) {
|
if (this.thread.OP === post) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
posts.push(this);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (QuoteThreading.hasRun) {
|
if (QuoteThreading.hasRun) {
|
||||||
height = doc.clientHeight;
|
height = doc.clientHeight;
|
||||||
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
_ref = post.nodes.root.getBoundingClientRect(), bottom = _ref.bottom, top = _ref.top;
|
||||||
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
|
if (!((posts != null ? posts[post.ID] : void 0) || ((bottom < height) && (top > 0)))) {
|
||||||
|
if (Conf['Unread Count']) {
|
||||||
|
posts.push(this);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5029,9 +5029,11 @@
|
|||||||
$.after(root, threadContainer);
|
$.after(root, threadContainer);
|
||||||
} else {
|
} else {
|
||||||
threadContainer = root.nextSibling;
|
threadContainer = root.nextSibling;
|
||||||
|
post = Get.postFromRoot($.x('child::div[contains(@class,"postContainer")][last()]', threadContainer));
|
||||||
}
|
}
|
||||||
$.add(threadContainer, this.nodes.root);
|
$.add(threadContainer, this.nodes.root);
|
||||||
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
|
if (!Conf['Unread Count'] || this.ID < Unread.lastReadPost) {
|
||||||
|
this.prev = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!posts[this.ID]) {
|
if (!posts[this.ID]) {
|
||||||
@ -5040,7 +5042,7 @@
|
|||||||
if (posts[post.ID]) {
|
if (posts[post.ID]) {
|
||||||
posts.after(post, this);
|
posts.after(post, this);
|
||||||
} else {
|
} else {
|
||||||
if ((ID = posts.closest(ID)) !== -1) {
|
if ((ID = posts.closest(post.ID)) !== -1) {
|
||||||
posts.after(posts[ID], this);
|
posts.after(posts[ID], this);
|
||||||
} else {
|
} else {
|
||||||
posts.prepend(this);
|
posts.prepend(this);
|
||||||
@ -9682,11 +9684,11 @@
|
|||||||
if (!Unread.posts[ID]) {
|
if (!Unread.posts[ID]) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Unread.posts.rm(ID);
|
|
||||||
if (post === Unread.posts.first) {
|
if (post === Unread.posts.first) {
|
||||||
Unread.lastReadPost = ID;
|
Unread.lastReadPost = ID;
|
||||||
Unread.saveLastReadPost();
|
Unread.saveLastReadPost();
|
||||||
}
|
}
|
||||||
|
Unread.posts.rm(ID);
|
||||||
if ((i = Unread.postsQuotingYou.indexOf(post)) !== -1) {
|
if ((i = Unread.postsQuotingYou.indexOf(post)) !== -1) {
|
||||||
Unread.postsQuotingYou.splice(i, 1);
|
Unread.postsQuotingYou.splice(i, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,16 +19,16 @@ class RandomAccessList
|
|||||||
@rmi item
|
@rmi item
|
||||||
|
|
||||||
{next} = root
|
{next} = root
|
||||||
root.next = next.prev = item
|
root.next = item
|
||||||
item.next = next
|
|
||||||
item.prev = root
|
item.prev = root
|
||||||
|
item.next = next
|
||||||
|
next.prev = item
|
||||||
|
|
||||||
prepend: (item) ->
|
prepend: (item) ->
|
||||||
{ID} = item
|
|
||||||
@push item unless @[ID]
|
|
||||||
{first} = @
|
{first} = @
|
||||||
return if item is first
|
return if item is first or not @[item.ID]
|
||||||
item.next = first
|
@rmi item
|
||||||
|
item.next = first
|
||||||
first.prev = item
|
first.prev = item
|
||||||
@first = item
|
@first = item
|
||||||
delete item.prev
|
delete item.prev
|
||||||
@ -36,15 +36,6 @@ class RandomAccessList
|
|||||||
shift: ->
|
shift: ->
|
||||||
@rm @first.ID
|
@rm @first.ID
|
||||||
|
|
||||||
splice: (start, end) ->
|
|
||||||
return unless @[end]
|
|
||||||
cur = if start is 0 then @first else @[start]
|
|
||||||
while cur
|
|
||||||
{next} = cur
|
|
||||||
@rm cur.ID
|
|
||||||
return if not next or cur.ID is end
|
|
||||||
cur = next
|
|
||||||
|
|
||||||
rm: (ID) ->
|
rm: (ID) ->
|
||||||
item = @[ID]
|
item = @[ID]
|
||||||
return unless item
|
return unless item
|
||||||
@ -69,7 +60,7 @@ class RandomAccessList
|
|||||||
item = @first
|
item = @first
|
||||||
while item
|
while item
|
||||||
if item.ID > ID
|
if item.ID > ID
|
||||||
{prev} = item.prev
|
{prev} = item
|
||||||
break
|
break
|
||||||
item = item.next
|
item = item.next
|
||||||
return (if prev then prev.ID else -1)
|
return (if prev then prev.ID else -1)
|
||||||
@ -122,10 +122,10 @@ Unread =
|
|||||||
readSinglePost: (post) ->
|
readSinglePost: (post) ->
|
||||||
{ID} = post
|
{ID} = post
|
||||||
return unless Unread.posts[ID]
|
return unless Unread.posts[ID]
|
||||||
Unread.posts.rm ID
|
|
||||||
if post is Unread.posts.first
|
if post is Unread.posts.first
|
||||||
Unread.lastReadPost = ID
|
Unread.lastReadPost = ID
|
||||||
Unread.saveLastReadPost()
|
Unread.saveLastReadPost()
|
||||||
|
Unread.posts.rm ID
|
||||||
if (i = Unread.postsQuotingYou.indexOf post) isnt -1
|
if (i = Unread.postsQuotingYou.indexOf post) isnt -1
|
||||||
Unread.postsQuotingYou.splice i, 1
|
Unread.postsQuotingYou.splice i, 1
|
||||||
Unread.update()
|
Unread.update()
|
||||||
|
|||||||
@ -32,18 +32,25 @@ QuoteThreading =
|
|||||||
QuoteThreading.hasRun = true
|
QuoteThreading.hasRun = true
|
||||||
|
|
||||||
node: ->
|
node: ->
|
||||||
return if @isClone or not QuoteThreading.enabled or @thread.OP is @
|
return if @isClone or not QuoteThreading.enabled
|
||||||
|
if @thread.OP is @
|
||||||
|
Unread.posts.push @ if Conf['Unread Count']
|
||||||
|
return
|
||||||
|
|
||||||
{quotes, ID, fullID} = @
|
{quotes, ID, fullID} = @
|
||||||
{posts} = g
|
{posts} = g
|
||||||
return if !(post = posts[fullID]) or post.isHidden # Filtered
|
if !(post = posts[fullID]) or post.isHidden # Filtered
|
||||||
|
Unread.posts.push @ if Conf['Unread Count']
|
||||||
|
return
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
len = "#{g.BOARD}".length + 1
|
len = "#{g.BOARD}".length + 1
|
||||||
for quote in quotes when quote[len..] < ID
|
for quote in quotes when quote[len..] < ID
|
||||||
keys.push quote if quote of posts
|
keys.push quote if quote of posts
|
||||||
|
|
||||||
return unless keys.length is 1
|
unless keys.length is 1
|
||||||
|
Unread.posts.push @ if Conf['Unread Count']
|
||||||
|
return
|
||||||
|
|
||||||
@threaded = keys[0]
|
@threaded = keys[0]
|
||||||
@cb = QuoteThreading.nodeinsert
|
@cb = QuoteThreading.nodeinsert
|
||||||
@ -52,14 +59,18 @@ QuoteThreading =
|
|||||||
post = g.posts[@threaded]
|
post = g.posts[@threaded]
|
||||||
{posts} = Unread
|
{posts} = Unread
|
||||||
|
|
||||||
return false if @thread.OP is post
|
if @thread.OP is post
|
||||||
|
posts.push @ if Conf['Unread Count']
|
||||||
|
return false
|
||||||
|
|
||||||
if QuoteThreading.hasRun
|
if QuoteThreading.hasRun
|
||||||
height = doc.clientHeight
|
height = doc.clientHeight
|
||||||
{bottom, top} = post.nodes.root.getBoundingClientRect()
|
{bottom, top} = post.nodes.root.getBoundingClientRect()
|
||||||
|
|
||||||
# Post is unread or is fully visible.
|
# Post is unread or is fully visible.
|
||||||
return false unless posts?[post.ID] or ((bottom < height) and (top > 0))
|
unless posts?[post.ID] or ((bottom < height) and (top > 0))
|
||||||
|
posts.push @ if Conf['Unread Count']
|
||||||
|
return false
|
||||||
|
|
||||||
root = post.nodes.root
|
root = post.nodes.root
|
||||||
unless $.hasClass root, 'threadOP'
|
unless $.hasClass root, 'threadOP'
|
||||||
@ -69,17 +80,20 @@ QuoteThreading =
|
|||||||
$.after root, threadContainer
|
$.after root, threadContainer
|
||||||
else
|
else
|
||||||
threadContainer = root.nextSibling
|
threadContainer = root.nextSibling
|
||||||
|
post = Get.postFromRoot $.x 'child::div[contains(@class,"postContainer")][last()]', threadContainer
|
||||||
|
|
||||||
$.add threadContainer, @nodes.root
|
$.add threadContainer, @nodes.root
|
||||||
|
|
||||||
return true if not Conf['Unread Count'] or @ID < Unread.lastReadPost
|
if not Conf['Unread Count'] or @ID < Unread.lastReadPost
|
||||||
|
@prev = true # Force Unread Count to ignore this post
|
||||||
|
return true
|
||||||
|
|
||||||
posts.push @ unless posts[@ID]
|
posts.push @ unless posts[@ID]
|
||||||
|
|
||||||
if posts[post.ID]
|
if posts[post.ID]
|
||||||
posts.after post, @
|
posts.after post, @
|
||||||
else
|
else
|
||||||
if (ID = posts.closest ID) isnt -1
|
if (ID = posts.closest post.ID) isnt -1
|
||||||
posts.after posts[ID], @
|
posts.after posts[ID], @
|
||||||
else
|
else
|
||||||
posts.prepend @
|
posts.prepend @
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user